ContactList::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Mailxpert\Model;
4
5
/**
6
 * Date: 19/08/15
7
 */
8
class ContactList
9
{
10
    /**
11
     * @var string $id
12
     */
13
    protected $id;
14
15
    /**
16
     * @var string $name
17
     */
18
    protected $name;
19
20
    /**
21
     * @var bool $default
22
     */
23
    protected $default = false;
24
25
    /**
26
     * ContactList constructor.
27
     *
28
     * @param string $id
29
     * @param string $name
30
     * @param bool   $default
31
     */
32
    public function __construct($id, $name, $default)
33
    {
34
        $this->id = $id;
35
        $this->name = $name;
36
        $this->default = $default;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function __toString()
43
    {
44
        return (string) $this->getName();
45
    }
46
47
48
    /**
49
     * @return string
50
     */
51
    public function getId()
52
    {
53
        return $this->id;
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getName()
60
    {
61
        return $this->name;
62
    }
63
64
    /**
65
     * @return boolean
66
     */
67
    public function isDefault()
68
    {
69
        return $this->default;
70
    }
71
72
    /**
73
     * @return array
74
     */
75
    public function toAPI()
76
    {
77
        return [
78
            'name' => $this->getName(),
79
        ];
80
    }
81
}
82