Passed
Push — master ( 6f914d...48f229 )
by Tõnis
03:00
created

Address::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace tonisormisson\addressform\models;
3
4
use yii\base\Model;
5
use Yii;
6
7
/**
8
 * Class Address
9
 * @package tonisormisson\addressform\models
10
 * @author Tõnis Ormisson <[email protected]>
11
 */
12
class Address extends Model
13
{
14
    /** @var string */
15
    public $name;
16
17
    /** @var string $country 2-letter iso code*/
18
    public $country;
19
20
    /** @var string $state*/
21
    public $state;
22
23
    /** @var string $city*/
24
    public $city;
25
26
    /** @var string $postCode*/
27
    public $postCode;
28
29
    /** @var string $addressLine1 */
30
    public $addressLine1;
31
32
    /** @var string $addressLine2 */
33
    public $addressLine2;
34
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function rules()
40
    {
41
        return [
42
            [['name', 'country', 'state', 'postCode', 'city', 'addressLine1', 'addressLine2', 'state'], 'required'],
43
        ];
44
    }
45
46
    public function attributeLabels()
47
    {
48
        return [
49
            'name' => Yii::t("addressform", "Name"),
50
            'country' => Yii::t("addressform", "Country"),
51
            'state' => Yii::t("addressform", "State"),
52
            'city' => Yii::t("addressform", "City"),
53
            'postCode' => Yii::t("addressform", "Post Code"),
54
            'addressLine1' => Yii::t("addressform", "Street address"),
55
            'addressLine2' => Yii::t("addressform", "Section, floor, etc."),
56
57
        ];
58
    }
59
60
61
}