GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a6816c...6bbc5d )
by Carsten
07:55 queued 12s
created

ItemCodeInterceptorsTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 32
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setItemCode() 0 20 4
1
<?php
2
namespace Germania\Nav\ItemCodes;
3
4
use Germania\Nav\ItemCodes\Exceptions\InvalidItemCodeArgumentException;
5
6
trait ItemCodeInterceptorsTrait
7
{
8
    use ItemCodeProviderTrait;
9
10
11
    /**
12
     * Sets the Item Code.
13
     *
14
     * @var     null|ItemCodeProviderInterface $itemcode
15
     * @return  self
16
     */
17 20
    public function setItemCode( $itemcode )
18
    {
19 20
        if ($itemcode instanceOf ItemCodeProviderInterface):
20 4
            $this->itemcode = $itemcode->getItemCode();
21 16
        elseif ($itemcode instanceOf ItemCodeInterface):
22 4
            $this->itemcode = $itemcode;
23
24 12
        elseif (is_string($itemcode)):
25
            // Convert string to ItemCode instance
26 4
            $ni = new ItemCode;
27 4
            $ni->setCode( $itemcode )->setName( $itemcode );
28
29 4
            $this->itemcode = $ni;
0 ignored issues
show
Documentation Bug introduced by
It seems like $ni of type object<Germania\Nav\ItemCodes\ItemCode> is incompatible with the declared type object<Germania\Nav\Item...mCodeProviderInterface> of property $itemcode.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
30
31
        else:
32 8
            throw new InvalidItemCodeArgumentException("ItemCodeInterface or Item code string expected.");
33
        endif;
34
35 12
        return $this;
36
    }
37
}
38