Completed
Pull Request — master (#15)
by
unknown
02:21
created
src/Service/ObjectManagerService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
      * @throws \Nnx\Doctrine\Service\Exception\InvalidEntityObjectException
89 89
      * @throws \Interop\Container\Exception\NotFoundException
90 90
      */
91
-    public function createEntityObject($entityName, array $options = [])
91
+    public function createEntityObject($entityName, array $options = [ ])
92 92
     {
93 93
         return $this->getEntityManager()->get($entityName, $options);
94 94
     }
Please login to merge, or discard this patch.
src/Utils/EntityMapCache.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @var array
43 43
      */
44
-    protected $cacheKeys = [];
44
+    protected $cacheKeys = [ ];
45 45
 
46 46
     /**
47 47
      * EntityMapCache constructor.
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function saveEntityMap($objectManagerName)
71 71
     {
72
-        $moduleOptions =  $this->getModuleOptions();
72
+        $moduleOptions = $this->getModuleOptions();
73 73
         $originalFlag = $this->getModuleOptions()->getFlagDisableUseEntityMapDoctrineCache();
74 74
         $moduleOptions->setFlagDisableUseEntityMapDoctrineCache(true);
75 75
 
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
     public function getCacheKeyForObjectManagerName($objectManagerName)
145 145
     {
146 146
         if (array_key_exists($objectManagerName, $this->cacheKeys)) {
147
-            return $this->cacheKeys[$objectManagerName];
147
+            return $this->cacheKeys[ $objectManagerName ];
148 148
         }
149 149
 
150 150
         $preffix = $this->getModuleOptions()->getEntityMapDoctrineCachePrefix();
151
-        $key = $preffix . '_' . $objectManagerName;
151
+        $key = $preffix.'_'.$objectManagerName;
152 152
 
153
-        $this->cacheKeys[$objectManagerName] = $key;
153
+        $this->cacheKeys[ $objectManagerName ] = $key;
154 154
 
155
-        return $this->cacheKeys[$objectManagerName];
155
+        return $this->cacheKeys[ $objectManagerName ];
156 156
     }
157 157
 
158 158
     /**
Please login to merge, or discard this patch.
Module.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         return array(
122 122
             'Zend\Loader\StandardAutoloader' => array(
123 123
                 'namespaces' => array(
124
-                    __NAMESPACE__ => __DIR__ . '/src/',
124
+                    __NAMESPACE__ => __DIR__.'/src/',
125 125
                 ),
126 126
             ),
127 127
         );
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function getConfig()
135 135
     {
136
-        return include __DIR__ . '/config/module.config.php';
136
+        return include __DIR__.'/config/module.config.php';
137 137
     }
138 138
 
139 139
     /**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      *
144 144
      * @return string
145 145
      */
146
-    public function getConsoleBanner(Console $console){
146
+    public function getConsoleBanner(Console $console) {
147 147
         return 'Tools for entity map';
148 148
     }
149 149
 
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
      *
155 155
      * @return array
156 156
      */
157
-    public function getConsoleUsage(Console $console){
157
+    public function getConsoleUsage(Console $console) {
158 158
         return [
159 159
             'Entity map builder',
160 160
             'entity-map build --objectManager=' => 'Generation entity maps and cached',
161
-            ['--objectManager=MANAGER_NAME', 'ObjectManager name'],
161
+            [ '--objectManager=MANAGER_NAME', 'ObjectManager name' ],
162 162
             'entity-map clear --objectManager=' => 'Clear entity maps from cached',
163
-            ['--objectManager=MANAGER_NAME', 'ObjectManager name'],
163
+            [ '--objectManager=MANAGER_NAME', 'ObjectManager name' ],
164 164
         ];
165 165
     }
166 166
 } 
167 167
\ No newline at end of file
Please login to merge, or discard this patch.
config/module.config.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         /**
56 56
          * Список EntityManager'ов, для которых никогда не нужно собирать кеш entityMap  в автоматическом режими
57 57
          */
58
-        'excludeEntityManagerForAutoBuildEntityMap' => [],
58
+        'excludeEntityManagerForAutoBuildEntityMap' => [ ],
59 59
 
60 60
 
61 61
         /**
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 ];
78 78
 
79 79
 return array_merge_recursive(
80
-    include __DIR__ . '/moduleOptions.config.php',
81
-    include __DIR__ . '/doctrineObjectManager.config.php',
82
-    include __DIR__ . '/entityManager.config.php',
83
-    include __DIR__ . '/serviceManager.config.php',
84
-    include __DIR__ . '/controllers.config.php',
85
-    include __DIR__ . '/console.config.php',
86
-    include __DIR__ . '/hydrators.config.php',
80
+    include __DIR__.'/moduleOptions.config.php',
81
+    include __DIR__.'/doctrineObjectManager.config.php',
82
+    include __DIR__.'/entityManager.config.php',
83
+    include __DIR__.'/serviceManager.config.php',
84
+    include __DIR__.'/controllers.config.php',
85
+    include __DIR__.'/console.config.php',
86
+    include __DIR__.'/hydrators.config.php',
87 87
 
88 88
     $config
89 89
 );
90 90
\ No newline at end of file
Please login to merge, or discard this patch.
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.