@@ -32,7 +32,6 @@ |
||
32 | 32 | |
33 | 33 | namespace Platine\Container\Exception; |
34 | 34 | |
35 | -class NotFoundException extends ContainerException |
|
36 | -{ |
|
35 | +class NotFoundException extends ContainerException { |
|
37 | 36 | |
38 | 37 | } |
@@ -82,7 +82,7 @@ |
||
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - $callback = function (ReflectionParameter $parameter) use ($container, $parameters) { |
|
85 | + $callback = function(ReflectionParameter $parameter) use ($container, $parameters) { |
|
86 | 86 | return $this->resolveParameter( |
87 | 87 | $container, |
88 | 88 | $parameter, |
@@ -52,8 +52,7 @@ |
||
52 | 52 | use ReflectionException; |
53 | 53 | use ReflectionParameter; |
54 | 54 | |
55 | -class ConstructorResolver implements ResolverInterface |
|
56 | -{ |
|
55 | +class ConstructorResolver implements ResolverInterface { |
|
57 | 56 | /** |
58 | 57 | * {@inheritdoc} |
59 | 58 | */ |
@@ -35,7 +35,6 @@ |
||
35 | 35 | |
36 | 36 | use Exception; |
37 | 37 | |
38 | -class ContainerException extends Exception |
|
39 | -{ |
|
38 | +class ContainerException extends Exception { |
|
40 | 39 | |
41 | 40 | } |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function __construct() |
92 | 92 | { |
93 | - $this->resolver = new ConstructorResolver(); |
|
94 | - $this->storages = new StorageCollection(); |
|
93 | + $this->resolver = new ConstructorResolver(); |
|
94 | + $this->storages = new StorageCollection(); |
|
95 | 95 | self::$instance = $this; |
96 | 96 | } |
97 | 97 | |
@@ -306,12 +306,12 @@ discard block |
||
306 | 306 | if (is_callable($type)) { |
307 | 307 | return Closure::fromCallable($type); |
308 | 308 | } elseif (!is_string($type)) { |
309 | - return function () use ($type) { |
|
309 | + return function() use ($type) { |
|
310 | 310 | return $type; |
311 | 311 | }; |
312 | 312 | } |
313 | 313 | |
314 | - return function ($container, $parameters) use ($type) { |
|
314 | + return function($container, $parameters) use ($type) { |
|
315 | 315 | return $container |
316 | 316 | ->getResolver() |
317 | 317 | ->resolve($container, $type, $parameters); |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | use Platine\Container\Exception\ContainerException; |
53 | 53 | use Platine\Container\Exception\NotFoundException; |
54 | 54 | |
55 | -class Container implements ContainerInterface |
|
56 | -{ |
|
55 | +class Container implements ContainerInterface { |
|
57 | 56 | /** |
58 | 57 | * The container global instance |
59 | 58 | * @var Container|null |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | /** |
88 | 87 | * Create new container instance |
89 | 88 | */ |
90 | - public function __construct() |
|
91 | - { |
|
89 | + public function __construct() { |
|
92 | 90 | $this->resolver = new ConstructorResolver(); |
93 | 91 | $this->storages = new StorageCollection(); |
94 | 92 | self::$instance = $this; |
@@ -135,8 +133,7 @@ discard block |
||
135 | 133 | * Remove all lock when copy this object |
136 | 134 | * @return void |
137 | 135 | */ |
138 | - public function __clone() |
|
139 | - { |
|
136 | + public function __clone() { |
|
140 | 137 | $this->lock = []; |
141 | 138 | } |
142 | 139 | |
@@ -251,8 +248,7 @@ discard block |
||
251 | 248 | * @param array<string, mixed> $parameters |
252 | 249 | * @return mixed |
253 | 250 | */ |
254 | - public function make(string $id, array $parameters = []) |
|
255 | - { |
|
251 | + public function make(string $id, array $parameters = []) { |
|
256 | 252 | if (isset($this->lock[$id])) { |
257 | 253 | throw new ContainerException(sprintf( |
258 | 254 | 'Detected a cyclic dependency while provisioning [%s]', |
@@ -286,8 +282,7 @@ discard block |
||
286 | 282 | /** |
287 | 283 | * {@inheritdoc} |
288 | 284 | */ |
289 | - public function get(string $id) |
|
290 | - { |
|
285 | + public function get(string $id) { |
|
291 | 286 | if (!$this->has($id)) { |
292 | 287 | throw new NotFoundException(sprintf('The type/class [%s] does not exist in the container!', $id)); |
293 | 288 | } |
@@ -50,8 +50,7 @@ |
||
50 | 50 | use Platine\Container\ContainerInterface; |
51 | 51 | use Platine\Container\ParameterCollection; |
52 | 52 | |
53 | -interface ResolverInterface |
|
54 | -{ |
|
53 | +interface ResolverInterface { |
|
55 | 54 | /** |
56 | 55 | * Resolve the instance of the given type |
57 | 56 | * |
@@ -49,8 +49,7 @@ |
||
49 | 49 | |
50 | 50 | use Platine\Container\ContainerInterface; |
51 | 51 | |
52 | -interface StorageInterface |
|
53 | -{ |
|
52 | +interface StorageInterface { |
|
54 | 53 | /** |
55 | 54 | * Return the name of the storage |
56 | 55 | * |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | use Platine\Container\ParameterCollection; |
52 | 52 | use Platine\Container\ParameterInterface; |
53 | 53 | |
54 | -class ParameterCollection |
|
55 | -{ |
|
54 | +class ParameterCollection { |
|
56 | 55 | /** |
57 | 56 | * The array of parameters |
58 | 57 | * @var array<string, ParameterInterface> |
@@ -70,8 +69,7 @@ discard block |
||
70 | 69 | * |
71 | 70 | * @param ParameterInterface[] $parameters the container parameters |
72 | 71 | */ |
73 | - public function __construct(array $parameters = []) |
|
74 | - { |
|
72 | + public function __construct(array $parameters = []) { |
|
75 | 73 | foreach ($parameters as $parameter) { |
76 | 74 | if (!$parameter instanceof ParameterInterface) { |
77 | 75 | throw new InvalidArgumentException(sprintf( |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | use Platine\Container\ParameterCollection; |
54 | 54 | use Platine\Container\StorageInterface; |
55 | 55 | |
56 | -class Storage implements StorageInterface |
|
57 | -{ |
|
56 | +class Storage implements StorageInterface { |
|
58 | 57 | /** |
59 | 58 | * The storage name |
60 | 59 | * @var string |
@@ -118,8 +117,7 @@ discard block |
||
118 | 117 | /** |
119 | 118 | * {@inheritdoc} |
120 | 119 | */ |
121 | - public function getInstance(ContainerInterface $container) |
|
122 | - { |
|
120 | + public function getInstance(ContainerInterface $container) { |
|
123 | 121 | return ($this->closure)($container, $this->parameters); |
124 | 122 | } |
125 | 123 |
@@ -49,8 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | use InvalidArgumentException; |
51 | 51 | |
52 | -class StorageCollection |
|
53 | -{ |
|
52 | +class StorageCollection { |
|
54 | 53 | /** |
55 | 54 | * The array of storages |
56 | 55 | * @var array<string, StorageInterface> |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | * |
69 | 68 | * @param StorageInterface[] $storages the container storages |
70 | 69 | */ |
71 | - public function __construct(array $storages = []) |
|
72 | - { |
|
70 | + public function __construct(array $storages = []) { |
|
73 | 71 | foreach ($storages as $storage) { |
74 | 72 | if (!$storage instanceof StorageInterface) { |
75 | 73 | throw new InvalidArgumentException(sprintf( |