Test Setup Failed
Push — master ( 4f349b...502500 )
by Carsten
05:09
created

SalesmanIdAwareTrait::setSalesmanId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
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|SalesmanProviderInterface $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