mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-08-29 08:40:42 +02:00
Removed references to $config in the AppManager class before it's instantiated
This commit is contained in:
@@ -6,7 +6,6 @@ use App\Providers;
|
||||
use DI\Bridge\Slim\Bridge;
|
||||
use DI\Container;
|
||||
use Invoker\CallableResolver;
|
||||
use PHLAK\Config\Config;
|
||||
use Slim\App;
|
||||
use Tightenco\Collect\Support\Collection;
|
||||
|
||||
@@ -27,9 +26,6 @@ class AppManager
|
||||
/** @var Container The applicaiton container */
|
||||
protected $container;
|
||||
|
||||
/** @var Config The application config */
|
||||
protected $config;
|
||||
|
||||
/** @var CallableResolver The callable resolver */
|
||||
protected $callableResolver;
|
||||
|
||||
@@ -38,10 +34,9 @@ class AppManager
|
||||
*
|
||||
* @param \DI\Container $container
|
||||
*/
|
||||
public function __construct(Container $container, Config $config, CallableResolver $callableResolver)
|
||||
public function __construct(Container $container, CallableResolver $callableResolver)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->config = $config;
|
||||
$this->callableResolver = $callableResolver;
|
||||
}
|
||||
|
||||
@@ -66,13 +61,13 @@ class AppManager
|
||||
*/
|
||||
protected function registerProviders(): void
|
||||
{
|
||||
Collection::make(self::PROVIDERS)->merge(
|
||||
$this->config->get('app.providers', [])
|
||||
)->each(function (string $provider) {
|
||||
$this->container->call(
|
||||
$this->callableResolver->resolve($provider)
|
||||
);
|
||||
});
|
||||
Collection::make(self::PROVIDERS)->each(
|
||||
function (string $provider) {
|
||||
$this->container->call(
|
||||
$this->callableResolver->resolve($provider)
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,10 +79,10 @@ class AppManager
|
||||
*/
|
||||
protected function registerMiddlewares(App $app): void
|
||||
{
|
||||
Collection::make(self::MIDDLEWARES)->merge(
|
||||
$this->config->get('app.middlewares', [])
|
||||
)->each(function (string $middleware) use ($app) {
|
||||
$app->add($middleware);
|
||||
});
|
||||
Collection::make(self::MIDDLEWARES)->each(
|
||||
function (string $middleware) use ($app) {
|
||||
$app->add($middleware);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ class AppManangerTest extends TestCase
|
||||
public function test_it_returns_an_app_instance(): void
|
||||
{
|
||||
$callableResolver = $this->container->get(CallableResolver::class);
|
||||
$app = (new AppManager($this->container, $this->config, $callableResolver))();
|
||||
$app = (new AppManager($this->container, $callableResolver))();
|
||||
|
||||
$this->assertInstanceOf(App::class, $app);
|
||||
}
|
||||
|
Reference in New Issue
Block a user