Completed
Push — dev ( 070006...d86ef5 )
by Андрей
02:18
created
src/EntityManager/OrmEntityLocator.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      * @param array  $namespacesIndex
139 139
      * @param string $entityInterface
140 140
      *
141
-     * @return bool|string
141
+     * @return string|false
142 142
      */
143 143
     public function resolveEntityClassName($entityPostfix, array $namespacesIndex = [], $entityInterface)
144 144
     {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      *
181 181
      * @param $entityInterfaceName
182 182
      *
183
-     * @return string|bool
183
+     * @return false|string
184 184
      */
185 185
     public function buildEntityPostfixByInterfaceName($entityInterfaceName)
186 186
     {
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     /**
231 231
      * Получение постфикса имени сущности, на основе имени интерфейса
232 232
      *
233
-     * @param $entityInterfaceName
233
+     * @param string $entityInterfaceName
234 234
      *
235 235
      * @return string
236 236
      *
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * @var array
24 24
      */
25
-    protected $entityClassNameCache = [];
25
+    protected $entityClassNameCache = [ ];
26 26
 
27 27
     /**
28 28
      * @var ObjectManagerAutoDetectorInterface
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var array
50 50
      */
51
-    protected $interfaceNameToEntityPostfix = [];
51
+    protected $interfaceNameToEntityPostfix = [ ];
52 52
 
53 53
     /**
54 54
      * OrmEntityLocator constructor.
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             throw new Exception\ErrorBuildEntityClassNameException($errMsg);
86 86
         }
87 87
 
88
-        return $this->entityClassNameCache[$id];
88
+        return $this->entityClassNameCache[ $id ];
89 89
     }
90 90
 
91 91
     /**
@@ -100,35 +100,35 @@  discard block
 block discarded – undo
100 100
     public function has($id)
101 101
     {
102 102
         if (array_key_exists($id, $this->entityClassNameCache)) {
103
-            return false !== $this->entityClassNameCache[$id];
103
+            return false !== $this->entityClassNameCache[ $id ];
104 104
         }
105 105
 
106 106
         $objectManagerAutoDetector = $this->getObjectManagerAutoDetector();
107 107
         if (!$objectManagerAutoDetector->hasObjectManagerNameByClassName($id)) {
108
-            $this->entityClassNameCache[$id] = false;
108
+            $this->entityClassNameCache[ $id ] = false;
109 109
             return false;
110 110
         }
111 111
         $objectManagerName = $objectManagerAutoDetector->getObjectManagerNameByClassName($id);
112 112
 
113 113
         $doctrineOrmModuleConfig = $this->getDoctrineOrmModuleConfig();
114 114
         if (!$doctrineOrmModuleConfig->hasNamespacesByObjectManager($objectManagerName)) {
115
-            $this->entityClassNameCache[$id] = false;
115
+            $this->entityClassNameCache[ $id ] = false;
116 116
             return false;
117 117
         }
118 118
 
119 119
         $namespacesIndex = $doctrineOrmModuleConfig->getNamespacesIndexByObjectManagerName($objectManagerName);
120 120
 
121 121
         if (false === $this->hasEntityPostfixByInterfaceName($id)) {
122
-            $this->entityClassNameCache[$id] = false;
122
+            $this->entityClassNameCache[ $id ] = false;
123 123
             return false;
124 124
         }
125 125
         $entityPostfix = $this->getEntityPostfixByInterfaceName($id);
126 126
 
127 127
         $entityClassName = $this->resolveEntityClassName($entityPostfix, $namespacesIndex, $id);
128 128
 
129
-        $this->entityClassNameCache[$id] = $entityClassName;
129
+        $this->entityClassNameCache[ $id ] = $entityClassName;
130 130
 
131
-        return false !== $this->entityClassNameCache[$id];
131
+        return false !== $this->entityClassNameCache[ $id ];
132 132
     }
133 133
 
134 134
     /**
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      *
141 141
      * @return bool|string
142 142
      */
143
-    public function resolveEntityClassName($entityPostfix, array $namespacesIndex = [], $entityInterface)
143
+    public function resolveEntityClassName($entityPostfix, array $namespacesIndex = [ ], $entityInterface)
144 144
     {
145 145
         $entityClassName = false;
146 146
         foreach ($namespacesIndex as $rootNamespace) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         if (!array_key_exists($entityInterfaceName, $this->interfaceNameToEntityPostfix)) {
170 170
             $has = false !== $this->buildEntityPostfixByInterfaceName($entityInterfaceName);
171 171
         } else {
172
-            $has = false !== $this->interfaceNameToEntityPostfix[$entityInterfaceName];
172
+            $has = false !== $this->interfaceNameToEntityPostfix[ $entityInterfaceName ];
173 173
         }
174 174
 
175 175
         return $has;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $stackEntityInterfaceName = explode($delimiter, $entityInterfaceName);
192 192
 
193 193
         if (2 !== count($stackEntityInterfaceName)) {
194
-            $this->interfaceNameToEntityPostfix[$entityInterfaceName] = false;
194
+            $this->interfaceNameToEntityPostfix[ $entityInterfaceName ] = false;
195 195
             return false;
196 196
         }
197 197
 
@@ -203,27 +203,27 @@  discard block
 block discarded – undo
203 203
 
204 204
         $entityBodyNamePattern = $moduleOptions->getEntityBodyNamePattern();
205 205
 
206
-        $entityBodyNameOutput = [];
206
+        $entityBodyNameOutput = [ ];
207 207
         preg_match($entityBodyNamePattern, $interfaceName, $entityBodyNameOutput);
208 208
 
209 209
         if (2 !== count($entityBodyNameOutput)) {
210
-            $this->interfaceNameToEntityPostfix[$entityInterfaceName] = false;
210
+            $this->interfaceNameToEntityPostfix[ $entityInterfaceName ] = false;
211 211
             return false;
212 212
         }
213
-        $entityBodyName =  array_pop($entityBodyNameOutput);
213
+        $entityBodyName = array_pop($entityBodyNameOutput);
214 214
 
215 215
         $prefix = $moduleOptions->getEntityNamePrefix();
216 216
         $postfix = $moduleOptions->getEntityNamePostfix();
217 217
 
218 218
         $entityName = $prefix . $entityBodyName . $postfix;
219 219
 
220
-        $stackPostfixEntityInterfaceName[] = $entityName;
220
+        $stackPostfixEntityInterfaceName[ ] = $entityName;
221 221
 
222 222
         $entityPostfix = implode('\\', $stackPostfixEntityInterfaceName);
223 223
 
224
-        $this->interfaceNameToEntityPostfix[$entityInterfaceName] = $entityPostfix;
224
+        $this->interfaceNameToEntityPostfix[ $entityInterfaceName ] = $entityPostfix;
225 225
 
226
-        return $this->interfaceNameToEntityPostfix[$entityInterfaceName];
226
+        return $this->interfaceNameToEntityPostfix[ $entityInterfaceName ];
227 227
     }
228 228
 
229 229
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             throw new Exception\ErrorBuildEntityPostfixException($errMsg);
244 244
         }
245 245
 
246
-        return $this->interfaceNameToEntityPostfix[$entityInterfaceName];
246
+        return $this->interfaceNameToEntityPostfix[ $entityInterfaceName ];
247 247
     }
248 248
 
249 249
     /**
Please login to merge, or discard this patch.
src/ObjectManager/ObjectManagerAutoDetector.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @var array
28 28
      */
29
-    protected $classNameToObjectManagerName = [];
29
+    protected $classNameToObjectManagerName = [ ];
30 30
 
31 31
     /**
32 32
      * ObjectManagerAutoDetector constructor.
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             throw new Exception\ErrorBuildObjectManagerNameException($errMsg);
55 55
         }
56 56
 
57
-        return $this->classNameToObjectManagerName[$className];
57
+        return $this->classNameToObjectManagerName[ $className ];
58 58
     }
59 59
 
60 60
 
@@ -69,31 +69,31 @@  discard block
 block discarded – undo
69 69
     public function hasObjectManagerNameByClassName($className)
70 70
     {
71 71
         if (array_key_exists($className, $this->classNameToObjectManagerName)) {
72
-            return false !== $this->classNameToObjectManagerName[$className];
72
+            return false !== $this->classNameToObjectManagerName[ $className ];
73 73
         }
74 74
 
75
-        $moduleOptionsManager =  $this->getModuleOptionsManager();
75
+        $moduleOptionsManager = $this->getModuleOptionsManager();
76 76
         if (!$moduleOptionsManager->hasOptionsByClassName($className)) {
77
-            $this->classNameToObjectManagerName[$className] = false;
77
+            $this->classNameToObjectManagerName[ $className ] = false;
78 78
             return false;
79 79
         }
80 80
 
81 81
         $moduleOptions = $moduleOptionsManager->getOptionsByClassName($className);
82 82
 
83 83
         if (!$moduleOptions instanceof ObjectManagerNameProviderInterface) {
84
-            $this->classNameToObjectManagerName[$className] = false;
84
+            $this->classNameToObjectManagerName[ $className ] = false;
85 85
             return false;
86 86
         }
87 87
 
88 88
         $objectManagerName = $moduleOptions->getObjectManagerName();
89 89
 
90 90
         if (!is_string($objectManagerName)) {
91
-            $this->classNameToObjectManagerName[$className] = false;
91
+            $this->classNameToObjectManagerName[ $className ] = false;
92 92
             return false;
93 93
         }
94
-        $this->classNameToObjectManagerName[$className] = $objectManagerName;
94
+        $this->classNameToObjectManagerName[ $className ] = $objectManagerName;
95 95
 
96
-        return false !== $this->classNameToObjectManagerName[$className];
96
+        return false !== $this->classNameToObjectManagerName[ $className ];
97 97
     }
98 98
 
99 99
 
Please login to merge, or discard this patch.
src/Utils/DoctrineOrmModuleConfig.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @var array
30 30
      */
31
-    protected $doctrineConfig = [];
31
+    protected $doctrineConfig = [ ];
32 32
 
33 33
     /**
34 34
      * Ключем является имя ObjectManager'a значением либо массив содержащий имена неймспейсов в которых расположены
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @var array
39 39
      */
40
-    protected $namespacesByObjectManagerCache = [];
40
+    protected $namespacesByObjectManagerCache = [ ];
41 41
 
42 42
     /**
43 43
      * Опции модуля
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @param array                  $doctrineConfig
53 53
      * @param ModuleOptionsInterface $moduleOptions
54 54
      */
55
-    public function __construct(array $doctrineConfig = [], ModuleOptionsInterface $moduleOptions)
55
+    public function __construct(array $doctrineConfig = [ ], ModuleOptionsInterface $moduleOptions)
56 56
     {
57 57
         $this->setDoctrineConfig($doctrineConfig);
58 58
         $this->setModuleOptions($moduleOptions);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      *
77 77
      * @return $this
78 78
      */
79
-    public function setDoctrineConfig(array $doctrineConfig = [])
79
+    public function setDoctrineConfig(array $doctrineConfig = [ ])
80 80
     {
81 81
         $this->doctrineConfig = $doctrineConfig;
82 82
 
@@ -93,16 +93,16 @@  discard block
 block discarded – undo
93 93
     public function hasNamespacesByObjectManager($objectManagerServiceName)
94 94
     {
95 95
         if (array_key_exists($objectManagerServiceName, $this->namespacesByObjectManagerCache)) {
96
-            return false !== $this->namespacesByObjectManagerCache[$objectManagerServiceName];
96
+            return false !== $this->namespacesByObjectManagerCache[ $objectManagerServiceName ];
97 97
         }
98 98
 
99 99
         if (!$this->isValidDoctrineOrmModuleConfig()) {
100
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
100
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
101 101
             return false;
102 102
         }
103 103
 
104 104
         if (0 !== strpos($objectManagerServiceName, static::DOCTRINE_PREFIX)) {
105
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
105
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
106 106
             return false;
107 107
         }
108 108
 
@@ -110,49 +110,49 @@  discard block
 block discarded – undo
110 110
 
111 111
         $doctrineConfig = $this->getDoctrineConfig();
112 112
 
113
-        if (!array_key_exists($objectManagerName, $doctrineConfig['entitymanager'])) {
114
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
113
+        if (!array_key_exists($objectManagerName, $doctrineConfig[ 'entitymanager' ])) {
114
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
115 115
             return false;
116 116
         }
117 117
 
118
-        $omConfig = $doctrineConfig['entitymanager'][$objectManagerName];
118
+        $omConfig = $doctrineConfig[ 'entitymanager' ][ $objectManagerName ];
119 119
 
120
-        if (!is_array($omConfig) || !array_key_exists('configuration', $omConfig) || !is_string($omConfig['configuration'])) {
121
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
120
+        if (!is_array($omConfig) || !array_key_exists('configuration', $omConfig) || !is_string($omConfig[ 'configuration' ])) {
121
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
122 122
             return false;
123 123
         }
124 124
 
125
-        $confName = $omConfig['configuration'];
125
+        $confName = $omConfig[ 'configuration' ];
126 126
 
127
-        if (!array_key_exists($confName, $doctrineConfig['configuration']) || !is_array($doctrineConfig['configuration'][$confName])) {
128
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
127
+        if (!array_key_exists($confName, $doctrineConfig[ 'configuration' ]) || !is_array($doctrineConfig[ 'configuration' ][ $confName ])) {
128
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
129 129
             return false;
130 130
         }
131 131
 
132
-        $omConfiguration = $doctrineConfig['configuration'][$confName];
132
+        $omConfiguration = $doctrineConfig[ 'configuration' ][ $confName ];
133 133
 
134
-        if (!array_key_exists('driver', $omConfiguration) || !is_string($omConfiguration['driver'])) {
135
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
134
+        if (!array_key_exists('driver', $omConfiguration) || !is_string($omConfiguration[ 'driver' ])) {
135
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
136 136
             return false;
137 137
         }
138 138
 
139
-        $driverName = $omConfiguration['driver'];
139
+        $driverName = $omConfiguration[ 'driver' ];
140 140
 
141
-        if (!array_key_exists($driverName, $doctrineConfig['driver']) || !is_array($doctrineConfig['driver'][$driverName])) {
142
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
141
+        if (!array_key_exists($driverName, $doctrineConfig[ 'driver' ]) || !is_array($doctrineConfig[ 'driver' ][ $driverName ])) {
142
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
143 143
             return false;
144 144
         }
145 145
 
146
-        $driverConfig = $doctrineConfig['driver'][$driverName];
146
+        $driverConfig = $doctrineConfig[ 'driver' ][ $driverName ];
147 147
 
148
-        if (!array_key_exists('drivers', $driverConfig) || !is_array($driverConfig['drivers'])) {
149
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
148
+        if (!array_key_exists('drivers', $driverConfig) || !is_array($driverConfig[ 'drivers' ])) {
149
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
150 150
             return false;
151 151
         }
152 152
 
153
-        $this->namespacesByObjectManagerCache[$objectManagerServiceName] = $this->buildIndexNamespaces($driverConfig['drivers']);
153
+        $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = $this->buildIndexNamespaces($driverConfig[ 'drivers' ]);
154 154
 
155
-        return false !== $this->namespacesByObjectManagerCache[$objectManagerServiceName];
155
+        return false !== $this->namespacesByObjectManagerCache[ $objectManagerServiceName ];
156 156
     }
157 157
 
158 158
     /**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $moduleOptions = $this->getModuleOptions();
172 172
         $entitySeparator = $moduleOptions->getEntitySeparator();
173 173
 
174
-        $index = [];
174
+        $index = [ ];
175 175
         foreach ($listNamespaces as $currentNamespace) {
176 176
             $prepareNamespace = rtrim($currentNamespace, '\\');
177 177
             $normalizeNamespace = $prepareNamespace . '\\';
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             $normalizeNamespaceStack = explode($entitySeparator, $normalizeNamespace);
180 180
 
181 181
             $namespacePrefix = array_shift($normalizeNamespaceStack);
182
-            $index[$currentNamespace] = $namespacePrefix . $entitySeparator;
182
+            $index[ $currentNamespace ] = $namespacePrefix . $entitySeparator;
183 183
         }
184 184
 
185 185
         return $index;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             throw new Exception\EntityNamespacesNotFoundException($errMsh);
202 202
         }
203 203
 
204
-        return $this->namespacesByObjectManagerCache[$objectManagerServiceName];
204
+        return $this->namespacesByObjectManagerCache[ $objectManagerServiceName ];
205 205
     }
206 206
 
207 207
     /**
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
     {
215 215
         $doctrineConfig = $this->getDoctrineConfig();
216 216
 
217
-        return array_key_exists('entitymanager', $doctrineConfig) && is_array($doctrineConfig['entitymanager'])
218
-               && array_key_exists('configuration', $doctrineConfig) && is_array($doctrineConfig['configuration'])
219
-               && array_key_exists('driver', $doctrineConfig) && is_array($doctrineConfig['driver']);
217
+        return array_key_exists('entitymanager', $doctrineConfig) && is_array($doctrineConfig[ 'entitymanager' ])
218
+               && array_key_exists('configuration', $doctrineConfig) && is_array($doctrineConfig[ 'configuration' ])
219
+               && array_key_exists('driver', $doctrineConfig) && is_array($doctrineConfig[ 'driver' ]);
220 220
     }
221 221
 
222 222
     /**
Please login to merge, or discard this patch.
src/Utils/DoctrineOrmModuleConfigFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     {
31 31
         /** @var array  $appConfig */
32 32
         $appConfig = $serviceLocator->get('config');
33
-        $doctrineConfig = array_key_exists('doctrine', $appConfig) ? $appConfig['doctrine'] : [];
33
+        $doctrineConfig = array_key_exists('doctrine', $appConfig) ? $appConfig[ 'doctrine' ] : [ ];
34 34
 
35 35
         /** @var ModuleOptionsPluginManagerInterface $moduleOptionsManager */
36 36
         $moduleOptionsManager = $serviceLocator->get(ModuleOptionsPluginManagerInterface::class);
Please login to merge, or discard this patch.
src/EntityManager/OrmEntityAbstractFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @var array
25 25
      */
26
-    protected $prototype = [];
26
+    protected $prototype = [ ];
27 27
 
28 28
     /**
29 29
      * @inheritdoc
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
40 40
     {
41 41
         if (array_key_exists($requestedName, $this->prototype)) {
42
-            return false !== $this->prototype[$requestedName];
42
+            return false !== $this->prototype[ $requestedName ];
43 43
         }
44 44
 
45 45
         $appServiceLocator = $serviceLocator;
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
     public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
71 71
     {
72 72
         if (array_key_exists($requestedName, $this->prototype)) {
73
-            if (!is_object($this->prototype[$requestedName])) {
73
+            if (!is_object($this->prototype[ $requestedName ])) {
74 74
                 $errMsg = sprintf('Invalid prototype for %s', $requestedName);
75 75
                 throw new Exception\RuntimeException($errMsg);
76 76
             }
77
-            return clone $this->prototype[$requestedName];
77
+            return clone $this->prototype[ $requestedName ];
78 78
         }
79 79
 
80 80
         $appServiceLocator = $serviceLocator;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             $r = new ReflectionClass($entityClassName);
94 94
             $entity = $r->newInstance();
95 95
         }
96
-        $this->prototype[$requestedName] = $entity;
96
+        $this->prototype[ $requestedName ] = $entity;
97 97
 
98 98
 
99 99
         return $entity;
Please login to merge, or discard this patch.