Completed
Push — master ( 2795b2...fc7885 )
by Alejandro
23:05
created
src/Factory/AbstractAnnotatedFactory.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 
22 22
     protected function processDependenciesFromAnnotations(ServiceLocatorInterface $container, $serviceName)
23 23
     {
24
-        if (! class_exists($serviceName)) {
24
+        if (!class_exists($serviceName)) {
25 25
             throw new Exception\RuntimeException(sprintf(
26
-                'Annotated factories can only be used with services that are identified by their FQCN. ' .
26
+                'Annotated factories can only be used with services that are identified by their FQCN. '.
27 27
                 'Provided "%s" service name is not a valid class.',
28 28
                 $serviceName
29 29
             ));
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
         $annotationReader = $this->createAnnotationReader($container);
33 33
         $refClass = new \ReflectionClass($serviceName);
34 34
         $constructor = $refClass->getConstructor();
35
-        if (! isset($constructor)) {
35
+        if (!isset($constructor)) {
36 36
             return new $serviceName();
37 37
         }
38 38
 
39 39
         /** @var Inject $inject */
40 40
         $inject = $annotationReader->getMethodAnnotation($constructor, Inject::class);
41
-        if (! isset($inject)) {
41
+        if (!isset($inject)) {
42 42
             throw new Exception\RuntimeException(sprintf(
43 43
                 'You need to use the "%s" annotation in "%s" constructor so that the "%s" can create it.',
44 44
                 Inject::class,
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 
54 54
             // Even when dots are found, try to fetch the service with all the name
55 55
             // If it is not found, the assume dots are used to get part of an array service
56
-            if (count($parts) > 1 && ! $container->has($serviceKey)) {
56
+            if (count($parts) > 1 && !$container->has($serviceKey)) {
57 57
                 $serviceKey = array_shift($parts);
58 58
             } else {
59 59
                 $parts = [];
60 60
             }
61 61
 
62
-            if (! $container->has($serviceKey)) {
62
+            if (!$container->has($serviceKey)) {
63 63
                 throw new Exception\RuntimeException(sprintf(
64 64
                     'Defined injectable service "%s" could not be found in container.',
65 65
                     $serviceKey
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
             return self::$annotationReader;
84 84
         }
85 85
 
86
-        AnnotationRegistry::registerLoader(function ($class) {
87
-            $file = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
88
-            $file = realpath(__DIR__ . '/../Annotation/' . basename($file));
89
-            if (! $file) {
86
+        AnnotationRegistry::registerLoader(function($class) {
87
+            $file = str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
88
+            $file = realpath(__DIR__.'/../Annotation/'.basename($file));
89
+            if (!$file) {
90 90
                 return false;
91 91
             }
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             return true;
95 95
         });
96 96
 
97
-        if (! $container->has(self::CACHE_SERVICE)) {
97
+        if (!$container->has(self::CACHE_SERVICE)) {
98 98
             return self::$annotationReader = new AnnotationReader();
99 99
         } else {
100 100
             /** @var Cache $cache */
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $key = array_shift($keys);
114 114
 
115 115
         // When one of the provided keys is not found, thorw an exception
116
-        if (! isset($array[$key])) {
116
+        if (!isset($array[$key])) {
117 117
             throw new Exception\InvalidArgumentException(sprintf(
118 118
                 'The key "%s" provided in the dotted notation could not be found in the array service',
119 119
                 $key
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         }
122 122
 
123 123
         $value = $array[$key];
124
-        if (! empty($keys) && is_array($value)) {
124
+        if (!empty($keys) && is_array($value)) {
125 125
             $value = $this->readKeysFromArray($keys, $value);
126 126
         }
127 127
 
Please login to merge, or discard this patch.