1 | <?php |
||
17 | class Core implements CoreInterface |
||
18 | { |
||
19 | /** @var string Current system environment */ |
||
20 | protected $environment; |
||
21 | |||
22 | /** @var Module[] Loaded modules collection */ |
||
23 | protected $modules = []; |
||
24 | |||
25 | /** |
||
26 | * Core constructor |
||
27 | */ |
||
28 | public function __construct() |
||
33 | |||
34 | /** |
||
35 | * Change current system working environment. |
||
36 | * |
||
37 | * @param string $environment Environment identifier |
||
38 | * |
||
39 | * @return $this Chaining |
||
40 | */ |
||
41 | public function environment($environment = Scheme::BASE) |
||
50 | |||
51 | /** |
||
52 | * Load module. |
||
53 | * |
||
54 | * @param ModuleInterface $instance Module ancestor for loading |
||
55 | * |
||
56 | * @param string|null $alias Module alias |
||
57 | * |
||
58 | * @return $this Chaining |
||
59 | * |
||
60 | * @throws CannotLoadModule On alias duplication |
||
61 | */ |
||
62 | public function load($instance, $alias = null) |
||
83 | |||
84 | /** |
||
85 | * Process request. |
||
86 | * Method supports PSR middleware approach. |
||
87 | * |
||
88 | * @param RequestInterface $request Request instance |
||
89 | * @param ResponseInterface $response Response instance |
||
90 | * @param callable|null $next Next callable middleware |
||
91 | * |
||
92 | * @return ResponseInterface Processed response instance |
||
93 | */ |
||
94 | public function process(RequestInterface $request, ResponseInterface $response, callable $next = null) |
||
98 | } |
||
99 |