Passed
Push — develop ( 38ffd9...9f7101 )
by Jens
31:57 queued 05:22
created

CustomerIdTrait::byCustomerId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request;
7
8
use Commercetools\Core\Request\Query\Parameter;
9
use Commercetools\Core\Request\Query\ParameterInterface;
10
11
/**
12
 * @package Commercetools\Core\Request
13
 */
14
trait CustomerIdTrait
15
{
16
    /**
17
     * @param ParameterInterface $param
18
     * @return $this
19
     */
20
    abstract public function addParamObject(ParameterInterface $param);
21
22
    public function byCustomerId($customerId)
23
    {
24
        if (!is_null($customerId)) {
25
            $this->addParamObject(new Parameter('customerId', $customerId));
26
        }
27
28
        return $this;
29
    }
30
}
31