Completed
Push — master ( 5fce14...dad0cb )
by Vinicius
03:43
created

Result::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace CViniciusSDias\GoogleCrawler;
3
4
use CViniciusSDias\GoogleCrawler\Exception\InvalidUrlException;
5
6
/**
7
 * Class that represents a Google Result
8
 *
9
 * @package CViniciussDias\GoogleCrawler
10
 * @author Vinicius Dias
11
 */
12
class Result
13
{
14
    /** @var string $title */
15
    private $title;
16
    /** @var string $url */
17
    private $url;
18
    /** @var string $description */
19
    private $description;
20
21
    /**
22
     * @return string
23
     */
24 13
    public function getTitle(): string
25
    {
26 13
        return $this->title;
27
    }
28
29
    /**
30
     * @param string $title
31
     * @return Result
32
     */
33 13
    public function setTitle(string $title): Result
34
    {
35 13
        $this->title = $title;
36 13
        return $this;
37
    }
38
39
    /**
40
     * @return string
41
     */
42 14
    public function getUrl(): string
43
    {
44 14
        return $this->url;
45
    }
46
47
    /**
48
     * @param string $url
49
     * @return Result
50
     * @throws InvalidUrlException
51
     */
52 15
    public function setUrl(string $url): Result
53
    {
54 15
        if (!filter_var($url, FILTER_VALIDATE_URL)) {
55 1
            throw new InvalidUrlException();
56
        }
57
58 14
        $this->url = $url;
59 14
        return $this;
60
    }
61
62
    /**
63
     * @return string
64
     */
65 13
    public function getDescription(): ?string
66
    {
67 13
        return $this->description;
68
    }
69
70
    /**
71
     * @param string $description
72
     * @return Result
73
     */
74 13
    public function setDescription(string $description): Result
75
    {
76 13
        $this->description = $description;
77 13
        return $this;
78
    }
79
80
81
}
82