benchmark/TerrainGenerator.php 1 location
|
@@ 43-50 (lines=8) @@
|
| 40 |
|
} |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
private function validateOptionalInteger($number) |
| 44 |
|
{ |
| 45 |
|
$integer = filter_var($number, FILTER_VALIDATE_INT); |
| 46 |
|
|
| 47 |
|
if ($integer === false && $number !== null) { |
| 48 |
|
throw new \InvalidArgumentException('Invalid integer: ' . print_r($number, true)); |
| 49 |
|
} |
| 50 |
|
} |
| 51 |
|
} |
| 52 |
|
|
examples/Graph/MyNode.php 1 location
|
@@ 55-64 (lines=10) @@
|
| 52 |
|
return $this->x . 'x' . $this->y; |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
private function filterInteger($value) |
| 56 |
|
{ |
| 57 |
|
$integer = filter_var($value, FILTER_VALIDATE_INT); |
| 58 |
|
|
| 59 |
|
if ($integer === false) { |
| 60 |
|
throw new \InvalidArgumentException('Invalid integer: ' . print_r($value, true)); |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
return $integer; |
| 64 |
|
} |
| 65 |
|
} |
| 66 |
|
|