1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of Blitz PHP framework. |
5
|
|
|
* |
6
|
|
|
* (c) 2022 Dimitri Sitchet Tomkeu <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view |
9
|
|
|
* the LICENSE file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace BlitzPHP\Config; |
13
|
|
|
|
14
|
|
|
use BlitzPHP\Container\AbstractProvider; |
15
|
|
|
|
16
|
|
|
class Providers extends AbstractProvider |
17
|
|
|
{ |
18
|
|
|
public static function definitions(): array |
19
|
|
|
{ |
20
|
|
|
return array_merge( |
21
|
|
|
self::interfaces(), |
22
|
|
|
self::classes(), |
23
|
|
|
); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Enregistre les interfaces |
28
|
|
|
*/ |
29
|
|
|
private static function interfaces(): array |
30
|
|
|
{ |
31
|
|
|
return [ |
32
|
|
|
\BlitzPHP\Contracts\Autoloader\LocatorInterface::class => static fn () => service('locator'), |
33
|
|
|
\BlitzPHP\Contracts\Container\ContainerInterface::class => static fn () => service('container'), |
34
|
|
|
\BlitzPHP\Contracts\Event\EventManagerInterface::class => static fn () => service('event'), |
35
|
|
|
\BlitzPHP\Contracts\Mail\MailerInterface::class => static fn () => service('mail'), |
36
|
|
|
\BlitzPHP\Contracts\Router\RouteCollectionInterface::class => static fn () => service('routes'), |
37
|
|
|
\BlitzPHP\Contracts\Security\EncrypterInterface::class => static fn () => service('encrypter'), |
38
|
|
|
\BlitzPHP\Contracts\Session\CookieManagerInterface::class => static fn () => service('cookie'), |
39
|
|
|
\BlitzPHP\Contracts\Session\SessionInterface::class => static fn () => service('session'), |
40
|
|
|
\BlitzPHP\Contracts\View\RendererInterface::class => static fn () => service('viewer')->getAdapter(), |
41
|
|
|
\Psr\Container\ContainerInterface::class => static fn () => service('container'), |
42
|
|
|
\Psr\Http\Message\ResponseInterface::class => static fn () => service('response'), |
43
|
|
|
\Psr\Http\Message\ServerRequestInterface::class => static fn () => service('request'), |
44
|
|
|
\Psr\Log\LoggerInterface::class => static fn () => service('logger'), |
45
|
|
|
\Psr\SimpleCache\CacheInterface::class => static fn () => service('cache'), |
46
|
|
|
]; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Enregistre les classes concretes definies comme services |
51
|
|
|
*/ |
52
|
|
|
private static function classes(): array |
53
|
|
|
{ |
54
|
|
|
return [ |
55
|
|
|
\BlitzPHP\Autoloader\Autoloader::class => static fn () => service('autoloader'), |
56
|
|
|
\BlitzPHP\Autoloader\Locator::class => static fn () => service('locator'), |
57
|
|
|
\BlitzPHP\Cache\Cache::class => static fn () => service('cache'), |
58
|
|
|
\BlitzPHP\Cache\ResponseCache::class => static fn () => service('responsecache'), |
59
|
|
|
\BlitzPHP\Filesystem\FilesystemManager::class => static fn () => service('storage'), |
60
|
|
|
\BlitzPHP\Http\Negotiator::class => static fn () => service('negotiator'), |
61
|
|
|
\BlitzPHP\Http\Redirection::class => static fn () => service('redirection'), |
62
|
|
|
\BlitzPHP\Http\Request::class => static fn () => service('request'), |
63
|
|
|
\BlitzPHP\Http\Response::class => static fn () => service('response'), |
64
|
|
|
\BlitzPHP\Mail\Mail::class => static fn () => service('mail'), |
65
|
|
|
\BlitzPHP\Router\RouteCollection::class => static fn () => service('routes'), |
66
|
|
|
\BlitzPHP\Router\Router::class => static fn () => service('router'), |
67
|
|
|
\BlitzPHP\Session\Cookie\CookieManager::class => static fn () => service('cookie'), |
68
|
|
|
\BlitzPHP\Session\Store::class => static fn () => service('session'), |
69
|
|
|
\BlitzPHP\Translator\Translate::class => static fn () => service('translator'), |
70
|
|
|
]; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|