@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | /** @var array $appConfig */ |
| 33 | 33 | $appConfig = $appServiceLocator->get('config'); |
| 34 | - $moduleConfig = array_key_exists(Module::CONFIG_KEY, $appConfig) ? $appConfig[Module::CONFIG_KEY] : []; |
|
| 34 | + $moduleConfig = array_key_exists(Module::CONFIG_KEY, $appConfig) ? $appConfig[ Module::CONFIG_KEY ] : [ ]; |
|
| 35 | 35 | |
| 36 | 36 | return new ModuleOptions($moduleConfig); |
| 37 | 37 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -30,7 +30,7 @@ |
||
| 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); |
@@ -22,7 +22,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @var array |
| 43 | 43 | */ |
| 44 | - protected $cacheKeys = []; |
|
| 44 | + protected $cacheKeys = [ ]; |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * EntityMapCache constructor. |
@@ -124,15 +124,15 @@ discard block |
||
| 124 | 124 | public function getCacheKeyForObjectManagerName($objectManagerName) |
| 125 | 125 | { |
| 126 | 126 | if (array_key_exists($objectManagerName, $this->cacheKeys)) { |
| 127 | - return $this->cacheKeys[$objectManagerName]; |
|
| 127 | + return $this->cacheKeys[ $objectManagerName ]; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $preffix = $this->getModuleOptions()->getEntityMapDoctrineCachePrefix(); |
| 131 | 131 | $key = $preffix . '_' . $objectManagerName; |
| 132 | 132 | |
| 133 | - $this->cacheKeys[$objectManagerName] = $key; |
|
| 133 | + $this->cacheKeys[ $objectManagerName ] = $key; |
|
| 134 | 134 | |
| 135 | - return $this->cacheKeys[$objectManagerName]; |
|
| 135 | + return $this->cacheKeys[ $objectManagerName ]; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $listEntityInterfaces = $this->buildListEntityInterfaces($entityClassNames); |
| 79 | 79 | |
| 80 | - $map = []; |
|
| 80 | + $map = [ ]; |
|
| 81 | 81 | |
| 82 | 82 | $entityManager = $this->getEntityManager(); |
| 83 | 83 | foreach ($listEntityInterfaces as $currentInterface) { |
| 84 | 84 | if ($entityManager->hasEntityClassByInterface($currentInterface)) { |
| 85 | - $map[$currentInterface] = $entityManager->getEntityClassByInterface($currentInterface); |
|
| 85 | + $map[ $currentInterface ] = $entityManager->getEntityClassByInterface($currentInterface); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @return array |
| 98 | 98 | */ |
| 99 | - public function buildListEntityInterfaces(array $entityClassNames = []) |
|
| 99 | + public function buildListEntityInterfaces(array $entityClassNames = [ ]) |
|
| 100 | 100 | { |
| 101 | - $listEntityInterfaces = []; |
|
| 101 | + $listEntityInterfaces = [ ]; |
|
| 102 | 102 | |
| 103 | 103 | $moduleOptionsManager = $this->getModuleOptionsPluginManager(); |
| 104 | 104 | $allowedModules = $this->getAllowedModules($entityClassNames); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if ($moduleOptionsManager->hasModuleNameByClassName($currentInterface)) { |
| 111 | 111 | $moduleNameByInterface = $moduleOptionsManager->getModuleNameByClassName($currentInterface); |
| 112 | 112 | if (array_key_exists($moduleNameByInterface, $allowedModules)) { |
| 113 | - $listEntityInterfaces[$currentInterface] = $currentInterface; |
|
| 113 | + $listEntityInterfaces[ $currentInterface ] = $currentInterface; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @return array |
| 128 | 128 | */ |
| 129 | - public function getAllowedModules(array $entityClassNames = []) |
|
| 129 | + public function getAllowedModules(array $entityClassNames = [ ]) |
|
| 130 | 130 | { |
| 131 | 131 | $moduleOptionsManager = $this->getModuleOptionsPluginManager(); |
| 132 | - $allowedModules = []; |
|
| 132 | + $allowedModules = [ ]; |
|
| 133 | 133 | foreach ($entityClassNames as $entityClassName) { |
| 134 | 134 | if ($moduleOptionsManager->hasModuleNameByClassName($entityClassName)) { |
| 135 | 135 | $moduleName = $moduleOptionsManager->getModuleNameByClassName($entityClassName); |
| 136 | - $allowedModules[$moduleName] = $moduleName; |
|
| 136 | + $allowedModules[ $moduleName ] = $moduleName; |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $allMetadata = $objectManager->getMetadataFactory()->getAllMetadata(); |
| 159 | 159 | |
| 160 | - $entityClassNames = []; |
|
| 160 | + $entityClassNames = [ ]; |
|
| 161 | 161 | foreach ($allMetadata as $classMetadata) { |
| 162 | 162 | if ($classMetadata instanceof ClassMetadata) { |
| 163 | 163 | $entityClassName = $classMetadata->getName(); |
| 164 | - $entityClassNames[$entityClassName] = $entityClassName; |
|
| 164 | + $entityClassNames[ $entityClassName ] = $entityClassName; |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
@@ -28,7 +28,7 @@ discard block |
||
| 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 |
||
| 37 | 37 | * |
| 38 | 38 | * @var array |
| 39 | 39 | */ |
| 40 | - protected $namespacesByObjectManagerCache = []; |
|
| 40 | + protected $namespacesByObjectManagerCache = [ ]; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Опции модуля |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param array $doctrineConfig |
| 60 | 60 | * @param ModuleOptionsInterface $moduleOptions |
| 61 | 61 | */ |
| 62 | - public function __construct(array $doctrineConfig = [], ModuleOptionsInterface $moduleOptions) |
|
| 62 | + public function __construct(array $doctrineConfig = [ ], ModuleOptionsInterface $moduleOptions) |
|
| 63 | 63 | { |
| 64 | 64 | $this->setDoctrineConfig($doctrineConfig); |
| 65 | 65 | $this->setModuleOptions($moduleOptions); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return $this |
| 85 | 85 | */ |
| 86 | - public function setDoctrineConfig(array $doctrineConfig = []) |
|
| 86 | + public function setDoctrineConfig(array $doctrineConfig = [ ]) |
|
| 87 | 87 | { |
| 88 | 88 | $this->doctrineConfig = $doctrineConfig; |
| 89 | 89 | |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if (!$this->isValidDoctrineOrmModuleEntityManagerConfig()) { |
| 105 | - $this->listObjectManagerName = []; |
|
| 105 | + $this->listObjectManagerName = [ ]; |
|
| 106 | 106 | return $this->listObjectManagerName; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | $doctrineConfig = $this->getDoctrineConfig(); |
| 110 | 110 | |
| 111 | - $listObjectManagerName = array_keys($doctrineConfig['entitymanager']); |
|
| 112 | - $prepareListObjectManagerName = array_map(function ($objectManagerName) { |
|
| 111 | + $listObjectManagerName = array_keys($doctrineConfig[ 'entitymanager' ]); |
|
| 112 | + $prepareListObjectManagerName = array_map(function($objectManagerName) { |
|
| 113 | 113 | return 'doctrine.entitymanager.' . $objectManagerName; |
| 114 | 114 | }, $listObjectManagerName); |
| 115 | 115 | |
@@ -128,16 +128,16 @@ discard block |
||
| 128 | 128 | public function hasNamespacesByObjectManager($objectManagerServiceName) |
| 129 | 129 | { |
| 130 | 130 | if (array_key_exists($objectManagerServiceName, $this->namespacesByObjectManagerCache)) { |
| 131 | - return false !== $this->namespacesByObjectManagerCache[$objectManagerServiceName]; |
|
| 131 | + return false !== $this->namespacesByObjectManagerCache[ $objectManagerServiceName ]; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (!$this->isValidDoctrineOrmModuleConfig()) { |
| 135 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
| 135 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (0 !== strpos($objectManagerServiceName, static::DOCTRINE_PREFIX)) { |
| 140 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
| 140 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
| 141 | 141 | return false; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -145,49 +145,49 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $doctrineConfig = $this->getDoctrineConfig(); |
| 147 | 147 | |
| 148 | - if (!array_key_exists($objectManagerName, $doctrineConfig['entitymanager'])) { |
|
| 149 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
| 148 | + if (!array_key_exists($objectManagerName, $doctrineConfig[ 'entitymanager' ])) { |
|
| 149 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
| 150 | 150 | return false; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $omConfig = $doctrineConfig['entitymanager'][$objectManagerName]; |
|
| 153 | + $omConfig = $doctrineConfig[ 'entitymanager' ][ $objectManagerName ]; |
|
| 154 | 154 | |
| 155 | - if (!is_array($omConfig) || !array_key_exists('configuration', $omConfig) || !is_string($omConfig['configuration'])) { |
|
| 156 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
| 155 | + if (!is_array($omConfig) || !array_key_exists('configuration', $omConfig) || !is_string($omConfig[ 'configuration' ])) { |
|
| 156 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $confName = $omConfig['configuration']; |
|
| 160 | + $confName = $omConfig[ 'configuration' ]; |
|
| 161 | 161 | |
| 162 | - if (!array_key_exists($confName, $doctrineConfig['configuration']) || !is_array($doctrineConfig['configuration'][$confName])) { |
|
| 163 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
| 162 | + if (!array_key_exists($confName, $doctrineConfig[ 'configuration' ]) || !is_array($doctrineConfig[ 'configuration' ][ $confName ])) { |
|
| 163 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
| 164 | 164 | return false; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $omConfiguration = $doctrineConfig['configuration'][$confName]; |
|
| 167 | + $omConfiguration = $doctrineConfig[ 'configuration' ][ $confName ]; |
|
| 168 | 168 | |
| 169 | - if (!array_key_exists('driver', $omConfiguration) || !is_string($omConfiguration['driver'])) { |
|
| 170 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
| 169 | + if (!array_key_exists('driver', $omConfiguration) || !is_string($omConfiguration[ 'driver' ])) { |
|
| 170 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - $driverName = $omConfiguration['driver']; |
|
| 174 | + $driverName = $omConfiguration[ 'driver' ]; |
|
| 175 | 175 | |
| 176 | - if (!array_key_exists($driverName, $doctrineConfig['driver']) || !is_array($doctrineConfig['driver'][$driverName])) { |
|
| 177 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
| 176 | + if (!array_key_exists($driverName, $doctrineConfig[ 'driver' ]) || !is_array($doctrineConfig[ 'driver' ][ $driverName ])) { |
|
| 177 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
| 178 | 178 | return false; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $driverConfig = $doctrineConfig['driver'][$driverName]; |
|
| 181 | + $driverConfig = $doctrineConfig[ 'driver' ][ $driverName ]; |
|
| 182 | 182 | |
| 183 | - if (!array_key_exists('drivers', $driverConfig) || !is_array($driverConfig['drivers'])) { |
|
| 184 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
| 183 | + if (!array_key_exists('drivers', $driverConfig) || !is_array($driverConfig[ 'drivers' ])) { |
|
| 184 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
| 185 | 185 | return false; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = $this->buildIndexNamespaces($driverConfig['drivers']); |
|
| 188 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = $this->buildIndexNamespaces($driverConfig[ 'drivers' ]); |
|
| 189 | 189 | |
| 190 | - return false !== $this->namespacesByObjectManagerCache[$objectManagerServiceName]; |
|
| 190 | + return false !== $this->namespacesByObjectManagerCache[ $objectManagerServiceName ]; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $moduleOptions = $this->getModuleOptions(); |
| 207 | 207 | $entitySeparator = $moduleOptions->getEntitySeparator(); |
| 208 | 208 | |
| 209 | - $index = []; |
|
| 209 | + $index = [ ]; |
|
| 210 | 210 | foreach ($listNamespaces as $currentNamespace) { |
| 211 | 211 | $prepareNamespace = rtrim($currentNamespace, '\\'); |
| 212 | 212 | $normalizeNamespace = $prepareNamespace . '\\'; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $normalizeNamespaceStack = explode($entitySeparator, $normalizeNamespace); |
| 215 | 215 | |
| 216 | 216 | $namespacePrefix = array_shift($normalizeNamespaceStack); |
| 217 | - $index[$currentNamespace] = $namespacePrefix . $entitySeparator; |
|
| 217 | + $index[ $currentNamespace ] = $namespacePrefix . $entitySeparator; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | return $index; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | throw new Exception\EntityNamespacesNotFoundException($errMsh); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - return $this->namespacesByObjectManagerCache[$objectManagerServiceName]; |
|
| 239 | + return $this->namespacesByObjectManagerCache[ $objectManagerServiceName ]; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -250,8 +250,8 @@ discard block |
||
| 250 | 250 | $doctrineConfig = $this->getDoctrineConfig(); |
| 251 | 251 | |
| 252 | 252 | return $this->isValidDoctrineOrmModuleEntityManagerConfig() |
| 253 | - && array_key_exists('configuration', $doctrineConfig) && is_array($doctrineConfig['configuration']) |
|
| 254 | - && array_key_exists('driver', $doctrineConfig) && is_array($doctrineConfig['driver']); |
|
| 253 | + && array_key_exists('configuration', $doctrineConfig) && is_array($doctrineConfig[ 'configuration' ]) |
|
| 254 | + && array_key_exists('driver', $doctrineConfig) && is_array($doctrineConfig[ 'driver' ]); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | $doctrineConfig = $this->getDoctrineConfig(); |
| 265 | 265 | |
| 266 | - return array_key_exists('entitymanager', $doctrineConfig) && is_array($doctrineConfig['entitymanager']); |
|
| 266 | + return array_key_exists('entitymanager', $doctrineConfig) && is_array($doctrineConfig[ 'entitymanager' ]); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @var array |
| 28 | 28 | */ |
| 29 | - protected $prototype = []; |
|
| 29 | + protected $prototype = [ ]; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Флаг определяет была ли инициированна фабрика |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @var array |
| 49 | 49 | */ |
| 50 | - protected $objectManagerToEntityMap = []; |
|
| 50 | + protected $objectManagerToEntityMap = [ ]; |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Колличество ObjectManagers для которых есть EntityMap |
@@ -61,14 +61,14 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @var array |
| 63 | 63 | */ |
| 64 | - protected $baseEntityMap = []; |
|
| 64 | + protected $baseEntityMap = [ ]; |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Ключем является имя интерфейса, а значением имя класса сущности |
| 68 | 68 | * |
| 69 | 69 | * @var array |
| 70 | 70 | */ |
| 71 | - protected $interfaceNameToClassName = []; |
|
| 71 | + protected $interfaceNameToClassName = [ ]; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * @inheritdoc |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $this->init($serviceLocator); |
| 87 | 87 | if (array_key_exists($requestedName, $this->prototype)) { |
| 88 | - return false !== $this->prototype[$requestedName]; |
|
| 88 | + return false !== $this->prototype[ $requestedName ]; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return false !== $this->getClassNameByInterface($requestedName); |
@@ -101,25 +101,25 @@ discard block |
||
| 101 | 101 | protected function getClassNameByInterface($interfaceName) |
| 102 | 102 | { |
| 103 | 103 | if (array_key_exists($interfaceName, $this->interfaceNameToClassName)) { |
| 104 | - return $this->interfaceNameToClassName[$interfaceName]; |
|
| 104 | + return $this->interfaceNameToClassName[ $interfaceName ]; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (0 === $this->countObjectManagers) { |
| 108 | - $this->interfaceNameToClassName[$interfaceName] = false; |
|
| 108 | + $this->interfaceNameToClassName[ $interfaceName ] = false; |
|
| 109 | 109 | return false; |
| 110 | 110 | } elseif (1 === $this->countObjectManagers) { |
| 111 | - $this->interfaceNameToClassName[$interfaceName] = array_key_exists($interfaceName, $this->baseEntityMap) ? $this->baseEntityMap[$interfaceName] : false; |
|
| 112 | - return $this->interfaceNameToClassName[$interfaceName]; |
|
| 111 | + $this->interfaceNameToClassName[ $interfaceName ] = array_key_exists($interfaceName, $this->baseEntityMap) ? $this->baseEntityMap[ $interfaceName ] : false; |
|
| 112 | + return $this->interfaceNameToClassName[ $interfaceName ]; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | foreach ($this->objectManagerToEntityMap as $entityMap) { |
| 116 | 116 | if (array_key_exists($interfaceName, $entityMap)) { |
| 117 | - $this->interfaceNameToClassName[$interfaceName] = $entityMap[$interfaceName]; |
|
| 118 | - return $this->interfaceNameToClassName[$interfaceName]; |
|
| 117 | + $this->interfaceNameToClassName[ $interfaceName ] = $entityMap[ $interfaceName ]; |
|
| 118 | + return $this->interfaceNameToClassName[ $interfaceName ]; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | - $this->interfaceNameToClassName[$interfaceName] = false; |
|
| 122 | - return $this->interfaceNameToClassName[$interfaceName]; |
|
| 121 | + $this->interfaceNameToClassName[ $interfaceName ] = false; |
|
| 122 | + return $this->interfaceNameToClassName[ $interfaceName ]; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | $this->init($serviceLocator); |
| 140 | 140 | |
| 141 | 141 | if (array_key_exists($requestedName, $this->prototype)) { |
| 142 | - if (!is_object($this->prototype[$requestedName])) { |
|
| 142 | + if (!is_object($this->prototype[ $requestedName ])) { |
|
| 143 | 143 | $errMsg = sprintf('Invalid prototype for %s', $requestedName); |
| 144 | 144 | throw new Exception\RuntimeException($errMsg); |
| 145 | 145 | } |
| 146 | - return clone $this->prototype[$requestedName]; |
|
| 146 | + return clone $this->prototype[ $requestedName ]; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $className = $this->getClassNameByInterface($requestedName); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $r = new ReflectionClass($className); |
| 159 | 159 | $entity = $r->newInstance(); |
| 160 | 160 | } |
| 161 | - $this->prototype[$requestedName] = $entity; |
|
| 161 | + $this->prototype[ $requestedName ] = $entity; |
|
| 162 | 162 | |
| 163 | 163 | return $entity; |
| 164 | 164 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $entityMapCache = $appServiceLocator->get(EntityMapCacheInterface::class); |
| 197 | 197 | foreach ($listObjectManagerName as $objectManagerName) { |
| 198 | 198 | if ($entityMapCache->hasEntityMap($objectManagerName)) { |
| 199 | - $this->objectManagerToEntityMap[$objectManagerName] = $entityMapCache->loadEntityMap($objectManagerName); |
|
| 199 | + $this->objectManagerToEntityMap[ $objectManagerName ] = $entityMapCache->loadEntityMap($objectManagerName); |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |