Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 11 |
Ratio | 100 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
50 | 14 | View Code Duplication | public function getElement($offset) |
51 | { |
||
52 | 14 | if (!array_key_exists($offset, $this->elements)) { |
|
53 | 4 | throw new \InvalidArgumentException(sprintf( |
|
54 | 4 | 'There is no element in this vector with that offset: %s', |
|
55 | $offset |
||
56 | 4 | )); |
|
57 | } |
||
58 | |||
59 | 10 | return $this->elements[$offset]; |
|
60 | } |
||
61 | |||
89 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: