Skip to content

Commit

Permalink
refactor: Karnel::class (console and http) required `Application::c…
Browse files Browse the repository at this point in the history
…lass` instead of `Container::class` (#328)
  • Loading branch information
SonyPradana authored May 18, 2024
1 parent 64404de commit 6d14669
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
11 changes: 4 additions & 7 deletions src/System/Integrate/Console/Karnel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,18 @@
namespace System\Integrate\Console;

use System\Console\Style\Style;
use System\Container\Container;
use System\Integrate\Application;

class Karnel
{
/** @var Container */
protected $app;
protected Application $app;
/** @var int concole exit status */
protected $exit_code;

/**
* Set instance.
*
* @param Container $app Application container
* */
public function __construct(Container $app)
*/
public function __construct(Application $app)
{
$this->app = $app;
}
Expand Down
16 changes: 6 additions & 10 deletions src/System/Integrate/Http/Karnel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

namespace System\Integrate\Http;

use System\Container\Container;
use System\Http\Request;
use System\Http\Response;
use System\Integrate\Application;
use System\Integrate\Exceptions\Handler;
use System\Integrate\Http\Middleware\MaintenanceMiddleware;
use System\Router\Router;

class Karnel
{
/** @var Container */
protected $app;
protected Application $app;

/** @var array<int, class-string> Global middleware */
protected $middleware = [
Expand All @@ -26,10 +25,8 @@ class Karnel

/**
* Set instance.
*
* @param Container $app Application container
* */
public function __construct(Container $app)
*/
public function __construct(Application $app)
{
$this->app = $app;
}
Expand Down Expand Up @@ -76,9 +73,8 @@ public function terminate(Request $request, Response $response): void
$this->app->call([$middleware, 'terminate'], ['request' => $request, 'response' => $response]);
}
}
if (method_exists($this->app, 'terminate')) {
$this->app->{'terminate'}();
}

$this->app->terminate();
}

/**
Expand Down

0 comments on commit 6d14669

Please sign in to comment.