Completed
Push — dev ( 526cfa...e5ce98 )
by Андрей
03:57
created
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/InvalidArgumentException.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/EntityManager.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   +7 added lines, -7 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 $interfaceNameToEntityClass = [];
31
+    protected $interfaceNameToEntityClass = [ ];
32 32
 
33 33
     /**
34 34
      * EntityManager constructor.
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
     public function getEntityClassByInterface($interfaceName)
73 73
     {
74 74
         if ($this->hasEntityClassByInterface($interfaceName)) {
75
-            $errMsg = sprintf('Error build entity class name for %s', $interfaceName) ;
75
+            $errMsg = sprintf('Error build entity class name for %s', $interfaceName);
76 76
             throw new Exception\ErrorBuildEntityClassNameException($errMsg);
77 77
         }
78 78
 
79
-        return $this->interfaceNameToEntityClass[$interfaceName];
79
+        return $this->interfaceNameToEntityClass[ $interfaceName ];
80 80
     }
81 81
 
82 82
     /**
@@ -93,22 +93,22 @@  discard block
 block discarded – undo
93 93
     public function hasEntityClassByInterface($interfaceName)
94 94
     {
95 95
         if (array_key_exists($interfaceName, $this->interfaceNameToEntityClass)) {
96
-            return false !== $this->interfaceNameToEntityClass[$interfaceName];
96
+            return false !== $this->interfaceNameToEntityClass[ $interfaceName ];
97 97
         }
98 98
 
99 99
         if (!$this->has($interfaceName)) {
100
-            $this->interfaceNameToEntityClass[$interfaceName] = false;
100
+            $this->interfaceNameToEntityClass[ $interfaceName ] = false;
101 101
             return false;
102 102
         }
103 103
 
104 104
         $entity = $this->get($interfaceName);
105 105
 
106 106
         if (!is_object($entity)) {
107
-            $this->interfaceNameToEntityClass[$interfaceName] = false;
107
+            $this->interfaceNameToEntityClass[ $interfaceName ] = false;
108 108
             return false;
109 109
         }
110 110
 
111
-        $this->interfaceNameToEntityClass[$interfaceName] = get_class($entity);
111
+        $this->interfaceNameToEntityClass[ $interfaceName ] = get_class($entity);
112 112
 
113 113
         return true;
114 114
     }
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   +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.
config/module.config.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.