Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Aug 30, 2023
1 parent 5e51e87 commit 56d10be
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 136 deletions.
35 changes: 19 additions & 16 deletions src/Events/TokenReceived.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?php

namespace Hans\Lyra\Events;
namespace Hans\Lyra\Events;

use Hans\Lyra\Models\Invoice;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Hans\Lyra\Models\Invoice;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class TokenReceived {
use Dispatchable, InteractsWithSockets, SerializesModels;
class TokenReceived
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

/**
* Create a new event instance.
*/
public function __construct(
public Invoice $invoice,
public string $token
) {
}
}
/**
* Create a new event instance.
*/
public function __construct(
public Invoice $invoice,
public string $token
) {
}
}
35 changes: 19 additions & 16 deletions src/Events/TransactionIdReceived.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?php

namespace Hans\Lyra\Events;
namespace Hans\Lyra\Events;

use Hans\Lyra\Models\Invoice;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Hans\Lyra\Models\Invoice;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class TransactionIdReceived {
use Dispatchable, InteractsWithSockets, SerializesModels;
class TransactionIdReceived
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;

/**
* Create a new event instance.
*/
public function __construct(
public Invoice $invoice,
public string $transId
) {
}
}
/**
* Create a new event instance.
*/
public function __construct(
public Invoice $invoice,
public string $transId
) {
}
}
35 changes: 19 additions & 16 deletions src/Listeners/CheckTransIdIsUnique.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?php

namespace Hans\Lyra\Listeners;
namespace Hans\Lyra\Listeners;

use Hans\Lyra\Events\TransactionIdReceived;
use Hans\Lyra\Events\TransactionIdReceived;

class CheckTransIdIsUnique {
/**
* Create the event listener.
*/
public function __construct() {
// ...
}
class CheckTransIdIsUnique
{
/**
* Create the event listener.
*/
public function __construct()
{
// ...
}

/**
* Handle the event.
*/
public function handle( TransactionIdReceived $event ): void {
// Access the order using $event->order...
}
}
/**
* Handle the event.
*/
public function handle(TransactionIdReceived $event): void
{
// Access the order using $event->order...
}
}
35 changes: 19 additions & 16 deletions src/Listeners/StoreTokenOnDB.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?php

namespace Hans\Lyra\Listeners;
namespace Hans\Lyra\Listeners;

use Hans\Lyra\Events\TokenReceived;
use Hans\Lyra\Events\TokenReceived;

class StoreTokenOnDB {
/**
* Create the event listener.
*/
public function __construct() {
// ...
}
class StoreTokenOnDB
{
/**
* Create the event listener.
*/
public function __construct()
{
// ...
}

/**
* Handle the event.
*/
public function handle( TokenReceived $event ): void {
// Access the order using $event->order...
}
}
/**
* Handle the event.
*/
public function handle(TokenReceived $event): void
{
// Access the order using $event->order...
}
}
35 changes: 19 additions & 16 deletions src/Listeners/StoreTransIdOnDB.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?php

namespace Hans\Lyra\Listeners;
namespace Hans\Lyra\Listeners;

use Hans\Lyra\Events\TransactionIdReceived;
use Hans\Lyra\Events\TransactionIdReceived;

class StoreTransIdOnDB {
/**
* Create the event listener.
*/
public function __construct() {
// ...
}
class StoreTransIdOnDB
{
/**
* Create the event listener.
*/
public function __construct()
{
// ...
}

/**
* Handle the event.
*/
public function handle( TransactionIdReceived $event ): void {
// Access the order using $event->order...
}
}
/**
* Handle the event.
*/
public function handle(TransactionIdReceived $event): void
{
// Access the order using $event->order...
}
}
118 changes: 62 additions & 56 deletions src/LyraServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,66 +11,72 @@
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;

class LyraServiceProvider extends ServiceProvider {
/**
* Register any application services.
*
* @return void
*/
public function register() {
//
}
class LyraServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}

/**
* Bootstrap any application services.
*
* @return void
*/
public function boot() {
$this->loadMigrationsFrom( __DIR__ . '/../database/migrations' );
$this->mergeConfigFrom( __DIR__ . '/../config/config.php', 'lyra' );
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'lyra');

$this->registerRoutes();
if ( $this->app->runningInConsole() ) {
$this->registerCommands();
$this->registerPublishes();
}
$this->registerRoutes();
if ($this->app->runningInConsole()) {
$this->registerCommands();
$this->registerPublishes();
}

Event::listen( TokenReceived::class, [ StoreTokenOnDB::class ] );
Event::listen( TransactionIdReceived::class, [
CheckTransIdIsUnique::class,
StoreTransIdOnDB::class
] );
}
Event::listen(TokenReceived::class, [StoreTokenOnDB::class]);
Event::listen(TransactionIdReceived::class, [
CheckTransIdIsUnique::class,
StoreTransIdOnDB::class,
]);
}

/**
* Define routes setup.
*
* @return void
*/
private function registerRoutes() {
Route::prefix( 'lyra' )->middleware( 'api' )->group( __DIR__ . '/../routes/api.php' );
}
/**
* Define routes setup.
*
* @return void
*/
private function registerRoutes()
{
Route::prefix('lyra')->middleware('api')->group(__DIR__.'/../routes/api.php');
}

/**
* Register created commands.
*
* @return void
*/
private function registerCommands() {
$this->commands( [
// commands register here
] );
}
/**
* Register created commands.
*
* @return void
*/
private function registerCommands()
{
$this->commands([
// commands register here
]);
}

/**
* Register publishable files.
*
* @return void
*/
private function registerPublishes() {
$this->publishes( [
__DIR__ . '/../config/config.php' => config_path( 'lyra.php' ),
], 'lyra-config' );
}
/**
* Register publishable files.
*
* @return void
*/
private function registerPublishes()
{
$this->publishes([
__DIR__.'/../config/config.php' => config_path('lyra.php'),
], 'lyra-config');
}
}

0 comments on commit 56d10be

Please sign in to comment.