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

SalesmanIdAwareTrait::setSalesmanId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 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