Conditions | 6 |
Paths | 5 |
Total Lines | 23 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | public function __construct() |
||
28 | { |
||
29 | $numargs = func_num_args(); |
||
30 | if ($numargs > 2) { |
||
31 | throw new \InvalidArgumentException('Ожидалось 1 или 2 параметра'); |
||
32 | } elseif ($numargs == 2) { |
||
33 | $arg1 = func_get_arg(0); |
||
34 | $arg2 = func_get_arg(1); |
||
35 | if (is_double($arg1) && is_double($arg2)) { |
||
36 | $this->latitude = $arg1; |
||
37 | $this->longitude = $arg2; |
||
38 | $this->type = self::POINT; |
||
39 | } else { |
||
40 | throw new \InvalidArgumentException(); |
||
41 | } |
||
42 | } else { |
||
43 | $arg1 = func_get_arg(0); |
||
44 | if (is_string($arg1)) { |
||
45 | $this->address = $arg1; |
||
46 | $this->type = self::ADDRESS; |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | |||
103 |