Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 11 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
50 | View Code Duplication | public function getElement($offset) |
|
51 | { |
||
52 | if (!array_key_exists($offset, $this->elements)) { |
||
53 | throw new \InvalidArgumentException(sprintf( |
||
54 | 'There is no element in this vector with that offset: %s', |
||
55 | $offset |
||
56 | )); |
||
57 | } |
||
58 | |||
59 | return $this->elements[$offset]; |
||
60 | } |
||
61 | |||
70 |
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: