Skip to content

Commit

Permalink
Cx auth adapter service name.
Browse files Browse the repository at this point in the history
use const rather than non existant class
  • Loading branch information
jakejohns committed Oct 17, 2017
1 parent 2a5c538 commit 1d9c9d0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@
}
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"require-dev": {
"phpstan/phpstan": "^0.8.5",
"pds/skeleton": "^1.0"
}
}
13 changes: 7 additions & 6 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Aura\Di\ContainerConfig;

use Aura\Auth;
use Aura\Auth\Adapter\NullAdapter;

/**
* Config
Expand All @@ -38,6 +37,8 @@
*/
class Config extends ContainerConfig
{
const AUTH_ADAPTER = self::class . '::AUTH_ADAPTER';

/**
* Cookie
*
Expand Down Expand Up @@ -83,9 +84,9 @@ public function define(Container $di)
$di->lazyNew(Auth\AuthFactory::class)
);

if (! $di->has(Auth\Adapter::class)) {
if (! $di->has(self::AUTH_ADAPTER)) {
$di->set(
Auth\Adapter::class,
self::AUTH_ADAPTER,
$di->lazyNew(Auth\Adapter\NullAdapter::class)
);
}
Expand All @@ -100,7 +101,7 @@ public function define(Container $di)
$di->lazyGetCall(
Auth\AuthFactory::class,
'newLoginService',
$di->lazyGet(Auth\Adapter::class)
$di->lazyGet(self::AUTH_ADAPTER)
)
);

Expand All @@ -109,7 +110,7 @@ public function define(Container $di)
$di->lazyGetCall(
Auth\AuthFactory::class,
'newLogoutService',
$di->lazyGet(Auth\Adapter::class)
$di->lazyGet(self::AUTH_ADAPTER)
)
);

Expand All @@ -118,7 +119,7 @@ public function define(Container $di)
$di->lazyGetCall(
Auth\AuthFactory::class,
'newResumeService',
$di->lazyGet(Auth\Adapter::class)
$di->lazyGet(self::AUTH_ADAPTER)
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function provideGet()
{
return [
[ Auth\AuthFactory::class, Auth\AuthFactory::class],
[ Auth\Adapter::class, Auth\Adapter\NullAdapter::class ],
[ Config::AUTH_ADAPTER, Auth\Adapter\NullAdapter::class ],
[ Auth\Auth::class, Auth\Auth::class ],
[ Auth\Service\LoginService::class, Auth\Service\LoginService::class ],
[ Auth\Service\LogoutService::class, Auth\Service\LogoutService::class],
Expand Down

0 comments on commit 1d9c9d0

Please sign in to comment.