@@ -21,12 +21,12 @@ |
||
| 21 | 21 | { |
| 22 | 22 | $obj = $container->get(__CLASS__); |
| 23 | 23 | |
| 24 | - if ($obj && $obj instanceof static) |
|
| 25 | - return $obj; |
|
| 24 | + if ($obj && $obj instanceof static) { |
|
| 25 | + return $obj; |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | return null; |
| 28 | - } |
|
| 29 | - catch (NotFoundException $e) |
|
| 29 | + } catch (NotFoundException $e) |
|
| 30 | 30 | { |
| 31 | 31 | return null; |
| 32 | 32 | } |
@@ -32,11 +32,13 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function get($id) |
| 34 | 34 | { |
| 35 | - if (!is_string($id)) |
|
| 36 | - throw new ContainerException('Given ID must be a string'); |
|
| 35 | + if (!is_string($id)) { |
|
| 36 | + throw new ContainerException('Given ID must be a string'); |
|
| 37 | + } |
|
| 37 | 38 | |
| 38 | - if (!$this->has($id)) |
|
| 39 | - throw new NotFoundException(); |
|
| 39 | + if (!$this->has($id)) { |
|
| 40 | + throw new NotFoundException(); |
|
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | return $this->storedComponents[$id]; |
| 42 | 44 | } |
@@ -46,8 +48,9 @@ discard block |
||
| 46 | 48 | */ |
| 47 | 49 | public function has($id) |
| 48 | 50 | { |
| 49 | - if (!is_string($id)) |
|
| 50 | - throw new ContainerException('Given ID must be a string'); |
|
| 51 | + if (!is_string($id)) { |
|
| 52 | + throw new ContainerException('Given ID must be a string'); |
|
| 53 | + } |
|
| 51 | 54 | |
| 52 | 55 | return array_key_exists($id, $this->storedComponents); |
| 53 | 56 | } |