SalesmanIdAwareTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 21
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setSalesmanId() 0 10 2
1
<?php
2
namespace Germania\Salesmen;
3
4
trait SalesmanIdAwareTrait
5
{
6
    use SalesmanIdProviderTrait;
7
8
    /**
9
     * Sets the Salesman ID.
10
     *
11
     * @var     int|string|SalesmanIdProviderInterface $salesman
12
     * @return  self
13
     */
14 8
    public function setSalesmanId( $salesman )
15
    {
16 8
        if ($salesman instanceOf SalesmanIdProviderInterface):
17 4
            $this->salesman_id = $salesman->getSalesmanId();
18
        else:
19 4
            $this->salesman_id = $salesman;
20
        endif;
21
22 8
        return $this;
23
    }
24
}
25