| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 4 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 29 | 3 | public function create($name, $version) |
|
| 30 | { |
||
| 31 | 3 | $webserver = null; |
|
|
|
|||
| 32 | |||
| 33 | switch ($name) { |
||
| 34 | 3 | case 'apache': |
|
| 35 | 1 | $webserver = new ApacheWebServer($version); |
|
| 36 | 1 | break; |
|
| 37 | 2 | case 'nginx': |
|
| 38 | 1 | $webserver = new NginxWebServer($version); |
|
| 39 | 1 | break; |
|
| 40 | 1 | default: |
|
| 41 | 1 | $webserver = new NullWebServer($version); |
|
| 42 | 1 | } |
|
| 43 | |||
| 44 | 3 | return $webserver; |
|
| 45 | } |
||
| 46 | } |
||
| 47 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.