| Conditions | 4 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 83 | 1 | public function setItem(Item $item = null) |
|
| 84 | { |
||
| 85 | 1 | if ($this->item !== $item) { |
|
| 86 | // romove link on this item for old item |
||
| 87 | 1 | if ($this->item instanceof Item) { |
|
| 88 | 1 | $tmp = $this->item; |
|
| 89 | 1 | $this->item = null; |
|
| 90 | 1 | $tmp->removeName($this); |
|
| 91 | 1 | } |
|
| 92 | 1 | $this->item = $item; |
|
| 93 | // add link on this item |
||
| 94 | 1 | if ($item instanceof Item) { |
|
| 95 | 1 | $this->item->addName($this); |
|
| 96 | 1 | } |
|
| 97 | 1 | } |
|
| 98 | |||
| 99 | 1 | return $this; |
|
| 100 | } |
||
| 101 | |||
| 118 |