Completed
Push — master ( d1d08c...570c1f )
by Carsten
11:09 queued 05:42
created

SalesmanAbstract   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 116
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
lcom 2
cbo 2
dl 0
loc 116
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __debugInfo() 0 9 1
A getFirstName() 0 4 1
A getLastName() 0 4 1
A getEmail() 0 4 1
A getUserId() 0 3 1
A isActive() 0 3 1
A getFullName() 0 7 1
A getDisplayName() 0 7 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
    public function getFirstName()
56
    {
57
        return $this->first_name;
58
    }
59
60
61
    /**
62
     * @return string
63
     */
64
    public function getLastName()
65
    {
66
        return $this->last_name;
67
    }
68
69
70
    /**
71
     * @return string
72
     */
73
    public function getEmail()
74
    {
75
        return $this->email;
76
    }
77
78
79
    /**
80
     * @return string
81
     */
82
    public function getUserId() {
83
        return $this->user_id;
84
    }
85
86
87
    /**
88
     * @return bool
89
     */
90
    public function isActive() {
91
        return (bool) ((int) $this->is_active > 0);
92
    }
93
94
95
    /**
96
     * @return string
97
     */
98
    public function getFullName()
99
    {
100
        return trim( join(" ", array_filter([
101
            $this->getFirstName(),
102
            $this->getLastName()
103
        ])));
104
    }
105
106
107
    /**
108
     * @return string
109
     */
110
    public function getDisplayName()
111
    {
112
        return trim( join(" ∙ ", array_filter([
113
            $this->getFullName(),
114
            $this->getSalesmanId()
115
        ])));
116
    }
117
118
119
120
121
}
122