| Conditions | 7 |
| Paths | 12 |
| Total Lines | 17 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | 8 | public function setDefaultLocation($tournament, $latitude, $longitude) |
|
| 41 | { |
||
| 42 | 8 | $userLat = $tournament != null ? $tournament->owner->latitude : null; |
|
| 43 | 8 | $userLng = $tournament != null ? $tournament->owner->longitude : null; |
|
| 44 | |||
| 45 | 8 | if ($latitude != null && $longitude != null) { |
|
| 46 | 6 | $this->latitude = $latitude; |
|
| 47 | 6 | $this->longitude = $longitude; |
|
| 48 | 7 | } else if (!isNullOrEmptyString($userLat) && !isNullOrEmptyString($userLng)) { |
|
| 49 | 6 | $this->latitude = $userLat; |
|
| 50 | 6 | $this->longitude = $userLng; |
|
| 51 | } else { |
||
| 52 | //TODO Should popup for user localization |
||
| 53 | 1 | $this->latitude = 0; |
|
| 54 | 1 | $this->longitude = 0; |
|
| 55 | } |
||
| 56 | 8 | return $this; |
|
| 57 | } |
||
| 59 |