@@ 7-37 (lines=31) @@ | ||
4 | ||
5 | use Arthem\GoogleApi\Domain\Place\Exception\InvalidPlaceIdException; |
|
6 | ||
7 | class PlaceId |
|
8 | { |
|
9 | /** |
|
10 | * @var string |
|
11 | */ |
|
12 | private $id; |
|
13 | ||
14 | /** |
|
15 | * @param string $id |
|
16 | */ |
|
17 | public function __construct($id) |
|
18 | { |
|
19 | if (!is_string($id)) { |
|
20 | throw new InvalidPlaceIdException(sprintf('PlaceId must be a string, got %s', gettype($id))); |
|
21 | } |
|
22 | ||
23 | if (empty($id)) { |
|
24 | throw new InvalidPlaceIdException('PlaceId must not be empty'); |
|
25 | } |
|
26 | ||
27 | $this->id = $id; |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * @return string |
|
32 | */ |
|
33 | public function getId() |
|
34 | { |
|
35 | return $this->id; |
|
36 | } |
|
37 | } |
|
38 |
@@ 7-37 (lines=31) @@ | ||
4 | ||
5 | use Arthem\GoogleApi\Domain\Place\Exception\InvalidPlaceNameException; |
|
6 | ||
7 | class PlaceName |
|
8 | { |
|
9 | /** |
|
10 | * @var string |
|
11 | */ |
|
12 | private $name; |
|
13 | ||
14 | /** |
|
15 | * @param string $name |
|
16 | */ |
|
17 | public function __construct($name) |
|
18 | { |
|
19 | if (!is_string($name)) { |
|
20 | throw new InvalidPlaceNameException(sprintf('PlaceName must be a string, got %s', gettype($name))); |
|
21 | } |
|
22 | ||
23 | if (empty($name)) { |
|
24 | throw new InvalidPlaceNameException('PlaceName must not be empty'); |
|
25 | } |
|
26 | ||
27 | $this->name = $name; |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * @return string |
|
32 | */ |
|
33 | public function getName() |
|
34 | { |
|
35 | return $this->name; |
|
36 | } |
|
37 | } |
|
38 |