@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function __construct($jsonFile) |
| 25 | 25 | { |
| 26 | - $this->loadServiceList($jsonFile); |
|
| 26 | + $this->loadServiceList($jsonFile); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | private function loadServiceList($jsonFile) |
| 46 | 46 | { |
| 47 | - $services = $this->loadJsonFile($jsonFile); |
|
| 47 | + $services = $this->loadJsonFile($jsonFile); |
|
| 48 | 48 | |
| 49 | - foreach($services->services as $service) { |
|
| 50 | - $this->services[$service->id] = $service; |
|
| 51 | - } |
|
| 49 | + foreach($services->services as $service) { |
|
| 50 | + $this->services[$service->id] = $service; |
|
| 51 | + } |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | private function loadServiceList($jsonFile) |
| 46 | 46 | { |
| 47 | - $services = $this->loadJsonFile($jsonFile); |
|
| 47 | + $services = $this->loadJsonFile($jsonFile); |
|
| 48 | 48 | |
| 49 | - foreach($services->services as $service) { |
|
| 49 | + foreach ($services->services as $service) { |
|
| 50 | 50 | $this->services[$service->id] = $service; |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function create($service) |
| 58 | 58 | { |
| 59 | - if(!isset($this->services[$service])) { |
|
| 59 | + if (!isset($this->services[$service])) { |
|
| 60 | 60 | throw new NotFoundException('Service not found: ' . $service); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -2,11 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Gr8abbasi\Container; |
| 4 | 4 | |
| 5 | -use Interop\Container\ContainerInterface; |
|
| 6 | -use Gr8abbasi\Container\Exception\NotFoundException; |
|
| 7 | 5 | use Gr8abbasi\Container\Exception\ContainerException; |
| 6 | +use Gr8abbasi\Container\Exception\NotFoundException; |
|
| 8 | 7 | use Gr8abbasi\Container\Factory\ConfigFileServiceFactory; |
| 9 | 8 | use Gr8abbasi\Container\Repository\InMemoryServiceRepository; |
| 9 | +use Interop\Container\ContainerInterface; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Container Class |
@@ -76,8 +76,9 @@ |
||
| 76 | 76 | * Create service and add to the |
| 77 | 77 | * repository |
| 78 | 78 | * |
| 79 | - * @param string $name |
|
| 80 | 79 | * |
| 80 | + * @param string $id |
|
| 81 | + * @param Container $container |
|
| 81 | 82 | * @return void |
| 82 | 83 | */ |
| 83 | 84 | private function createService($id, $container) |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | |
| 114 | 114 | if (isset($this->currentServices[$name])) { |
| 115 | 115 | throw new CircularDependencyException( |
| 116 | - 'Circular dependency detected: '. key($this->resolvedServices[$name]) . '=> {$name}' |
|
| 116 | + 'Circular dependency detected: ' . key($this->resolvedServices[$name]) . '=> {$name}' |
|
| 117 | 117 | ); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | { |
| 37 | 37 | $class = new \ReflectionClass($service['class']); |
| 38 | 38 | |
| 39 | - $arguments = isset($service['arguments'])? $service['arguments'] : [] ; |
|
| 39 | + $arguments = isset($service['arguments']) ? $service['arguments'] : []; |
|
| 40 | 40 | |
| 41 | 41 | return $class->newInstanceArgs( |
| 42 | 42 | $this->resolveArguments( |