Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | 15 | public static function fromItem(Item $item) |
|
8 | { |
||
9 | 15 | switch($item->name) |
|
10 | { |
||
11 | 15 | case AgedBrieItem::ITEM_NAME: |
|
12 | 1 | return new AgedBrieItem($item); |
|
13 | break; |
||
|
|||
14 | 14 | case SulfurasItem::ITEM_NAME: |
|
15 | 2 | return new SulfurasItem($item); |
|
16 | break; |
||
17 | 12 | case BackstagePassItem::ITEM_NAME: |
|
18 | 5 | return new BackstagePassItem($item); |
|
19 | break; |
||
20 | 7 | case ConjuredItem::ITEM_NAME: |
|
21 | 4 | return new ConjuredItem($item); |
|
22 | break; |
||
23 | default: |
||
24 | 3 | return new BaseItem($item); |
|
25 | } |
||
26 | } |
||
27 | } |
||
28 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.