Passed
Push — develop ( c94872...d5c6f2 )
by Carsten
03:43
created

SalesmanAbstract::getLastName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace Germania\Salesmen;
3
4
use Germania\Retailers\RetailerNumberAwareTrait;
5
6
class SalesmanAbstract implements SalesmanInterface
7
{
8
    use RetailerNumberAwareTrait,
9
        SalesmanIdAwareTrait;
10
11
    /**
12
     * @var string
13
     */
14
    public $first_name;
15
16
    /**
17
     * @var string
18
     */
19
    public $last_name;
20
21
    /**
22
     * @var string
23
     */
24
    public $email;
25
26
    /**
27
     * @var int
28
     */
29
    public $user_id;
30
31
    /**
32
     * @var int
33
     */
34
    public $is_active;
35
36
37
38
    /**
39
     * @return array
40
     */
41
    public function __debugInfo() {
42
        return [
43
            'SalesmanID' => $this->getSalesmanId(),
44
            'FullName'   => $this->getFullName(),
45
            'Email'      => $this->getEmail(),
46
            'isActive'   => $this->isActive(),
47
            'UserID'     => $this->getUserId()
48
        ];
49
    }
50
51
52
    /**
53
     * @return string
54
     */
55 4
    public function getFirstName()
56
    {
57 4
        return $this->first_name;
58
    }
59
60
61
    /**
62
     * @return string
63
     */
64 4
    public function getLastName()
65
    {
66 4
        return $this->last_name;
67
    }
68
69
70
    /**
71
     * @return string
72
     */
73 4
    public function getEmail()
74
    {
75 4
        return $this->email;
76
    }
77
78
79
    /**
80
     * @return string
81
     */
82 4
    public function getUserId() {
83 4
        return $this->user_id;
84
    }
85
86
87
    /**
88
     * @return bool
89
     */
90 24
    public function isActive() {
91 24
        return (bool) ((int) $this->is_active > 0);
92
    }
93
94
95
    /**
96
     * @return string
97
     */
98 4
    public function getFullName()
99
    {
100 4
        return trim( join(" ", array_filter([
101 4
            $this->getFirstName(),
102 4
            $this->getLastName()
103
        ])));
104
    }
105
106
107
    /**
108
     * @return string
109
     */
110 4
    public function getDisplayName()
111
    {
112 4
        return trim( join(" ∙ ", array_filter([
113 4
            $this->getFullName(),
114 4
            $this->getSalesmanId()
115
        ])));
116
    }
117
118
119
120
121
}
122