@@ -285,8 +285,8 @@ |
||
| 285 | 285 | * |
| 286 | 286 | * @param string $routerName |
| 287 | 287 | * @param string $workflowName |
| 288 | - * @param null $managerName |
|
| 289 | - * @param null $managerAlias |
|
| 288 | + * @param string $managerName |
|
| 289 | + * @param string $managerAlias |
|
| 290 | 290 | * |
| 291 | 291 | * @return array |
| 292 | 292 | */ |
@@ -162,15 +162,15 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @param array $options |
| 164 | 164 | */ |
| 165 | - public function __construct(array $options = []) |
|
| 165 | + public function __construct(array $options = [ ]) |
|
| 166 | 166 | { |
| 167 | 167 | $initOptions = [ |
| 168 | - array_key_exists('entryToObjectsService', $options) ? $options['entryToObjectsService'] : null, |
|
| 169 | - array_key_exists('moduleOptions', $options) ? $options['moduleOptions'] : null, |
|
| 170 | - array_key_exists('mvcEvent', $options) ? $options['mvcEvent'] : null, |
|
| 171 | - array_key_exists('log', $options) ? $options['log'] : null |
|
| 168 | + array_key_exists('entryToObjectsService', $options) ? $options[ 'entryToObjectsService' ] : null, |
|
| 169 | + array_key_exists('moduleOptions', $options) ? $options[ 'moduleOptions' ] : null, |
|
| 170 | + array_key_exists('mvcEvent', $options) ? $options[ 'mvcEvent' ] : null, |
|
| 171 | + array_key_exists('log', $options) ? $options[ 'log' ] : null |
|
| 172 | 172 | ]; |
| 173 | - call_user_func_array([$this, 'init'], $initOptions); |
|
| 173 | + call_user_func_array([ $this, 'init' ], $initOptions); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function attach(EventManagerInterface $events) |
| 198 | 198 | { |
| 199 | - $events->getSharedManager()->attach(RouteHandler::class, ResolveEntryIdEventInterface::RESOLVE_ENTRY_ID_EVENT, [$this, 'onResolveEntryId'], 80); |
|
| 199 | + $events->getSharedManager()->attach(RouteHandler::class, ResolveEntryIdEventInterface::RESOLVE_ENTRY_ID_EVENT, [ $this, 'onResolveEntryId' ], 80); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $metadata = null; |
| 232 | 232 | foreach ($indexKeys as $indexKey) { |
| 233 | 233 | if (array_key_exists($indexKey, $index)) { |
| 234 | - $metadata = $index[$indexKey]; |
|
| 234 | + $metadata = $index[ $indexKey ]; |
|
| 235 | 235 | break; |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -243,13 +243,13 @@ discard block |
||
| 243 | 243 | return null; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $objectsInfo = []; |
|
| 246 | + $objectsInfo = [ ]; |
|
| 247 | 247 | |
| 248 | 248 | foreach ($metadata as $entityClassName => $metadataItem) { |
| 249 | - $objectsInfo[$entityClassName] = []; |
|
| 249 | + $objectsInfo[ $entityClassName ] = [ ]; |
|
| 250 | 250 | foreach ($metadataItem as $propertyName => $info) { |
| 251 | - $mode = $info[static::MODE]; |
|
| 252 | - $paramName = $info[static::PARAM_NAME]; |
|
| 251 | + $mode = $info[ static::MODE ]; |
|
| 252 | + $paramName = $info[ static::PARAM_NAME ]; |
|
| 253 | 253 | |
| 254 | 254 | $idValue = null; |
| 255 | 255 | if (static::MODE_ROUTER_PARAM === $mode) { |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $errMsg = sprintf('Error getting the primary identifier for the entity\'s key. Source: %s. Value: %s', $mode, $paramName); |
| 268 | 268 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 269 | 269 | } |
| 270 | - $objectsInfo[$entityClassName][$propertyName] = $idValue; |
|
| 270 | + $objectsInfo[ $entityClassName ][ $propertyName ] = $idValue; |
|
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | |
@@ -292,27 +292,27 @@ discard block |
||
| 292 | 292 | */ |
| 293 | 293 | public function buildIndexKeys($routerName, $workflowName, $managerName = null, $managerAlias = null) |
| 294 | 294 | { |
| 295 | - $keys = []; |
|
| 295 | + $keys = [ ]; |
|
| 296 | 296 | |
| 297 | - $prefixes =[]; |
|
| 297 | + $prefixes = [ ]; |
|
| 298 | 298 | if (null !== $managerAlias) { |
| 299 | - $prefixes[] = sprintf('alias_%s_%s_', $managerAlias, $workflowName); |
|
| 299 | + $prefixes[ ] = sprintf('alias_%s_%s_', $managerAlias, $workflowName); |
|
| 300 | 300 | } |
| 301 | 301 | if (null !== $managerName) { |
| 302 | - $prefixes[] = sprintf('name_%s_%s_', $managerName, $workflowName); |
|
| 302 | + $prefixes[ ] = sprintf('name_%s_%s_', $managerName, $workflowName); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - $prepareRouteParts = []; |
|
| 305 | + $prepareRouteParts = [ ]; |
|
| 306 | 306 | $stackRouteParts = explode('/', $routerName); |
| 307 | 307 | |
| 308 | 308 | for ($i = count($stackRouteParts); $i >= 1; $i--) { |
| 309 | 309 | $routeParts = array_slice($stackRouteParts, 0, $i); |
| 310 | - $prepareRouteParts[] = implode('/', $routeParts); |
|
| 310 | + $prepareRouteParts[ ] = implode('/', $routeParts); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | foreach ($prefixes as $prefix) { |
| 314 | 314 | foreach ($prepareRouteParts as $prepareRoutePart) { |
| 315 | - $keys[] = $prefix . $prepareRoutePart; |
|
| 315 | + $keys[ ] = $prefix . $prepareRoutePart; |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | $metadata = $this->getModuleOptions()->getWorkflowEntryToObjectMetadata(); |
| 333 | 333 | |
| 334 | - $index = []; |
|
| 334 | + $index = [ ]; |
|
| 335 | 335 | foreach ($metadata as $metadataItem) { |
| 336 | 336 | if (!array_key_exists(static::WORKFLOW_MANAGER_NAME, $metadataItem) && !array_key_exists(static::WORKFLOW_MANAGER_ALIAS, $metadataItem)) { |
| 337 | 337 | $errMsg = sprintf( |
@@ -355,21 +355,21 @@ discard block |
||
| 355 | 355 | $errMsg = sprintf('there is no option %s', static::WORKFLOW_NAME); |
| 356 | 356 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 357 | 357 | } |
| 358 | - $workflowName = $metadataItem[static::WORKFLOW_NAME]; |
|
| 358 | + $workflowName = $metadataItem[ static::WORKFLOW_NAME ]; |
|
| 359 | 359 | |
| 360 | 360 | if (!array_key_exists(static::ROUTER_NAME, $metadataItem)) { |
| 361 | 361 | $errMsg = sprintf('there is no option %s', static::ROUTER_NAME); |
| 362 | 362 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 363 | 363 | } |
| 364 | - $routerName = $metadataItem[static::ROUTER_NAME]; |
|
| 364 | + $routerName = $metadataItem[ static::ROUTER_NAME ]; |
|
| 365 | 365 | |
| 366 | 366 | $prefix = ''; |
| 367 | 367 | if (array_key_exists(static::WORKFLOW_MANAGER_NAME, $metadataItem)) { |
| 368 | - $prefix = 'name_' . $metadataItem[static::WORKFLOW_MANAGER_NAME] . '_'; |
|
| 368 | + $prefix = 'name_' . $metadataItem[ static::WORKFLOW_MANAGER_NAME ] . '_'; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | if (array_key_exists(static::WORKFLOW_MANAGER_ALIAS, $metadataItem)) { |
| 372 | - $prefix = 'alias_' . $metadataItem[static::WORKFLOW_MANAGER_ALIAS] . '_'; |
|
| 372 | + $prefix = 'alias_' . $metadataItem[ static::WORKFLOW_MANAGER_ALIAS ] . '_'; |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | $uniqueKey = $prefix . $workflowName . '_' . $routerName; |
@@ -379,71 +379,71 @@ discard block |
||
| 379 | 379 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - $index[$uniqueKey] = []; |
|
| 382 | + $index[ $uniqueKey ] = [ ]; |
|
| 383 | 383 | |
| 384 | 384 | |
| 385 | 385 | if (!array_key_exists(static::MAP, $metadataItem)) { |
| 386 | 386 | $errMsg = sprintf('there is no option %s', static::MAP); |
| 387 | 387 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 388 | 388 | } |
| 389 | - if (!is_array($metadataItem[static::MAP])) { |
|
| 389 | + if (!is_array($metadataItem[ static::MAP ])) { |
|
| 390 | 390 | $errMsg = sprintf('option %s is not array', static::MAP); |
| 391 | 391 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 392 | 392 | } |
| 393 | - $map = $metadataItem[static::MAP]; |
|
| 393 | + $map = $metadataItem[ static::MAP ]; |
|
| 394 | 394 | |
| 395 | 395 | foreach ($map as $mapItem) { |
| 396 | 396 | if (!array_key_exists(static::ENTITY_CLASS_NAME, $mapItem)) { |
| 397 | 397 | $errMsg = sprintf('there is no option %s', static::ENTITY_CLASS_NAME); |
| 398 | 398 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 399 | 399 | } |
| 400 | - $entityClassName = $mapItem[static::ENTITY_CLASS_NAME]; |
|
| 400 | + $entityClassName = $mapItem[ static::ENTITY_CLASS_NAME ]; |
|
| 401 | 401 | |
| 402 | - if (array_key_exists($entityClassName, $index[$uniqueKey])) { |
|
| 403 | - $errMsg = sprintf('Metadata for entities already exist %s', $mapItem[static::ENTITY_CLASS_NAME]); |
|
| 402 | + if (array_key_exists($entityClassName, $index[ $uniqueKey ])) { |
|
| 403 | + $errMsg = sprintf('Metadata for entities already exist %s', $mapItem[ static::ENTITY_CLASS_NAME ]); |
|
| 404 | 404 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 405 | 405 | } |
| 406 | - $index[$uniqueKey][$entityClassName] = []; |
|
| 406 | + $index[ $uniqueKey ][ $entityClassName ] = [ ]; |
|
| 407 | 407 | |
| 408 | 408 | if (!array_key_exists(static::IDENTIFIERS_MAP, $mapItem)) { |
| 409 | 409 | $errMsg = sprintf('there is no option %s', static::IDENTIFIERS_MAP); |
| 410 | 410 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 411 | 411 | } |
| 412 | - if (!is_array($mapItem[static::IDENTIFIERS_MAP])) { |
|
| 412 | + if (!is_array($mapItem[ static::IDENTIFIERS_MAP ])) { |
|
| 413 | 413 | $errMsg = sprintf('option %s is not array', static::IDENTIFIERS_MAP); |
| 414 | 414 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - $identifiersMap = $mapItem[static::IDENTIFIERS_MAP]; |
|
| 417 | + $identifiersMap = $mapItem[ static::IDENTIFIERS_MAP ]; |
|
| 418 | 418 | |
| 419 | 419 | foreach ($identifiersMap as $identifierItem) { |
| 420 | 420 | if (!array_key_exists(static::PROPERTY_NAME, $identifierItem)) { |
| 421 | 421 | $errMsg = sprintf('there is no option %s', static::PROPERTY_NAME); |
| 422 | 422 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 423 | 423 | } |
| 424 | - $propertyName = $identifierItem[static::PROPERTY_NAME]; |
|
| 424 | + $propertyName = $identifierItem[ static::PROPERTY_NAME ]; |
|
| 425 | 425 | |
| 426 | - if (array_key_exists($propertyName, $index[$uniqueKey][$entityClassName])) { |
|
| 426 | + if (array_key_exists($propertyName, $index[ $uniqueKey ][ $entityClassName ])) { |
|
| 427 | 427 | $errMsg = sprintf('Metadata for property already exist %s', $propertyName); |
| 428 | 428 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 429 | 429 | } |
| 430 | - $index[$uniqueKey][$entityClassName][$propertyName] = []; |
|
| 430 | + $index[ $uniqueKey ][ $entityClassName ][ $propertyName ] = [ ]; |
|
| 431 | 431 | |
| 432 | - $modeOriginal = array_key_exists(static::MODE, $identifierItem) ? $identifierItem[static::MODE] : static ::MODE_ROUTER_PARAM; |
|
| 432 | + $modeOriginal = array_key_exists(static::MODE, $identifierItem) ? $identifierItem[ static::MODE ] : static ::MODE_ROUTER_PARAM; |
|
| 433 | 433 | $mode = strtolower($modeOriginal); |
| 434 | 434 | |
| 435 | 435 | if (!array_key_exists($mode, $this->accessMode)) { |
| 436 | 436 | $errMsg = sprintf('Invalid value for the "mode" %s', $mode); |
| 437 | 437 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 438 | 438 | } |
| 439 | - $index[$uniqueKey][$entityClassName][$propertyName][static::MODE] = $mode; |
|
| 439 | + $index[ $uniqueKey ][ $entityClassName ][ $propertyName ][ static::MODE ] = $mode; |
|
| 440 | 440 | |
| 441 | 441 | if (!array_key_exists(static::PARAM_NAME, $identifierItem)) { |
| 442 | 442 | $errMsg = sprintf('there is no option %s', static::PARAM_NAME); |
| 443 | 443 | throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg); |
| 444 | 444 | } |
| 445 | - $paramName = $identifierItem[static::PARAM_NAME]; |
|
| 446 | - $index[$uniqueKey][$entityClassName][$propertyName][static::PARAM_NAME] = $paramName; |
|
| 445 | + $paramName = $identifierItem[ static::PARAM_NAME ]; |
|
| 446 | + $index[ $uniqueKey ][ $entityClassName ][ $propertyName ][ static::PARAM_NAME ] = $paramName; |
|
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | 449 | } |
@@ -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 | /** |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | $serializer = $this->getSerializerManager()->get($serializerName); |
| 121 | 121 | |
| 122 | 122 | $id = $metadata->getIdentifierValues($object); |
| 123 | - $prepareId = []; |
|
| 123 | + $prepareId = [ ]; |
|
| 124 | 124 | foreach ($id as $idField => $idValue) { |
| 125 | - $prepareId[$idField] = (string)$idValue; |
|
| 125 | + $prepareId[ $idField ] = (string) $idValue; |
|
| 126 | 126 | } |
| 127 | 127 | $serializedId = $serializer->serialize($prepareId); |
| 128 | 128 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * @throws Exception\InvalidGetEntryByObjectsInfoException |
| 221 | 221 | * @throws \Zend\Serializer\Exception\ExceptionInterface |
| 222 | 222 | */ |
| 223 | - public function getEntryByObjectsInfo($managerName, $workflowName, array $objectsInfo = []) |
|
| 223 | + public function getEntryByObjectsInfo($managerName, $workflowName, array $objectsInfo = [ ]) |
|
| 224 | 224 | { |
| 225 | 225 | try { |
| 226 | 226 | $workflowManager = $this->getWorkflowService()->getWorkflowManager($managerName); |
@@ -235,19 +235,19 @@ discard block |
||
| 235 | 235 | $em = $store->getEntityManager(); |
| 236 | 236 | |
| 237 | 237 | $serializer = $this->getSerializer(); |
| 238 | - $objectHash = []; |
|
| 238 | + $objectHash = [ ]; |
|
| 239 | 239 | foreach ($objectsInfo as $entityClassName => $item) { |
| 240 | 240 | $classMetadata = $em->getClassMetadata($entityClassName); |
| 241 | 241 | $identifierMetadata = $classMetadata->getIdentifier(); |
| 242 | 242 | |
| 243 | - $id = []; |
|
| 243 | + $id = [ ]; |
|
| 244 | 244 | |
| 245 | 245 | foreach ($identifierMetadata as $propertyName) { |
| 246 | 246 | if (!array_key_exists($propertyName, $item)) { |
| 247 | 247 | $errMsg = sprintf('Property %s not found', $propertyName); |
| 248 | 248 | throw new Exception\InvalidGetEntryByObjectsInfoException($errMsg); |
| 249 | 249 | } |
| 250 | - $id[$propertyName] = (string)$item[$propertyName]; |
|
| 250 | + $id[ $propertyName ] = (string) $item[ $propertyName ]; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | $serializedId = $serializer->serialize($id); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $hash = $entityClassName . '_' . $serializedId; |
| 256 | 256 | $base64Hash = base64_encode($hash); |
| 257 | 257 | |
| 258 | - $objectHash[$base64Hash] = $base64Hash; |
|
| 258 | + $objectHash[ $base64Hash ] = $base64Hash; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $extEntryClassName = $this->getModuleOptions()->getEntityClassName('DoctrineWorkflowStory\ExtEntry'); |