Completed
Push — dev ( 47faa5...5ca5e9 )
by Андрей
03:08
created
src/ObjectManager/ObjectManagerAutoDetector.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @link    https://github.com/nnx-framework/doctrine
4
- * @author  Malofeykin Andrey  <[email protected]>
5
- */
3
+     * @link    https://github.com/nnx-framework/doctrine
4
+     * @author  Malofeykin Andrey  <[email protected]>
5
+     */
6 6
 namespace Nnx\Doctrine;
7 7
 
8 8
 use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
Please login to merge, or discard this 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/ObjectManager/OrmAbstractFactory.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @link    https://github.com/nnx-framework/doctrine
4
- * @author  Malofeykin Andrey  <[email protected]>
5
- */
3
+     * @link    https://github.com/nnx-framework/doctrine
4
+     * @author  Malofeykin Andrey  <[email protected]>
5
+     */
6 6
 namespace Nnx\Doctrine;
7 7
 
8 8
 use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
Please login to merge, or discard this patch.
src/Exception/ExceptionInterface.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @link    https://github.com/nnx-framework/doctrine
4
- * @author  Malofeykin Andrey  <[email protected]>
5
- */
3
+     * @link    https://github.com/nnx-framework/doctrine
4
+     * @author  Malofeykin Andrey  <[email protected]>
5
+     */
6 6
 namespace Nnx\Doctrine;
7 7
 
8 8
 use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
Please login to merge, or discard this patch.
src/Exception/DomainException.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @link    https://github.com/nnx-framework/doctrine
4
- * @author  Malofeykin Andrey  <[email protected]>
5
- */
3
+     * @link    https://github.com/nnx-framework/doctrine
4
+     * @author  Malofeykin Andrey  <[email protected]>
5
+     */
6 6
 namespace Nnx\Doctrine;
7 7
 
8 8
 use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
Please login to merge, or discard this patch.
src/EntityManager/EntityManagerProviderInterface.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @link    https://github.com/nnx-framework/doctrine
4
- * @author  Malofeykin Andrey  <[email protected]>
5
- */
3
+     * @link    https://github.com/nnx-framework/doctrine
4
+     * @author  Malofeykin Andrey  <[email protected]>
5
+     */
6 6
 namespace Nnx\Doctrine;
7 7
 
8 8
 use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
Please login to merge, or discard this patch.
src/EntityManager/OrmEntityLocator.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @link    https://github.com/nnx-framework/doctrine
4
- * @author  Malofeykin Andrey  <[email protected]>
5
- */
3
+     * @link    https://github.com/nnx-framework/doctrine
4
+     * @author  Malofeykin Andrey  <[email protected]>
5
+     */
6 6
 namespace Nnx\Doctrine;
7 7
 
8 8
 use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
Please login to merge, or discard this patch.
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/EntityManager/OrmEntityLocatorInterface.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @link    https://github.com/nnx-framework/doctrine
4
- * @author  Malofeykin Andrey  <[email protected]>
5
- */
3
+     * @link    https://github.com/nnx-framework/doctrine
4
+     * @author  Malofeykin Andrey  <[email protected]>
5
+     */
6 6
 namespace Nnx\Doctrine;
7 7
 
8 8
 use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
Please login to merge, or discard this patch.
src/EntityManager/Exception/ExceptionInterface.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @link    https://github.com/nnx-framework/doctrine
4
- * @author  Malofeykin Andrey  <[email protected]>
5
- */
3
+     * @link    https://github.com/nnx-framework/doctrine
4
+     * @author  Malofeykin Andrey  <[email protected]>
5
+     */
6 6
 namespace Nnx\Doctrine;
7 7
 
8 8
 use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
Please login to merge, or discard this patch.
src/EntityManager/OrmEntityAbstractFactory.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @link    https://github.com/nnx-framework/doctrine
4
- * @author  Malofeykin Andrey  <[email protected]>
5
- */
3
+     * @link    https://github.com/nnx-framework/doctrine
4
+     * @author  Malofeykin Andrey  <[email protected]>
5
+     */
6 6
 namespace Nnx\Doctrine;
7 7
 
8 8
 use Nnx\Doctrine\ObjectManager\DoctrineObjectManager;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 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;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
         $hasOrmEntity = $ormEntityLocator->has($requestedName);
54 54
         if (false === $hasOrmEntity) {
55
-            $this->prototype[$requestedName] = false;
55
+            $this->prototype[ $requestedName ] = false;
56 56
         }
57 57
 
58 58
         return $hasOrmEntity;
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
     public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
76 76
     {
77 77
         if (array_key_exists($requestedName, $this->prototype)) {
78
-            if (!is_object($this->prototype[$requestedName])) {
78
+            if (!is_object($this->prototype[ $requestedName ])) {
79 79
                 $errMsg = sprintf('Invalid prototype for %s', $requestedName);
80 80
                 throw new Exception\RuntimeException($errMsg);
81 81
             }
82
-            return clone $this->prototype[$requestedName];
82
+            return clone $this->prototype[ $requestedName ];
83 83
         }
84 84
 
85 85
         $appServiceLocator = $serviceLocator;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             $r = new ReflectionClass($entityClassName);
99 99
             $entity = $r->newInstance();
100 100
         }
101
-        $this->prototype[$requestedName] = $entity;
101
+        $this->prototype[ $requestedName ] = $entity;
102 102
 
103 103
 
104 104
         return $entity;
Please login to merge, or discard this patch.