@@ -46,8 +46,7 @@ |
||
46 | 46 | |
47 | 47 | namespace Platine\Container; |
48 | 48 | |
49 | -interface ResolverInterface |
|
50 | -{ |
|
49 | +interface ResolverInterface { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * Resolve the instance of the given type |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | namespace Platine\Container; |
48 | 48 | |
49 | -class Storage implements StorageInterface |
|
50 | -{ |
|
49 | +class Storage implements StorageInterface { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * The storage name |
@@ -112,8 +111,7 @@ discard block |
||
112 | 111 | /** |
113 | 112 | * {@inheritdoc} |
114 | 113 | */ |
115 | - public function getInstance(ContainerInterface $container) |
|
116 | - { |
|
114 | + public function getInstance(ContainerInterface $container) { |
|
117 | 115 | return ($this->closure)($container, $this->parameters); |
118 | 116 | } |
119 | 117 |
@@ -51,8 +51,7 @@ |
||
51 | 51 | use Platine\Container\Exception\ContainerException; |
52 | 52 | use Platine\Container\Exception\NotFoundException; |
53 | 53 | |
54 | -interface ContainerInterface |
|
55 | -{ |
|
54 | +interface ContainerInterface { |
|
56 | 55 | |
57 | 56 | /** |
58 | 57 | * Finds an entry of the container by its identifier and returns it. |
@@ -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 | } |
@@ -32,7 +32,6 @@ |
||
32 | 32 | |
33 | 33 | namespace Platine\Container\Exception; |
34 | 34 | |
35 | -class ContainerException extends \Exception |
|
36 | -{ |
|
35 | +class ContainerException extends \Exception { |
|
37 | 36 | |
38 | 37 | } |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | namespace Platine\Container; |
48 | 48 | |
49 | -class Parameter implements ParameterInterface |
|
50 | -{ |
|
49 | +class Parameter implements ParameterInterface { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * The parameter name |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | * @param string $name the name of the parameter |
68 | 67 | * @param \Closure|mixed $value the parameter value |
69 | 68 | */ |
70 | - public function __construct(string $name, $value) |
|
71 | - { |
|
69 | + public function __construct(string $name, $value) { |
|
72 | 70 | $this->name = $name; |
73 | 71 | $this->value = $value; |
74 | 72 | } |
@@ -84,8 +82,7 @@ discard block |
||
84 | 82 | /** |
85 | 83 | * {@inheritdoc} |
86 | 84 | */ |
87 | - public function getValue(ContainerInterface $container) |
|
88 | - { |
|
85 | + public function getValue(ContainerInterface $container) { |
|
89 | 86 | return ($this->value instanceof \Closure) ? ($this->value)($container) : $this->value; |
90 | 87 | } |
91 | 88 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - $callback = function (\ReflectionParameter $parameter) use ($container, $parameters) { |
|
81 | + $callback = function(\ReflectionParameter $parameter) use ($container, $parameters) { |
|
82 | 82 | return $this->resolveParameter( |
83 | 83 | $container, |
84 | 84 | $parameter, |
@@ -48,8 +48,7 @@ |
||
48 | 48 | |
49 | 49 | use Platine\Container\Exception\ContainerException; |
50 | 50 | |
51 | -class ConstructorResolver implements ResolverInterface |
|
52 | -{ |
|
51 | +class ConstructorResolver implements ResolverInterface { |
|
53 | 52 | |
54 | 53 | /** |
55 | 54 | * {@inheritdoc} |
@@ -322,12 +322,12 @@ |
||
322 | 322 | if (is_callable($type)) { |
323 | 323 | return \Closure::fromCallable($type); |
324 | 324 | } elseif (!is_string($type)) { |
325 | - return function () use ($type) { |
|
325 | + return function() use ($type) { |
|
326 | 326 | return $type; |
327 | 327 | }; |
328 | 328 | } |
329 | 329 | |
330 | - return function ($container, $parameters) use ($type) { |
|
330 | + return function($container, $parameters) use ($type) { |
|
331 | 331 | return $container |
332 | 332 | ->getResolver() |
333 | 333 | ->resolve($container, $type, $parameters); |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | use Platine\Container\Exception\NotFoundException; |
51 | 51 | use Platine\Container\Exception\ContainerException; |
52 | 52 | |
53 | -class Container implements ContainerInterface |
|
54 | -{ |
|
53 | +class Container implements ContainerInterface { |
|
55 | 54 | |
56 | 55 | /** |
57 | 56 | * The container global instance |
@@ -120,8 +119,7 @@ discard block |
||
120 | 119 | * Remove all lock when copy this object |
121 | 120 | * @return void |
122 | 121 | */ |
123 | - public function __clone() |
|
124 | - { |
|
122 | + public function __clone() { |
|
125 | 123 | $this->lock = []; |
126 | 124 | } |
127 | 125 | |
@@ -269,8 +267,7 @@ discard block |
||
269 | 267 | * @param array $parameters |
270 | 268 | * @return mixed |
271 | 269 | */ |
272 | - public function make(string $id, array $parameters = []) |
|
273 | - { |
|
270 | + public function make(string $id, array $parameters = []) { |
|
274 | 271 | if (isset($this->lock[$id])) { |
275 | 272 | throw new ContainerException(sprintf( |
276 | 273 | 'Detected a cyclic dependency while provisioning [%s]', |
@@ -303,8 +300,7 @@ discard block |
||
303 | 300 | /** |
304 | 301 | * {@inheritdoc} |
305 | 302 | */ |
306 | - public function get(string $id) |
|
307 | - { |
|
303 | + public function get(string $id) { |
|
308 | 304 | if (!$this->has($id)) { |
309 | 305 | throw new NotFoundException(sprintf('The type/class [%s] does not exist in the container!', $id)); |
310 | 306 | } |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | namespace Platine\Container; |
48 | 48 | |
49 | -class ParameterCollection |
|
50 | -{ |
|
49 | +class ParameterCollection { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * The array of parameters |
@@ -66,8 +65,7 @@ discard block |
||
66 | 65 | * |
67 | 66 | * @param array $parameters the container parameters |
68 | 67 | */ |
69 | - public function __construct(array $parameters = []) |
|
70 | - { |
|
68 | + public function __construct(array $parameters = []) { |
|
71 | 69 | foreach ($parameters as $parameter) { |
72 | 70 | if (!$parameter instanceof ParameterInterface) { |
73 | 71 | throw new \InvalidArgumentException(sprintf( |