Completed
Push — master ( 01e470...0d00cc )
by Carsten
19:41 queued 11:13
created

SalesmanIdAwareTrait::setSalesmanId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
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
    public function setSalesmanId( $salesman )
15
    {
16
        if ($salesman instanceOf SalesmanIdProviderInterface):
17
            $this->salesman_id = $salesman->getSalesmanId();
18
        else:
19
            $this->salesman_id = $salesman;
20
        endif;
21
22
        return $this;
23
    }
24
}
25