GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#177)
by Eric
08:01 queued 05:17
created

Photo::getReference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Ivory Google Map package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\GoogleMap\Service\Place\Base;
13
14
/**
15
 * @author GeLo <[email protected]>
16
 */
17
class Photo
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $reference;
23
24
    /**
25
     * @var int|null
26
     */
27
    private $width;
28
29
    /**
30
     * @var int|null
31
     */
32
    private $height;
33
34
    /**
35
     * @var string[]
36
     */
37
    private $htmlAttributions = [];
38
39
    /**
40
     * @return bool
41
     */
42
    public function hasReference()
43
    {
44
        return $this->reference !== null;
45
    }
46
47
    /**
48
     * @return string|null
49
     */
50
    public function getReference()
51
    {
52
        return $this->reference;
53
    }
54
55
    /**
56
     * @param string|null $reference
57
     */
58
    public function setReference($reference)
59
    {
60
        $this->reference = $reference;
61
    }
62
63
    /**
64
     * @return bool
65
     */
66
    public function hasWidth()
67
    {
68
        return $this->width !== null;
69
    }
70
71
    /**
72
     * @return int|null
73
     */
74
    public function getWidth()
75
    {
76
        return $this->width;
77
    }
78
79
    /**
80
     * @param int|null $width
81
     */
82
    public function setWidth($width)
83
    {
84
        $this->width = $width;
85
    }
86
87
    /**
88
     * @return bool
89
     */
90
    public function hasHeight()
91
    {
92
        return $this->height !== null;
93
    }
94
95
    /**
96
     * @return int|null
97
     */
98
    public function getHeight()
99
    {
100
        return $this->height;
101
    }
102
103
    /**
104
     * @param int|null $height
105
     */
106
    public function setHeight($height)
107
    {
108
        $this->height = $height;
109
    }
110
111
    /**
112
     * @return bool
113
     */
114
    public function hasHtmlAttributions()
115
    {
116
        return !empty($this->htmlAttributions);
117
    }
118
119
    /**
120
     * @return string[]
121
     */
122
    public function getHtmlAttributions()
123
    {
124
        return $this->htmlAttributions;
125
    }
126
127
    /**
128
     * @param string[] $htmlAttributions
129
     */
130
    public function setHtmlAttributions(array $htmlAttributions)
131
    {
132
        $this->htmlAttributions = [];
133
        $this->addHtmlAttributions($htmlAttributions);
134
    }
135
136
    /**
137
     * @param string[] $htmlAttributions
138
     */
139
    public function addHtmlAttributions(array $htmlAttributions)
140
    {
141
        foreach ($htmlAttributions as $htmlAttribution) {
142
            $this->addHtmlAttribution($htmlAttribution);
143
        }
144
    }
145
146
    /**
147
     * @param string $htmlAttribution
148
     *
149
     * @return bool
150
     */
151
    public function hasHtmlAttribution($htmlAttribution)
152
    {
153
        return in_array($htmlAttribution, $this->htmlAttributions, true);
154
    }
155
156
    /**
157
     * @param string $htmlAttribution
158
     */
159
    public function addHtmlAttribution($htmlAttribution)
160
    {
161
        if (!$this->hasHtmlAttribution($htmlAttribution)) {
162
            $this->htmlAttributions[] = $htmlAttribution;
163
        }
164
    }
165
166
    /**
167
     * @param string $htmlAttribution
168
     */
169
    public function removeHtmlAttribution($htmlAttribution)
170
    {
171
        unset($this->htmlAttributions[array_search($htmlAttribution, $this->htmlAttributions, true)]);
172
        $this->htmlAttributions = array_values($this->htmlAttributions);
173
    }
174
}
175