Passed
Push — master ( e3c67b...98eade )
by Fran
08:10
created

Field::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

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