@@ -214,7 +214,7 @@ |
||
| 214 | 214 | * @param string $workflowName |
| 215 | 215 | * @param array $objectsInfo |
| 216 | 216 | * |
| 217 | - * @return ExtEntry|null |
|
| 217 | + * @return ExtEntry |
|
| 218 | 218 | * |
| 219 | 219 | * @throws Exception\InvalidGetEntryByObjectsInfoException |
| 220 | 220 | * @throws \Zend\Serializer\Exception\ExceptionInterface |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @param array $options |
| 72 | 72 | */ |
| 73 | - public function __construct(array $options = []) |
|
| 73 | + public function __construct(array $options = [ ]) |
|
| 74 | 74 | { |
| 75 | 75 | $initOptions = [ |
| 76 | - array_key_exists('serializerManager', $options) ? $options['serializerManager'] : null, |
|
| 77 | - array_key_exists('moduleOptions', $options) ? $options['moduleOptions'] : null, |
|
| 78 | - array_key_exists('workflowService', $options) ? $options['workflowService'] : null |
|
| 76 | + array_key_exists('serializerManager', $options) ? $options[ 'serializerManager' ] : null, |
|
| 77 | + array_key_exists('moduleOptions', $options) ? $options[ 'moduleOptions' ] : null, |
|
| 78 | + array_key_exists('workflowService', $options) ? $options[ 'workflowService' ] : null |
|
| 79 | 79 | ]; |
| 80 | - call_user_func_array([$this, 'init'], $initOptions); |
|
| 80 | + call_user_func_array([ $this, 'init' ], $initOptions); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | $serializer = $this->getSerializerManager()->get($serializerName); |
| 127 | 127 | |
| 128 | 128 | $id = $metadata->getIdentifierValues($object); |
| 129 | - $prepareId = []; |
|
| 129 | + $prepareId = [ ]; |
|
| 130 | 130 | foreach ($id as $idField => $idValue) { |
| 131 | - $prepareId[$idField] = (string)$idValue; |
|
| 131 | + $prepareId[ $idField ] = (string) $idValue; |
|
| 132 | 132 | } |
| 133 | 133 | $serializedId = $serializer->serialize($prepareId); |
| 134 | 134 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @throws Exception\InvalidGetEntryByObjectsInfoException |
| 220 | 220 | * @throws \Zend\Serializer\Exception\ExceptionInterface |
| 221 | 221 | */ |
| 222 | - public function getEntryByObjectsInfo($managerName, $workflowName, array $objectsInfo = []) |
|
| 222 | + public function getEntryByObjectsInfo($managerName, $workflowName, array $objectsInfo = [ ]) |
|
| 223 | 223 | { |
| 224 | 224 | try { |
| 225 | 225 | $workflowManager = $this->getWorkflowService()->getWorkflowManager($managerName); |
@@ -234,11 +234,11 @@ discard block |
||
| 234 | 234 | $em = $store->getEntityManager(); |
| 235 | 235 | |
| 236 | 236 | $serializer = $this->getSerializer(); |
| 237 | - $objectHash = []; |
|
| 237 | + $objectHash = [ ]; |
|
| 238 | 238 | foreach ($objectsInfo as $entityClassName => $entityId) { |
| 239 | 239 | $identifierFieldName = $em->getClassMetadata($entityClassName)->getSingleIdentifierFieldName(); |
| 240 | 240 | $id = [ |
| 241 | - $identifierFieldName => (string)$entityId |
|
| 241 | + $identifierFieldName => (string) $entityId |
|
| 242 | 242 | ]; |
| 243 | 243 | |
| 244 | 244 | $serializedId = $serializer->serialize($id); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $hash = $entityClassName . '_' . $serializedId; |
| 247 | 247 | $base64Hash = base64_encode($hash); |
| 248 | 248 | |
| 249 | - $objectHash[$base64Hash] = $base64Hash; |
|
| 249 | + $objectHash[ $base64Hash ] = $base64Hash; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | $extEntryClassName = $this->getModuleOptions()->getEntityClassName('DoctrineWorkflowStory\ExtEntry'); |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @param array $options |
| 89 | 89 | */ |
| 90 | - public function __construct(array $options = []) |
|
| 90 | + public function __construct(array $options = [ ]) |
|
| 91 | 91 | { |
| 92 | 92 | $initOptions = [ |
| 93 | - array_key_exists('entryToObjectsService', $options) ? $options['entryToObjectsService'] : null, |
|
| 94 | - array_key_exists('moduleOptions', $options) ? $options['moduleOptions'] : null, |
|
| 95 | - array_key_exists('mvcEvent', $options) ? $options['mvcEvent'] : null |
|
| 93 | + array_key_exists('entryToObjectsService', $options) ? $options[ 'entryToObjectsService' ] : null, |
|
| 94 | + array_key_exists('moduleOptions', $options) ? $options[ 'moduleOptions' ] : null, |
|
| 95 | + array_key_exists('mvcEvent', $options) ? $options[ 'mvcEvent' ] : null |
|
| 96 | 96 | ]; |
| 97 | - call_user_func_array([$this, 'init'], $initOptions); |
|
| 97 | + call_user_func_array([ $this, 'init' ], $initOptions); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function attach(EventManagerInterface $events) |
| 119 | 119 | { |
| 120 | - $events->getSharedManager()->attach(RouteHandler::class, ResolveEntryIdEventInterface::RESOLVE_ENTRY_ID_EVENT, [$this, 'onResolveEntryId'], 80); |
|
| 120 | + $events->getSharedManager()->attach(RouteHandler::class, ResolveEntryIdEventInterface::RESOLVE_ENTRY_ID_EVENT, [ $this, 'onResolveEntryId' ], 80); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $workflowName = $resolveEntryIdEvent->getWorkflowName(); |
| 145 | - if (!array_key_exists($workflowName, $index[$managerName]) || !is_array($index[$managerName][$workflowName])) { |
|
| 145 | + if (!array_key_exists($workflowName, $index[ $managerName ]) || !is_array($index[ $managerName ][ $workflowName ])) { |
|
| 146 | 146 | return null; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $routeMatch = $this->getMvcEvent()->getRouteMatch(); |
| 150 | - $objectsInfo = []; |
|
| 151 | - foreach ($index[$managerName][$workflowName] as $entityClassName => $routerParamName) { |
|
| 150 | + $objectsInfo = [ ]; |
|
| 151 | + foreach ($index[ $managerName ][ $workflowName ] as $entityClassName => $routerParamName) { |
|
| 152 | 152 | $entityId = $routeMatch->getParam($routerParamName, null); |
| 153 | 153 | if (null === $entityId) { |
| 154 | 154 | return null; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $objectsInfo[$entityClassName] = $entityId; |
|
| 157 | + $objectsInfo[ $entityClassName ] = $entityId; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $entry = $this->getEntryToObjectsService()->getEntryByObjectsInfo($managerName, $workflowName, $objectsInfo); |
@@ -178,35 +178,35 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | $metadata = $this->getModuleOptions()->getWorkflowEntryToObjectMetadata(); |
| 180 | 180 | |
| 181 | - $index = []; |
|
| 181 | + $index = [ ]; |
|
| 182 | 182 | foreach ($metadata as $metadataItem) { |
| 183 | 183 | if (!array_key_exists(static::WORKFLOW_MANAGER_NAME, $metadataItem)) { |
| 184 | 184 | $errMsg = sprintf('there is no option %s', static::WORKFLOW_MANAGER_NAME); |
| 185 | 185 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 186 | 186 | } |
| 187 | - $workflowManagerName = $metadataItem[static::WORKFLOW_MANAGER_NAME]; |
|
| 187 | + $workflowManagerName = $metadataItem[ static::WORKFLOW_MANAGER_NAME ]; |
|
| 188 | 188 | |
| 189 | 189 | if (!array_key_exists(static::WORKFLOW_NAME, $metadataItem)) { |
| 190 | 190 | $errMsg = sprintf('there is no option %s', static::WORKFLOW_NAME); |
| 191 | 191 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 192 | 192 | } |
| 193 | - $workflowName = $metadataItem[static::WORKFLOW_NAME]; |
|
| 193 | + $workflowName = $metadataItem[ static::WORKFLOW_NAME ]; |
|
| 194 | 194 | |
| 195 | 195 | if (!array_key_exists(static::MAP, $metadataItem)) { |
| 196 | 196 | $errMsg = sprintf('there is no option %s', static::MAP); |
| 197 | 197 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 198 | 198 | } |
| 199 | - if (!is_array($metadataItem[static::MAP])) { |
|
| 199 | + if (!is_array($metadataItem[ static::MAP ])) { |
|
| 200 | 200 | $errMsg = sprintf('option %s is not array', static::MAP); |
| 201 | 201 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 202 | 202 | } |
| 203 | - $map = $metadataItem[static::MAP]; |
|
| 203 | + $map = $metadataItem[ static::MAP ]; |
|
| 204 | 204 | |
| 205 | 205 | if (!array_key_exists($workflowManagerName, $index)) { |
| 206 | - $index[$workflowManagerName] = []; |
|
| 206 | + $index[ $workflowManagerName ] = [ ]; |
|
| 207 | 207 | } |
| 208 | - if (!array_key_exists($workflowName, $index[$workflowManagerName])) { |
|
| 209 | - $index[$workflowManagerName][$workflowName] = []; |
|
| 208 | + if (!array_key_exists($workflowName, $index[ $workflowManagerName ])) { |
|
| 209 | + $index[ $workflowManagerName ][ $workflowName ] = [ ]; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | foreach ($map as $mapItem) { |
@@ -214,10 +214,10 @@ discard block |
||
| 214 | 214 | $errMsg = sprintf('there is no option %s', static::ENTITY_CLASS_NAME); |
| 215 | 215 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 216 | 216 | } |
| 217 | - $entityClassName = $mapItem[static::ENTITY_CLASS_NAME]; |
|
| 217 | + $entityClassName = $mapItem[ static::ENTITY_CLASS_NAME ]; |
|
| 218 | 218 | |
| 219 | - if (array_key_exists($entityClassName, $index[$workflowManagerName][$workflowName])) { |
|
| 220 | - $errMsg = sprintf('Metadata for entities already exist %s', $mapItem[static::ENTITY_CLASS_NAME]); |
|
| 219 | + if (array_key_exists($entityClassName, $index[ $workflowManagerName ][ $workflowName ])) { |
|
| 220 | + $errMsg = sprintf('Metadata for entities already exist %s', $mapItem[ static::ENTITY_CLASS_NAME ]); |
|
| 221 | 221 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | $errMsg = sprintf('there is no option %s', static::ROUTER_PARAM_NAME); |
| 226 | 226 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 227 | 227 | } |
| 228 | - $routerParamName = $mapItem[static::ROUTER_PARAM_NAME]; |
|
| 228 | + $routerParamName = $mapItem[ static::ROUTER_PARAM_NAME ]; |
|
| 229 | 229 | |
| 230 | - $index[$workflowManagerName][$workflowName][$entityClassName] = $routerParamName; |
|
| 230 | + $index[ $workflowManagerName ][ $workflowName ][ $entityClassName ] = $routerParamName; |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | $this->indexMetadata = $index; |