| @@ 8-39 (lines=32) @@ | ||
| 5 | use Phine\Country\CountryInterface; |
|
| 6 | use Phine\Country\SubdivisionInterface; |
|
| 7 | ||
| 8 | class LocationWithStateAndCity extends LocationWithState implements LocationInterface |
|
| 9 | { |
|
| 10 | ||
| 11 | /** |
|
| 12 | * @var string |
|
| 13 | */ |
|
| 14 | private $city; |
|
| 15 | ||
| 16 | public function __construct(CountryInterface $country, SubdivisionInterface $state, $city) |
|
| 17 | { |
|
| 18 | parent::__construct($country, $state); |
|
| 19 | ||
| 20 | $this->city = $city; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @return string |
|
| 25 | */ |
|
| 26 | public function getCity() : string |
|
| 27 | { |
|
| 28 | return $this->city; |
|
| 29 | } |
|
| 30 | ||
| 31 | /* LocationInterface */ |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return string |
|
| 35 | */ |
|
| 36 | public function getLocation() : string |
|
| 37 | { |
|
| 38 | return $this->city . ' - ' . parent::getLocation(); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| @@ 8-39 (lines=32) @@ | ||
| 5 | use Phine\Country\CountryInterface; |
|
| 6 | use Phine\Country\SubdivisionInterface; |
|
| 7 | ||
| 8 | class LocationWithState extends Location implements LocationInterface |
|
| 9 | { |
|
| 10 | ||
| 11 | /** |
|
| 12 | * @var SubdivisionInterface |
|
| 13 | */ |
|
| 14 | private $state; |
|
| 15 | ||
| 16 | public function __construct(CountryInterface $country, SubdivisionInterface $state) |
|
| 17 | { |
|
| 18 | parent::__construct($country); |
|
| 19 | ||
| 20 | $this->state = $state; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @return SubdivisionInterface |
|
| 25 | */ |
|
| 26 | public function getState() : SubdivisionInterface |
|
| 27 | { |
|
| 28 | return $this->state; |
|
| 29 | } |
|
| 30 | ||
| 31 | /* LocationInterface */ |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return string |
|
| 35 | */ |
|
| 36 | public function getLocation() : string |
|
| 37 | { |
|
| 38 | return $this->state->getCode(); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||