Completed
Push — master ( 3efb43...6ac6c3 )
by Андрей
05:02
created
src/Options/ManagerRegistryOptions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
      *
21 21
      * @var array
22 22
      */
23
-    protected $connections = [];
23
+    protected $connections = [ ];
24 24
 
25 25
     /**
26 26
      * Имена ObjectManager's которые можно использовать в \Nnx\Doctrine\ManagerRegistry\ManagerRegistry
27 27
      *
28 28
      * @var array
29 29
      */
30
-    protected $objectManagers = [];
30
+    protected $objectManagers = [ ];
31 31
 
32 32
     /**
33 33
      * Имя соеденения по умолчанию
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @return $this
69 69
      */
70
-    public function setConnections(array $connections = [])
70
+    public function setConnections(array $connections = [ ])
71 71
     {
72 72
         $this->connections = $connections;
73 73
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      *
92 92
      * @return $this
93 93
      */
94
-    public function setObjectManagers(array $objectManagers = [])
94
+    public function setObjectManagers(array $objectManagers = [ ])
95 95
     {
96 96
         $this->objectManagers = $objectManagers;
97 97
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function setDefaultConnection($defaultConnection)
119 119
     {
120
-        $this->defaultConnection = (string)$defaultConnection;
120
+        $this->defaultConnection = (string) $defaultConnection;
121 121
 
122 122
         return $this;
123 123
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function setDefaultManager($defaultManager)
143 143
     {
144
-        $this->defaultManager = (string)$defaultManager;
144
+        $this->defaultManager = (string) $defaultManager;
145 145
 
146 146
         return $this;
147 147
     }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function setProxyInterfaceName($proxyInterfaceName)
167 167
     {
168
-        $this->proxyInterfaceName = (string)$proxyInterfaceName;
168
+        $this->proxyInterfaceName = (string) $proxyInterfaceName;
169 169
 
170 170
         return $this;
171 171
     }
Please login to merge, or discard this patch.
src/Options/ModuleOptions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      *
94 94
      * @var array
95 95
      */
96
-    protected $excludeEntityManagerForAutoBuildEntityMap = [];
96
+    protected $excludeEntityManagerForAutoBuildEntityMap = [ ];
97 97
 
98 98
     /**
99 99
      * Флаг позволяет отключить использования кеширования при работе с entityMap
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
      *
322 322
      * @return $this
323 323
      */
324
-    public function setExcludeEntityManagerForAutoBuildEntityMap(array $excludeEntityManagerForAutoBuildEntityMap = [])
324
+    public function setExcludeEntityManagerForAutoBuildEntityMap(array $excludeEntityManagerForAutoBuildEntityMap = [ ])
325 325
     {
326 326
         $this->excludeEntityManagerForAutoBuildEntityMap = $excludeEntityManagerForAutoBuildEntityMap;
327 327
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
      *
370 370
      * @return $this
371 371
      */
372
-    public function setManagerRegistry(array $managerRegistry = [])
372
+    public function setManagerRegistry(array $managerRegistry = [ ])
373 373
     {
374 374
         $this->managerRegistry = new ManagerRegistryOptions($managerRegistry);
375 375
 
Please login to merge, or discard this patch.
src/Listener/ManagerRegistryListener.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
     public function attach(EventManagerInterface $events)
43 43
     {
44 44
         $sharedManager = $events->getSharedManager();
45
-        $sharedManager->attach('DoctrineManagerRegistry', 'get.doctrineManagerRegistry', [$this, 'getDoctrineManagerRegistryHandler']);
45
+        $sharedManager->attach('DoctrineManagerRegistry', 'get.doctrineManagerRegistry', [ $this, 'getDoctrineManagerRegistryHandler' ]);
46 46
     }
47 47
 
48 48
     /**
Please login to merge, or discard this patch.
src/Utils/DoctrineOrmModuleConfig.php 1 patch
Spacing   +41 added lines, -41 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
      * Опции модуля
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param array                  $doctrineConfig
67 67
      * @param ModuleOptionsInterface $moduleOptions
68 68
      */
69
-    public function __construct(array $doctrineConfig = [], ModuleOptionsInterface $moduleOptions)
69
+    public function __construct(array $doctrineConfig = [ ], ModuleOptionsInterface $moduleOptions)
70 70
     {
71 71
         $this->setDoctrineConfig($doctrineConfig);
72 72
         $this->setModuleOptions($moduleOptions);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return $this
92 92
      */
93
-    public function setDoctrineConfig(array $doctrineConfig = [])
93
+    public function setDoctrineConfig(array $doctrineConfig = [ ])
94 94
     {
95 95
         $this->doctrineConfig = $doctrineConfig;
96 96
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
         }
110 110
 
111 111
         if (!$this->isValidDoctrineOrmModuleEntityManagerConfig()) {
112
-            $this->listObjectManagerName = [];
112
+            $this->listObjectManagerName = [ ];
113 113
             return $this->listObjectManagerName;
114 114
         }
115 115
 
116 116
         $doctrineConfig = $this->getDoctrineConfig();
117 117
 
118
-        $listObjectManagerName = array_keys($doctrineConfig['entitymanager']);
119
-        $prepareListObjectManagerName = array_map(function ($objectManagerName) {
120
-            return 'doctrine.entitymanager.' . $objectManagerName;
118
+        $listObjectManagerName = array_keys($doctrineConfig[ 'entitymanager' ]);
119
+        $prepareListObjectManagerName = array_map(function($objectManagerName) {
120
+            return 'doctrine.entitymanager.'.$objectManagerName;
121 121
         }, $listObjectManagerName);
122 122
 
123 123
         $this->listObjectManagerName = array_combine($listObjectManagerName, $prepareListObjectManagerName);
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
         }
139 139
 
140 140
         if (!$this->isValidDoctrineOrmModuleEntityManagerConfig()) {
141
-            $this->listConnectionName = [];
141
+            $this->listConnectionName = [ ];
142 142
             return $this->listConnectionName;
143 143
         }
144 144
 
145 145
         $doctrineConfig = $this->getDoctrineConfig();
146 146
 
147
-        $listConnectionName = array_keys($doctrineConfig['connection']);
148
-        $prepareListConnectionName = array_map(function ($connectionName) {
149
-            return 'doctrine.connection.' . $connectionName;
147
+        $listConnectionName = array_keys($doctrineConfig[ 'connection' ]);
148
+        $prepareListConnectionName = array_map(function($connectionName) {
149
+            return 'doctrine.connection.'.$connectionName;
150 150
         }, $listConnectionName);
151 151
 
152 152
         $this->listConnectionName = array_combine($listConnectionName, $prepareListConnectionName);
@@ -164,16 +164,16 @@  discard block
 block discarded – undo
164 164
     public function hasNamespacesByObjectManager($objectManagerServiceName)
165 165
     {
166 166
         if (array_key_exists($objectManagerServiceName, $this->namespacesByObjectManagerCache)) {
167
-            return false !== $this->namespacesByObjectManagerCache[$objectManagerServiceName];
167
+            return false !== $this->namespacesByObjectManagerCache[ $objectManagerServiceName ];
168 168
         }
169 169
 
170 170
         if (!$this->isValidDoctrineOrmModuleConfig()) {
171
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
171
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
172 172
             return false;
173 173
         }
174 174
 
175 175
         if (0 !== strpos($objectManagerServiceName, static::DOCTRINE_PREFIX)) {
176
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
176
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
177 177
             return false;
178 178
         }
179 179
 
@@ -181,49 +181,49 @@  discard block
 block discarded – undo
181 181
 
182 182
         $doctrineConfig = $this->getDoctrineConfig();
183 183
 
184
-        if (!array_key_exists($objectManagerName, $doctrineConfig['entitymanager'])) {
185
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
184
+        if (!array_key_exists($objectManagerName, $doctrineConfig[ 'entitymanager' ])) {
185
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
186 186
             return false;
187 187
         }
188 188
 
189
-        $omConfig = $doctrineConfig['entitymanager'][$objectManagerName];
189
+        $omConfig = $doctrineConfig[ 'entitymanager' ][ $objectManagerName ];
190 190
 
191
-        if (!is_array($omConfig) || !array_key_exists('configuration', $omConfig) || !is_string($omConfig['configuration'])) {
192
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
191
+        if (!is_array($omConfig) || !array_key_exists('configuration', $omConfig) || !is_string($omConfig[ 'configuration' ])) {
192
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
193 193
             return false;
194 194
         }
195 195
 
196
-        $confName = $omConfig['configuration'];
196
+        $confName = $omConfig[ 'configuration' ];
197 197
 
198
-        if (!array_key_exists($confName, $doctrineConfig['configuration']) || !is_array($doctrineConfig['configuration'][$confName])) {
199
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
198
+        if (!array_key_exists($confName, $doctrineConfig[ 'configuration' ]) || !is_array($doctrineConfig[ 'configuration' ][ $confName ])) {
199
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
200 200
             return false;
201 201
         }
202 202
 
203
-        $omConfiguration = $doctrineConfig['configuration'][$confName];
203
+        $omConfiguration = $doctrineConfig[ 'configuration' ][ $confName ];
204 204
 
205
-        if (!array_key_exists('driver', $omConfiguration) || !is_string($omConfiguration['driver'])) {
206
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
205
+        if (!array_key_exists('driver', $omConfiguration) || !is_string($omConfiguration[ 'driver' ])) {
206
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
207 207
             return false;
208 208
         }
209 209
 
210
-        $driverName = $omConfiguration['driver'];
210
+        $driverName = $omConfiguration[ 'driver' ];
211 211
 
212
-        if (!array_key_exists($driverName, $doctrineConfig['driver']) || !is_array($doctrineConfig['driver'][$driverName])) {
213
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
212
+        if (!array_key_exists($driverName, $doctrineConfig[ 'driver' ]) || !is_array($doctrineConfig[ 'driver' ][ $driverName ])) {
213
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
214 214
             return false;
215 215
         }
216 216
 
217
-        $driverConfig = $doctrineConfig['driver'][$driverName];
217
+        $driverConfig = $doctrineConfig[ 'driver' ][ $driverName ];
218 218
 
219
-        if (!array_key_exists('drivers', $driverConfig) || !is_array($driverConfig['drivers'])) {
220
-            $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false;
219
+        if (!array_key_exists('drivers', $driverConfig) || !is_array($driverConfig[ 'drivers' ])) {
220
+            $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false;
221 221
             return false;
222 222
         }
223 223
 
224
-        $this->namespacesByObjectManagerCache[$objectManagerServiceName] = $this->buildIndexNamespaces($driverConfig['drivers']);
224
+        $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = $this->buildIndexNamespaces($driverConfig[ 'drivers' ]);
225 225
 
226
-        return false !== $this->namespacesByObjectManagerCache[$objectManagerServiceName];
226
+        return false !== $this->namespacesByObjectManagerCache[ $objectManagerServiceName ];
227 227
     }
228 228
 
229 229
     /**
@@ -242,15 +242,15 @@  discard block
 block discarded – undo
242 242
         $moduleOptions = $this->getModuleOptions();
243 243
         $entitySeparator = $moduleOptions->getEntitySeparator();
244 244
 
245
-        $index = [];
245
+        $index = [ ];
246 246
         foreach ($listNamespaces as $currentNamespace) {
247 247
             $prepareNamespace = rtrim($currentNamespace, '\\');
248
-            $normalizeNamespace = $prepareNamespace . '\\';
248
+            $normalizeNamespace = $prepareNamespace.'\\';
249 249
 
250 250
             $normalizeNamespaceStack = explode($entitySeparator, $normalizeNamespace);
251 251
 
252 252
             $namespacePrefix = array_shift($normalizeNamespaceStack);
253
-            $index[$currentNamespace] = $namespacePrefix . $entitySeparator;
253
+            $index[ $currentNamespace ] = $namespacePrefix.$entitySeparator;
254 254
         }
255 255
 
256 256
         return $index;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             throw new Exception\EntityNamespacesNotFoundException($errMsh);
273 273
         }
274 274
 
275
-        return $this->namespacesByObjectManagerCache[$objectManagerServiceName];
275
+        return $this->namespacesByObjectManagerCache[ $objectManagerServiceName ];
276 276
     }
277 277
 
278 278
     /**
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
         $doctrineConfig = $this->getDoctrineConfig();
287 287
 
288 288
         return $this->isValidDoctrineOrmModuleEntityManagerConfig()
289
-               && array_key_exists('configuration', $doctrineConfig) && is_array($doctrineConfig['configuration'])
290
-               && array_key_exists('driver', $doctrineConfig) && is_array($doctrineConfig['driver']);
289
+               && array_key_exists('configuration', $doctrineConfig) && is_array($doctrineConfig[ 'configuration' ])
290
+               && array_key_exists('driver', $doctrineConfig) && is_array($doctrineConfig[ 'driver' ]);
291 291
     }
292 292
 
293 293
     /**
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     {
300 300
         $doctrineConfig = $this->getDoctrineConfig();
301 301
 
302
-        return array_key_exists('entitymanager', $doctrineConfig) && is_array($doctrineConfig['entitymanager']);
302
+        return array_key_exists('entitymanager', $doctrineConfig) && is_array($doctrineConfig[ 'entitymanager' ]);
303 303
     }
304 304
 
305 305
     /**
Please login to merge, or discard this patch.
src/ManagerRegistry/ParamsFromDoctrineModuleListener.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
     public function attach(EventManagerInterface $events)
42 42
     {
43 43
         $sharedManager = $events->getSharedManager();
44
-        $sharedManager->attach(ManagerRegistryFactory::class, ManagerRegistryFactory::EVENT_BUILD_LIST_CONNECTIONS, [$this, 'buildListConnectionsHandler']);
45
-        $sharedManager->attach(ManagerRegistryFactory::class, ManagerRegistryFactory::EVENT_BUILD_LIST_OBJECT_MANAGERS, [$this, 'buildListObjectManagersHandler']);
44
+        $sharedManager->attach(ManagerRegistryFactory::class, ManagerRegistryFactory::EVENT_BUILD_LIST_CONNECTIONS, [ $this, 'buildListConnectionsHandler' ]);
45
+        $sharedManager->attach(ManagerRegistryFactory::class, ManagerRegistryFactory::EVENT_BUILD_LIST_OBJECT_MANAGERS, [ $this, 'buildListObjectManagersHandler' ]);
46 46
     }
47 47
 
48 48
     /**
Please login to merge, or discard this patch.
src/ManagerRegistry/ResolverManagerRegistryResourceListener.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@
 block discarded – undo
54 54
     public function attach(EventManagerInterface $events)
55 55
     {
56 56
         $sharedManager = $events->getSharedManager();
57
-        $sharedManager->attach(ManagerRegistry::class, ManagerRegistryResourceEvent::RESOLVE_CONNECTION_EVENT, [$this, 'resolveConnectionByNameHandler']);
58
-        $sharedManager->attach(ManagerRegistry::class, ManagerRegistryResourceEvent::RESOLVE_OBJECT_MANAGER_EVENT, [$this, 'resolveObjectManagerByNameHandler']);
57
+        $sharedManager->attach(ManagerRegistry::class, ManagerRegistryResourceEvent::RESOLVE_CONNECTION_EVENT, [ $this, 'resolveConnectionByNameHandler' ]);
58
+        $sharedManager->attach(ManagerRegistry::class, ManagerRegistryResourceEvent::RESOLVE_OBJECT_MANAGER_EVENT, [ $this, 'resolveObjectManagerByNameHandler' ]);
59 59
     }
60 60
 
61 61
     /**
Please login to merge, or discard this patch.
src/ManagerRegistry/ManagerRegistry.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @var array
53 53
      */
54
-    protected $objectManagerByName = [];
54
+    protected $objectManagerByName = [ ];
55 55
 
56 56
     /**
57 57
      * Ключем является имя соеденения, а значением объект соеденения к базе данных
58 58
      *
59 59
      * @var array
60 60
      */
61
-    protected $connectionByName = [];
61
+    protected $connectionByName = [ ];
62 62
 
63 63
     /**
64 64
      * Прототип для создания объекта события, бросаемого когда нужно получить ресурс
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     protected function getObjectManagerByName($name)
192 192
     {
193 193
         if (array_key_exists($name, $this->objectManagerByName)) {
194
-            return $this->objectManagerByName[$name];
194
+            return $this->objectManagerByName[ $name ];
195 195
         }
196 196
 
197 197
         $event = clone $this->getManagerRegistryResourceEventPrototype();
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         $event->setTarget($this);
201 201
 
202 202
 
203
-        $resultsEvent = $this->getEventManager()->trigger($event, function ($objectManager) {
203
+        $resultsEvent = $this->getEventManager()->trigger($event, function($objectManager) {
204 204
             return $objectManager instanceof ObjectManager;
205 205
         });
206 206
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
             throw new Exception\ObjectManagerNotFoundException($errMsg);
212 212
         }
213 213
 
214
-        $this->objectManagerByName[$name] = $objectManager;
214
+        $this->objectManagerByName[ $name ] = $objectManager;
215 215
 
216
-        return $this->objectManagerByName[$name];
216
+        return $this->objectManagerByName[ $name ];
217 217
     }
218 218
 
219 219
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     protected function getConnectionByName($name)
229 229
     {
230 230
         if (array_key_exists($name, $this->connectionByName)) {
231
-            return $this->connectionByName[$name];
231
+            return $this->connectionByName[ $name ];
232 232
         }
233 233
 
234 234
         $event = clone $this->getManagerRegistryResourceEventPrototype();
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         $event->setTarget($this);
238 238
 
239 239
 
240
-        $resultsEvent = $this->getEventManager()->trigger($event, function ($connection) {
240
+        $resultsEvent = $this->getEventManager()->trigger($event, function($connection) {
241 241
             return is_object($connection);
242 242
         });
243 243
 
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
             throw new Exception\ConnectionNotFoundException($errMsg);
249 249
         }
250 250
 
251
-        $this->connectionByName[$name] = $connection;
251
+        $this->connectionByName[ $name ] = $connection;
252 252
 
253
-        return $this->connectionByName[$name];
253
+        return $this->connectionByName[ $name ];
254 254
     }
255 255
 
256 256
 
Please login to merge, or discard this patch.
src/ManagerRegistry/ManagerRegistryFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 
57 57
         $buildListConnectionsResult = $this->getEventManager()->trigger(static::EVENT_BUILD_LIST_CONNECTIONS, $this);
58
-        $listConnectionsResult = [];
58
+        $listConnectionsResult = [ ];
59 59
         foreach ($buildListConnectionsResult as $item) {
60 60
             if (is_array($item)) {
61 61
                 $listConnectionsResult = ArrayUtils::merge($listConnectionsResult, $item);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 
67 67
         $buildListObjectManagersResult = $this->getEventManager()->trigger(static::EVENT_BUILD_LIST_OBJECT_MANAGERS, $this);
68
-        $listObjectManagersResult = [];
68
+        $listObjectManagersResult = [ ];
69 69
         foreach ($buildListObjectManagersResult as $item) {
70 70
             if (is_array($item)) {
71 71
                 $listObjectManagersResult = ArrayUtils::merge($listObjectManagersResult, $item);
Please login to merge, or discard this patch.