@@ -28,9 +28,9 @@ |
||
28 | 28 | { |
29 | 29 | /** @var array $appConfig */ |
30 | 30 | $appConfig = $serviceLocator->get('config'); |
31 | - $config = []; |
|
31 | + $config = [ ]; |
|
32 | 32 | if (array_key_exists(Module::CONFIG_KEY, $appConfig)) { |
33 | - $config = $appConfig[Module::CONFIG_KEY]; |
|
33 | + $config = $appConfig[ Module::CONFIG_KEY ]; |
|
34 | 34 | } |
35 | 35 | return new ModuleOptions($config); |
36 | 36 | } |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @var string |
21 | 21 | */ |
22 | - const HTTP_METHOD_INVALID = 'httpMethodInvalid'; |
|
22 | + const HTTP_METHOD_INVALID = 'httpMethodInvalid'; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @var string |
26 | 26 | */ |
27 | - const VALIDATE_VALUE_INVALID = 'validateValueInvalid'; |
|
27 | + const VALIDATE_VALUE_INVALID = 'validateValueInvalid'; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @var string |
31 | 31 | */ |
32 | - const REQUEST_INVALID = 'requestInvalid'; |
|
32 | + const REQUEST_INVALID = 'requestInvalid'; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Validation failure message template definitions |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | { |
105 | 105 | $results = null; |
106 | 106 | if (is_array($allowedHttpMethods)) { |
107 | - $results = array_map(function ($method) { |
|
107 | + $results = array_map(function($method) { |
|
108 | 108 | $method = trim($method); |
109 | 109 | $method = strtolower($method); |
110 | 110 |
@@ -17,6 +17,6 @@ |
||
17 | 17 | { |
18 | 18 | public function __construct() |
19 | 19 | { |
20 | - $this->entityMap['entry'] = ExtEntry::class; |
|
20 | + $this->entityMap[ 'entry' ] = ExtEntry::class; |
|
21 | 21 | } |
22 | 22 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * Например |
18 | 18 | * DoctrineWorkflowStory\ExtEntry => MyClass::class |
19 | 19 | */ |
20 | - 'entityMap' => [], |
|
20 | + 'entityMap' => [ ], |
|
21 | 21 | /** |
22 | 22 | * Метаданные используемые для получения id процесса wf(entryId). |
23 | 23 | * Пример: |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @throws \Doctrine\ORM\NonUniqueResultException |
26 | 26 | * @throws \Doctrine\ORM\NoResultException |
27 | 27 | */ |
28 | - public function findEntryByObjectInfo($workflowName, array $objectHash = []) |
|
28 | + public function findEntryByObjectInfo($workflowName, array $objectHash = [ ]) |
|
29 | 29 | { |
30 | 30 | $entryClassName = ExtEntry::class; |
31 | 31 |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @var array |
28 | 28 | */ |
29 | - protected $entityMap = []; |
|
29 | + protected $entityMap = [ ]; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Метаданные для получения id процесса |
33 | 33 | * |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - protected $workflowEntryToObjectMetadata = []; |
|
36 | + protected $workflowEntryToObjectMetadata = [ ]; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @return string |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return $this |
70 | 70 | */ |
71 | - public function setEntityMap(array $entityMap = []) |
|
71 | + public function setEntityMap(array $entityMap = [ ]) |
|
72 | 72 | { |
73 | 73 | $this->entityMap = $entityMap; |
74 | 74 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return $this |
110 | 110 | */ |
111 | - public function setWorkflowEntryToObjectMetadata(array $workflowEntryToObjectMetadata = []) |
|
111 | + public function setWorkflowEntryToObjectMetadata(array $workflowEntryToObjectMetadata = [ ]) |
|
112 | 112 | { |
113 | 113 | $this->workflowEntryToObjectMetadata = $workflowEntryToObjectMetadata; |
114 | 114 |
@@ -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'); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | $serializerManager = $appServiceLocator->get('SerializerAdapterManager'); |
38 | 38 | $moduleOptions = $appServiceLocator->get(ModuleOptions::class); |
39 | - $workflowService = $appServiceLocator->get(Workflow::class); |
|
39 | + $workflowService = $appServiceLocator->get(Workflow::class); |
|
40 | 40 | |
41 | 41 | return new DoctrineWorkflowStoryService( |
42 | 42 | [ |
@@ -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; |