@@ -176,7 +176,7 @@ |
||
176 | 176 | * |
177 | 177 | * @param string $fullName |
178 | 178 | * |
179 | - * @return array|bool |
|
179 | + * @return string |
|
180 | 180 | */ |
181 | 181 | protected function getOptionsConfig($fullName) |
182 | 182 | { |
@@ -58,7 +58,7 @@ |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | - * @return mixed |
|
61 | + * @return null|string |
|
62 | 62 | */ |
63 | 63 | abstract protected function getUri(); |
64 | 64 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * @return mixed |
|
41 | + * @return \Auth\Entity\UserInterface |
|
42 | 42 | */ |
43 | 43 | public function getUser() |
44 | 44 | { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * @param mixed $repositories |
|
71 | + * @param mixed $repository |
|
72 | 72 | * |
73 | 73 | * @return self |
74 | 74 | */ |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | public function getFileEntity() |
94 | 94 | { |
95 | - if (! $this->fileEntity instanceof FileInterface) { |
|
95 | + if (!$this->fileEntity instanceof FileInterface) { |
|
96 | 96 | throw new \RuntimeException('No file entity set or it does not implement \Core\Entity\FileInterface.'); |
97 | 97 | } |
98 | 98 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function filter($value) |
103 | 103 | { |
104 | - if (! is_array($value) || ! isset($value['tmp_name']) || ((isset($value['error']) && UPLOAD_ERR_NO_FILE == $value['error']))) { |
|
104 | + if (!is_array($value) || !isset($value['tmp_name']) || ((isset($value['error']) && UPLOAD_ERR_NO_FILE == $value['error']))) { |
|
105 | 105 | return null; |
106 | 106 | } |
107 | 107 |
@@ -179,7 +179,7 @@ |
||
179 | 179 | |
180 | 180 | /** |
181 | 181 | * @throws \RuntimeException |
182 | - * @return Collection |
|
182 | + * @return \Core\Entity\EntityInterface |
|
183 | 183 | */ |
184 | 184 | protected function getCollection() |
185 | 185 | { |
@@ -80,12 +80,12 @@ |
||
80 | 80 | $collection[] = $this->newEntry; |
81 | 81 | $form = $this->buildForm($key, $this->newEntry); |
82 | 82 | $eventManager = $form->getEventManager(); |
83 | - $eventManager->attach(CoreForm::EVENT_IS_VALID, function (Event $event) use ($collection) { |
|
83 | + $eventManager->attach(CoreForm::EVENT_IS_VALID, function(Event $event) use ($collection) { |
|
84 | 84 | if (!$event->getParam('isValid')) { |
85 | 85 | $collection->removeElement($this->newEntry); |
86 | 86 | } |
87 | 87 | }); |
88 | - $eventManager->attach(CoreForm::EVENT_PREPARE, function (Event $event) use ($collection) { |
|
88 | + $eventManager->attach(CoreForm::EVENT_PREPARE, function(Event $event) use ($collection) { |
|
89 | 89 | $this->setupForm($event->getTarget(), $collection->indexOf($this->newEntry)); |
90 | 90 | }); |
91 | 91 |
@@ -98,7 +98,7 @@ |
||
98 | 98 | /** |
99 | 99 | * Gets an iterator to iterate over the enabled formulars. |
100 | 100 | * |
101 | - * @return \ArrayIterator |
|
101 | + * @return PriorityList |
|
102 | 102 | * @see IteratorAggregate::getIterator() |
103 | 103 | */ |
104 | 104 | public function getIterator() |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $formAction = $formInstance->getAttribute('action'); |
325 | 325 | |
326 | 326 | if (empty($formAction)) { |
327 | - $formInstance->setAttribute('action', '?form=' . $formName); |
|
327 | + $formInstance->setAttribute('action', '?form='.$formName); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | // @TODO: [ZF3] which one is correct? $form[options][label] or $form[options] |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | $spec->setParent($this); |
397 | 397 | } |
398 | 398 | |
399 | - $spec = [ '__instance__' => $spec, 'name' => $key, 'entity' => '*' ]; |
|
399 | + $spec = ['__instance__' => $spec, 'name' => $key, 'entity' => '*']; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | if (!is_array($spec)) { |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | } |
516 | 516 | $this->activeForms = array_filter( |
517 | 517 | $this->activeForms, |
518 | - function ($item) use ($key) { |
|
518 | + function($item) use ($key) { |
|
519 | 519 | return !in_array($item, $key); |
520 | 520 | } |
521 | 521 | ); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * @throws \InvalidArgumentException |
530 | 530 | * @return Container |
531 | 531 | */ |
532 | - public function setEntity($entity, $key='*') |
|
532 | + public function setEntity($entity, $key = '*') |
|
533 | 533 | { |
534 | 534 | if (!$entity instanceof EntityInterface) { |
535 | 535 | throw new \InvalidArgumentException(sprintf('$entity must be instance of %s', EntityInterface::class)); |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | * |
552 | 552 | * @return \Core\Entity\EntityInterface |
553 | 553 | */ |
554 | - public function getEntity($key='*') |
|
554 | + public function getEntity($key = '*') |
|
555 | 555 | { |
556 | 556 | return isset($this->entities[$key]) ? $this->entities[$key] : null; |
557 | 557 | } |
@@ -753,10 +753,10 @@ discard block |
||
753 | 753 | $actualKey = $this->getActiveFormActual(); |
754 | 754 | if (isset($actualKey)) { |
755 | 755 | $forms = array_keys($this->forms); |
756 | - $formsFlip = array_flip($forms); |
|
756 | + $formsFlip = array_flip($forms); |
|
757 | 757 | $index = $formsFlip[$actualKey]; |
758 | 758 | if (0 < $index) { |
759 | - $key = $forms[$index-1]; |
|
759 | + $key = $forms[$index - 1]; |
|
760 | 760 | } |
761 | 761 | } |
762 | 762 | return $key; |
@@ -773,10 +773,10 @@ discard block |
||
773 | 773 | $actualKey = $this->getActiveFormActual(); |
774 | 774 | if (isset($actualKey)) { |
775 | 775 | $forms = array_keys($this->forms); |
776 | - $formsFlip = array_flip($forms); |
|
776 | + $formsFlip = array_flip($forms); |
|
777 | 777 | $index = $formsFlip[$actualKey]; |
778 | 778 | if ($index < count($forms) - 1) { |
779 | - $key = $forms[$index+1]; |
|
779 | + $key = $forms[$index + 1]; |
|
780 | 780 | } |
781 | 781 | } |
782 | 782 | return $key; |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | */ |
791 | 791 | public function formatAction($name) |
792 | 792 | { |
793 | - return sprintf('%s%s', $this->hasParent() ? $this->getName() . '.' : '', $name); |
|
793 | + return sprintf('%s%s', $this->hasParent() ? $this->getName().'.' : '', $name); |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | /** |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | public function getActionFor($key) |
801 | 801 | { |
802 | 802 | if (isset($this->forms[$key])) { |
803 | - return '?form=' . $this->formatAction($this->forms[$key]['name']); |
|
803 | + return '?form='.$this->formatAction($this->forms[$key]['name']); |
|
804 | 804 | } |
805 | 805 | } |
806 | 806 | } |
@@ -77,6 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @param string $description |
80 | + * @param double[] $params |
|
80 | 81 | * |
81 | 82 | * @return $this |
82 | 83 | */ |
@@ -258,7 +259,7 @@ discard block |
||
258 | 259 | } |
259 | 260 | |
260 | 261 | /** |
261 | - * @param $spec |
|
262 | + * @param string $spec |
|
262 | 263 | * |
263 | 264 | * @return $this |
264 | 265 | */ |
@@ -25,8 +25,8 @@ |
||
25 | 25 | */ |
26 | 26 | class Form extends ZendForm implements |
27 | 27 | DescriptionAwareFormInterface, |
28 | - DisableElementsCapableInterface, |
|
29 | - FormParentInterface |
|
28 | + DisableElementsCapableInterface, |
|
29 | + FormParentInterface |
|
30 | 30 | { |
31 | 31 | use EventManagerAwareTrait, HydratorStrategyAwareTrait; |
32 | 32 |
@@ -368,9 +368,9 @@ |
||
368 | 368 | if (!$inputExists && $required) { |
369 | 369 | $fieldsetName = ''; |
370 | 370 | if ($fieldset->hasAttribute('name')) { |
371 | - $fieldsetName = 'in Fieldset "' . $fieldset->getAttribute('name') . '" '; |
|
371 | + $fieldsetName = 'in Fieldset "'.$fieldset->getAttribute('name').'" '; |
|
372 | 372 | } |
373 | - throw new \RuntimeException('input for "' . $name . '" ' . $fieldsetName . 'is required but a input-field with this name is not defined'); |
|
373 | + throw new \RuntimeException('input for "'.$name.'" '.$fieldsetName.'is required but a input-field with this name is not defined'); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | } |
@@ -97,7 +97,7 @@ |
||
97 | 97 | /** |
98 | 98 | * Set the allow multiple selections flag. |
99 | 99 | * |
100 | - * @param Callable|bool $flagOrCallback When a Callable is passed, it must return bool. |
|
100 | + * @param \Closure $flagOrCallback When a Callable is passed, it must return bool. |
|
101 | 101 | * |
102 | 102 | * @return self |
103 | 103 | */ |
@@ -222,7 +222,7 @@ |
||
222 | 222 | */ |
223 | 223 | private function findLeaf(NodeInterface $leaf, $value) |
224 | 224 | { |
225 | - $parts = is_array($value) ? $value : explode($this->shouldUseNames() ? ' | ': '-', $value); |
|
225 | + $parts = is_array($value) ? $value : explode($this->shouldUseNames() ? ' | ' : '-', $value); |
|
226 | 226 | $value = array_shift($parts); |
227 | 227 | |
228 | 228 | /* @var NodeInterface $item */ |
@@ -93,7 +93,7 @@ |
||
93 | 93 | * @param array $data Form values |
94 | 94 | * @param Collection $object |
95 | 95 | * |
96 | - * @return object |
|
96 | + * @return NodeInterface |
|
97 | 97 | */ |
98 | 98 | public function hydrate(array $data, $object) |
99 | 99 | { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $data = []; |
54 | 54 | $this->flattenTree($object, $data); |
55 | 55 | |
56 | - return ['items' => $data ]; |
|
56 | + return ['items' => $data]; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | if ($tree->hasChildren()) { |
79 | 79 | foreach ($tree->getChildren() as $i => $child) { |
80 | - $this->flattenTree($child, $data, $curId . '-' . ($i + 1)); |
|
80 | + $this->flattenTree($child, $data, $curId.'-'.($i + 1)); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * unflatten tree |
115 | 115 | */ |
116 | 116 | $items = $data['items']; |
117 | - $tree = [ '__root__' => array_shift($items) ]; |
|
117 | + $tree = ['__root__' => array_shift($items)]; |
|
118 | 118 | |
119 | 119 | foreach ($items as $item) { |
120 | 120 | $parent = substr($item['current'], 0, strrpos($item['current'], '-')); |
@@ -47,6 +47,9 @@ discard block |
||
47 | 47 | $this->buttonsIterator->isLIFO(false); |
48 | 48 | } |
49 | 49 | |
50 | + /** |
|
51 | + * @param string $name |
|
52 | + */ |
|
50 | 53 | public function setButtonElement($name) |
51 | 54 | { |
52 | 55 | return $this->setOption('button_element', $name); |
@@ -182,6 +185,9 @@ discard block |
||
182 | 185 | return $this->buttonsIterator; |
183 | 186 | } |
184 | 187 | |
188 | + /** |
|
189 | + * @param string $name |
|
190 | + */ |
|
185 | 191 | public function addButton($name, $priority = 0, $type = 'button') |
186 | 192 | { |
187 | 193 | if (is_array($name)) { |
@@ -167,7 +167,7 @@ |
||
167 | 167 | 'label' => $label, |
168 | 168 | ], |
169 | 169 | 'attributes' => [ |
170 | - 'class' => 'btn btn-' . ('submit' == $type ? 'primary' : 'default'), |
|
170 | + 'class' => 'btn btn-'.('submit' == $type ? 'primary' : 'default'), |
|
171 | 171 | 'type' => $type, |
172 | 172 | ], |
173 | 173 | ] |