DrawFormEvent::setForm()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino/WebinoDraw for the canonical source repository
6
 * @copyright   Copyright (c) 2012-2017 Webino, s. r. o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoDraw\Event;
12
13
use Zend\Form\Form;
14
use Zend\Form\FormInterface;
15
16
/**
17
 * Class DrawFormEvent
18
 */
19
class DrawFormEvent extends DrawEvent
20
{
21
    /**
22
     * @var FormInterface
23
     */
24
    protected $form;
25
26
    /**
27
     * @return FormInterface
28
     */
29
    public function getForm()
30
    {
31
        if (null === $this->form) {
32
            $this->setForm(new Form);
33
        }
34
        return $this->form;
35
    }
36
37
    /**
38
     * @param FormInterface $form
39
     * @return $this
40
     */
41
    public function setForm(FormInterface $form)
42
    {
43
        $this->setParam('form', $form);
44
        $this->form = $form;
45
        return $this;
46
    }
47
}
48