Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
54 | 4 | public function equals($operatingSystem): bool |
|
55 | { |
||
56 | 4 | if ($operatingSystem instanceof OperatingSystem) { |
|
57 | 1 | $name = $operatingSystem->getName(); |
|
58 | 3 | } elseif (is_string($operatingSystem)) { |
|
59 | 2 | $name = $operatingSystem; |
|
60 | } else { |
||
61 | 1 | throw new \InvalidArgumentException( |
|
62 | 1 | 'Invalid argument given. Expected argument are string or ' . OperatingSystem::class |
|
63 | ); |
||
64 | } |
||
65 | |||
66 | 3 | return strtoupper($this->getName()) === strtoupper($name); |
|
67 | } |
||
68 | } |
||
69 |