Completed
Pull Request — develop (#509)
by ANTHONIUS
21:03
created
module/Core/src/Form/CollectionContainer.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,12 +80,12 @@
 block discarded – undo
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
             
Please login to merge, or discard this patch.
module/Core/src/Form/Container.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
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()
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
module/Core/src/Form/Form.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,6 +77,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
258 259
     }
259 260
 
260 261
     /**
261
-     * @param $spec
262
+     * @param string $spec
262 263
      *
263 264
      * @return $this
264 265
      */
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
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
     
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -368,9 +368,9 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
module/Core/src/Form/Hydrator/Strategy/TreeSelectStrategy.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
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
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -222,7 +222,7 @@
 block discarded – undo
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 */
Please login to merge, or discard this patch.
module/Core/src/Form/Hydrator/TreeHydrator.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'], '-'));
Please login to merge, or discard this patch.
module/Core/src/Form/SearchForm.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@
 block discarded – undo
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
             ]
Please login to merge, or discard this patch.
module/Core/src/Form/View/Helper/FormContainer.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -74,6 +74,9 @@
 block discarded – undo
74 74
         return $content;
75 75
     }
76 76
 
77
+    /**
78
+     * @param string $layout
79
+     */
77 80
     public function renderElement($element, $layout, $parameter)
78 81
     {
79 82
         $parameterPartial = $parameter;
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@
 block discarded – undo
84 84
         if ($element instanceof ViewPartialProviderInterface) {
85 85
             $parameterPartial = array_merge(array('element' => $element, 'layout' => $layout), $parameterPartial);
86 86
             $content .= $this->getView()->partial(
87
-                             $element->getViewPartial(),
88
-                             $parameterPartial
87
+                                $element->getViewPartial(),
88
+                                $parameterPartial
89 89
             );
90 90
         } elseif ($element instanceof ViewHelperProviderInterface) {
91 91
             $helper = $element->getViewHelper();
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         }
65 65
 
66 66
         if (isset($parameter['render_label']) && $parameter['render_label'] && ($label = $container->getLabel())) {
67
-            $content .= '<div class="container-headline"><h3>' . $this->getView()->translate($label) . '</h3></div>';
67
+            $content .= '<div class="container-headline"><h3>'.$this->getView()->translate($label).'</h3></div>';
68 68
         }
69 69
         foreach ($container as $element) {
70 70
             $content .= $this->renderElement($element, $layout, $parameter);
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
         } elseif ($element instanceof CoreSummaryForm) {
100 100
             $content .= $this->getView()->summaryForm($element);
101 101
         } elseif ($element instanceof Container) {
102
-            $content.= $this->render($element, $layout, $parameter);
102
+            $content .= $this->render($element, $layout, $parameter);
103 103
         } else {
104
-            $content.= $this->getView()->form($element, $layout, $parameter);
104
+            $content .= $this->getView()->form($element, $layout, $parameter);
105 105
         }
106 106
 
107 107
         return $content;
Please login to merge, or discard this patch.
module/Core/src/Form/View/Helper/FormRowCombined.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      *
74 74
      * Proxies to {@link render()}.
75 75
      *
76
-     * @param null|ElementInterface $element
76
+     * @param null|ElementInterface $elements
77 77
      * @param null|string           $labelPosition
78 78
      * @param bool                  $renderErrors
79 79
      * @return string|FormRow
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
         
63 63
         
64 64
         return sprintf(
65
-            '<div class="controls controls-row ' . $form_row_class . '">%s%s</div>',
65
+            '<div class="controls controls-row '.$form_row_class.'">%s%s</div>',
66 66
             $labelMarkup,
67 67
             $markups
68 68
         );
Please login to merge, or discard this patch.
module/Core/src/Form/View/Helper/SearchForm.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -88,6 +88,11 @@
 block discarded – undo
88 88
         return $content;
89 89
     }
90 90
 
91
+    /**
92
+     * @param FormInterface $form
93
+     *
94
+     * @return null|FormInterface
95
+     */
91 96
     public function renderElements($form, $colMap = null, $buttonsSpan = null)
92 97
     {
93 98
         if ($form instanceof ViewPartialProviderInterface) {
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
         $content = $this->renderElements($form, $colMap, $buttonsSpan);
68 68
 
69 69
         return $this->openTag($form)
70
-             . '<div class="row" style="padding: 0 15px;">'
71
-             . $content . '</div>' . $this->closeTag();
70
+                . '<div class="row" style="padding: 0 15px;">'
71
+                . $content . '</div>' . $this->closeTag();
72 72
     }
73 73
 
74 74
     public function renderButtons($buttons)
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
             $attrs = $helper->createAttributesString($button->getAttributes());
82 82
 
83 83
             $content.= '<button ' . $attrs . '>'
84
-                       . $this->getTranslator()->translate($button->getLabel(), $this->getTranslatorTextDomain())
85
-                       . '</button>';
84
+                        . $this->getTranslator()->translate($button->getLabel(), $this->getTranslatorTextDomain())
85
+                        . '</button>';
86 86
         }
87 87
 
88 88
         return $content;
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 
119 119
             if ($element->getName() == $form->getButtonElement()) {
120 120
                 $content.='<div class="input-group col-md-' . $cols . '">'
121
-                              . $formElement($element)
122
-                              . '<div class="input-group-btn search-form-buttons" style="width: 1px;">'
123
-                              . $this->renderButtons($form->getButtons()) . '</div>'
124
-                              . '</div>';
121
+                                . $formElement($element)
122
+                                . '<div class="input-group-btn search-form-buttons" style="width: 1px;">'
123
+                                . $this->renderButtons($form->getButtons()) . '</div>'
124
+                                . '</div>';
125 125
                 $buttonsRendered = true;
126 126
             } else {
127 127
                 $content .= '<div class="input-group col-md-' . $cols . '">'
128
-                          . $formElement($element)
129
-                          . '</div>';
128
+                            . $formElement($element)
129
+                            . '</div>';
130 130
             }
131 131
 
132 132
             $i += 1;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                 $buttonsSpan = $form->getOption('buttons_span') ?: 12;
138 138
             }
139 139
             $content .= '<div class="input-group search-form-buttons col-md-' . $buttonsSpan . ' text-right">'
140
-                      . '<div class="btn-group">' . $this->renderButtons($form->getButtons()) .'</div></div>';
140
+                        . '<div class="btn-group">' . $this->renderButtons($form->getButtons()) .'</div></div>';
141 141
         }
142 142
 
143 143
         return $content;
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @param array $colMap
36 36
      * @return Form|string
37 37
      */
38
-    public function __invoke(FormInterface $form = null, $colMap=null)
38
+    public function __invoke(FormInterface $form = null, $colMap = null)
39 39
     {
40 40
         if (!$form) {
41 41
             return $this;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         return $this->render($form, $colMap);
45 45
     }
46 46
 
47
-    public function render(FormInterface $form, $colMap=null, $buttonsSpan = null)
47
+    public function render(FormInterface $form, $colMap = null, $buttonsSpan = null)
48 48
     {
49 49
         $headscript = $this->getView()->plugin('headscript');
50 50
         $basepath   = $this->getView()->plugin('basepath');
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
         $form->prepare();
62 62
 
63 63
         if ($form instanceof ViewPartialProviderInterface) {
64
-            return $this->getView()->partial($form->getViewPartial(), [ 'element' => $form, 'colMap' => $colMap, 'buttonsSpan' => $buttonsSpan ]);
64
+            return $this->getView()->partial($form->getViewPartial(), ['element' => $form, 'colMap' => $colMap, 'buttonsSpan' => $buttonsSpan]);
65 65
         }
66 66
 
67 67
         $content = $this->renderElements($form, $colMap, $buttonsSpan);
68 68
 
69 69
         return $this->openTag($form)
70 70
              . '<div class="row" style="padding: 0 15px;">'
71
-             . $content . '</div>' . $this->closeTag();
71
+             . $content.'</div>'.$this->closeTag();
72 72
     }
73 73
 
74 74
     public function renderButtons($buttons)
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             $button->removeAttribute('name');
81 81
             $attrs = $helper->createAttributesString($button->getAttributes());
82 82
 
83
-            $content.= '<button ' . $attrs . '>'
83
+            $content .= '<button '.$attrs.'>'
84 84
                        . $this->getTranslator()->translate($button->getLabel(), $this->getTranslatorTextDomain())
85 85
                        . '</button>';
86 86
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public function renderElements($form, $colMap = null, $buttonsSpan = null)
92 92
     {
93 93
         if ($form instanceof ViewPartialProviderInterface) {
94
-            return $this->getView()->partial($form->getViewPartial(), [ 'element' => $form, 'colMap' => $colMap, 'buttonsSpan' => $buttonsSpan ]);
94
+            return $this->getView()->partial($form->getViewPartial(), ['element' => $form, 'colMap' => $colMap, 'buttonsSpan' => $buttonsSpan]);
95 95
         }
96 96
 
97 97
         if (null === $colMap) {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $formElement = $this->getView()->plugin('formElement');
102 102
         $content = '';
103 103
         $buttonsRendered = false;
104
-        $i=0;
104
+        $i = 0;
105 105
         foreach ($form as $element) {
106 106
             if ($element instanceof Hidden) {
107 107
                 $content .= $formElement($element);
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
             }
118 118
 
119 119
             if ($element->getName() == $form->getButtonElement()) {
120
-                $content.='<div class="input-group col-md-' . $cols . '">'
120
+                $content .= '<div class="input-group col-md-'.$cols.'">'
121 121
                               . $formElement($element)
122 122
                               . '<div class="input-group-btn search-form-buttons" style="width: 1px;">'
123
-                              . $this->renderButtons($form->getButtons()) . '</div>'
123
+                              . $this->renderButtons($form->getButtons()).'</div>'
124 124
                               . '</div>';
125 125
                 $buttonsRendered = true;
126 126
             } else {
127
-                $content .= '<div class="input-group col-md-' . $cols . '">'
127
+                $content .= '<div class="input-group col-md-'.$cols.'">'
128 128
                           . $formElement($element)
129 129
                           . '</div>';
130 130
             }
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
             if (null === $buttonsSpan) {
137 137
                 $buttonsSpan = $form->getOption('buttons_span') ?: 12;
138 138
             }
139
-            $content .= '<div class="input-group search-form-buttons col-md-' . $buttonsSpan . ' text-right">'
140
-                      . '<div class="btn-group">' . $this->renderButtons($form->getButtons()) .'</div></div>';
139
+            $content .= '<div class="input-group search-form-buttons col-md-'.$buttonsSpan.' text-right">'
140
+                      . '<div class="btn-group">'.$this->renderButtons($form->getButtons()).'</div></div>';
141 141
         }
142 142
 
143 143
         return $content;
Please login to merge, or discard this patch.