PlaceId::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 12
loc 12
rs 9.4285
cc 3
eloc 6
nc 3
nop 1
1
<?php
2
3
namespace Arthem\GoogleApi\Domain\Place\VO;
4
5
use Arthem\GoogleApi\Domain\Place\Exception\InvalidPlaceIdException;
6
7 View Code Duplication
class PlaceId
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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