Test Failed
Push — master ( 306f11...77481f )
by Fran
14:04
created

Field::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 7
dl 0
loc 9
ccs 0
cts 8
cp 0
crap 2
rs 10
1
<?php
2
3
namespace PSFS\base\dto;
4
5
/**
6
 * Class Field
7
 * @package PSFS\base\dto
8
 */
9
class Field extends Dto
10
{
11
    const TEXT_TYPE = 'text';
12
    const PHONE_TYPE = 'tel';
13
    const URL_TYPE = 'url';
14
    const CHECK_TYPE = 'checkbox';
15
    const RADIO_TYPE = 'radio';
16
    const COMBO_TYPE = 'select';
17
    const TEXTAREA_TYPE = 'textarea';
18
    const SEARCH_TYPE = 'search';
19
    const HIDDEN_TYPE = 'hidden';
20
    const NUMBER_TYPE = 'number';
21
    const SWITCH_TYPE = 'switch';
22
    const PASSWORD_FIELD = 'password';
23
    const DATE = 'date';
24
    const TIMESTAMP = 'timestamp';
25
26
    /**
27
     * @var string label
28
     */
29
    public $label;
30
    /**
31
     * @var string name
32
     */
33
    public $name;
34
    /**
35
     * @var string type
36
     */
37
    public $type = Field::TEXT_TYPE;
38
    /**
39
     * @var array data
40
     */
41
    public $data = array();
42
    /**
43
     * @var string url
44
     */
45
    public $url;
46
    /**
47
     * @var Object value
48
     */
49
    public $value;
50
    /**
51
     * @var bool required
52
     */
53
    public $required = true;
54
    /**
55
     * @var string entity
56
     */
57
    public $entity;
58
    /**
59
     * @var bool readonly
60
     */
61
    public $readonly = false;
62
    /**
63
     * @var bool pk
64
     */
65
    public $pk = false;
66
    /**
67
     * @var string
68
     */
69
    public $relatedField;
70
    /**
71
     * @var integer
72
     */
73
    public $size;
74
75
    public function __construct($name, $label, $type = self::TEXT_TYPE, $value = null, $data = array(), $url = null, $required = true)
76
    {
77
        $this->name = $name;
78
        $this->label = $label;
79
        $this->type = $type;
80
        $this->value = $value;
81
        $this->data = $data;
82
        $this->url = $url;
83
        $this->required = $required;
84
    }
85
}
86