| Total Complexity | 6 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class Location |
||
| 15 | { |
||
| 16 | private $countryCode; |
||
| 17 | |||
| 18 | private $latitude; |
||
| 19 | |||
| 20 | private $longitude; |
||
| 21 | |||
| 22 | private $comment; |
||
| 23 | |||
| 24 | private function __construct(string $countryCode, float $latitude, float $longitude, string $comment) |
||
| 25 | { |
||
| 26 | $this->countryCode = $countryCode; |
||
| 27 | $this->latitude = $latitude; |
||
| 28 | $this->longitude = $longitude; |
||
| 29 | $this->comment = $comment; |
||
| 30 | } |
||
| 31 | |||
| 32 | public static function fromTimezone(Name $timezone) : self |
||
| 33 | { |
||
| 34 | $timezoneThief = function (Name $timezone) { |
||
| 35 | return $timezone->timezone; |
||
|
|
|||
| 36 | }; |
||
| 37 | $timezoneThief = Closure::bind($timezoneThief, null, $timezone); |
||
| 38 | $location = $timezoneThief($timezone)->getLocation(); |
||
| 39 | return new self( |
||
| 40 | $location['country_code'], |
||
| 41 | $location['latitude'], |
||
| 42 | $location['longitude'], |
||
| 43 | $location['comments'] |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function getCountryCode() : string |
||
| 50 | } |
||
| 51 | |||
| 52 | public function getLatitude() : float |
||
| 55 | } |
||
| 56 | |||
| 57 | public function getLongitude() : float |
||
| 60 | } |
||
| 61 | |||
| 62 | public function getComments() : string |
||
| 67 |