FormSimple::render()   A
last analyzed

Complexity

Conditions 4
Paths 6

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 15
c 0
b 0
f 0
ccs 0
cts 14
cp 0
rs 9.9666
cc 4
nc 6
nop 2
crap 20
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 * @author    [email protected]
9
 */
10
11
namespace Core\Form\View\Helper;
12
13
use Laminas\Form\View\Helper\Form as LaminasForm;
14
use Laminas\Form\FormInterface;
15
use Laminas\Form\FieldsetInterface;
16
use Core\Form\ViewPartialProviderInterface;
17
use Core\Form\ExplicitParameterProviderInterface;
18
use Core\Form\Element\ViewHelperProviderInterface;
19
use Core\Form\DescriptionAwareFormInterface;
20
21
class FormSimple extends LaminasForm
22
{
23
    public function __invoke(FormInterface $form = null, $parameter = array())
24
    {
25
        if (!$form) {
26
            return $this;
27
        }
28
        return $this->render($form, $parameter);
29
    }
30
31
    public function render(FormInterface $form, $parameter = array())
0 ignored issues
show
Unused Code introduced by
The parameter $parameter is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

31
    public function render(FormInterface $form, /** @scrutinizer ignore-unused */ $parameter = array())

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
    {
33
        if (method_exists($form, 'prepare')) {
34
            $form->prepare();
35
        }
36
        $formContent = '';
37
        foreach ($form as $element) {
38
            if ($element instanceof FieldsetInterface) {
39
                $formContent.= $this->getView()->formCollection($element);
0 ignored issues
show
Bug introduced by
The method formCollection() does not exist on Laminas\View\Renderer\RendererInterface. It seems like you code against a sub-type of Laminas\View\Renderer\RendererInterface such as Laminas\View\Renderer\PhpRenderer. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
                $formContent.= $this->getView()->/** @scrutinizer ignore-call */ formCollection($element);
Loading history...
40
            } else {
41
                $formContent.= $this->getView()->formRowSimple($element);
0 ignored issues
show
Bug introduced by
The method formRowSimple() does not exist on Laminas\View\Renderer\RendererInterface. It seems like you code against a sub-type of Laminas\View\Renderer\RendererInterface such as Laminas\View\Renderer\PhpRenderer. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
                $formContent.= $this->getView()->/** @scrutinizer ignore-call */ formRowSimple($element);
Loading history...
42
            }
43
        }
44
45
        return $this->openTag($form) . $formContent . $this->closeTag();
46
    }
47
}
48