Completed
Pull Request — master (#1)
by Arthur
02:19
created

Query::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Arthem\GoogleApi\Domain\Place\VO;
4
5
use Arthem\GoogleApi\Domain\Place\Exception\InvalidQueryException;
6
7
class Query
8
{
9
    /**
10
     * The text query.
11
     * eg: "pizza in New York"
12
     *
13
     * @var string
14
     */
15
    private $query;
16
17
    /**
18
     * @param string $query
19
     */
20
    public function __construct($query)
21
    {
22
        if (!is_string($query)) {
23
            throw new InvalidQueryException(sprintf('query must be a string, got %s', gettype($query)));
24
        }
25
26
        $this->query = $query;
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getQuery()
33
    {
34
        return $this->query;
35
    }
36
}
37