Completed
Push — master ( b606a3...897f6a )
by Bradley
01:33
created

Location::setPostalCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php namespace Cornford\Googlmapper\Models;
2
3
use Cornford\Googlmapper\Contracts\ModelingInterface;
4
use Cornford\Googlmapper\Contracts\ObjectableInterface;
5
use Cornford\Googlmapper\Mapper;
6
use Illuminate\View\Factory as View;
7
8
class Location implements ObjectableInterface {
9
10
	/**
11
	 * Mapper instance.
12
	 *
13
	 * @var Mapper
14
	 */
15
	protected static $mapper;
16
17
	/**
18
	 * Search.
19
	 *
20
	 * @var string
21
	 */
22
	protected $search;
23
24
	/**
25
	 * Address.
26
	 *
27
	 * @var string
28
	 */
29
	protected $address;
30
31
    /**
32
     * Postal Code.
33
     *
34
     * @var string
35
     */
36
    protected $postalCode;
37
38
	/**
39
	 * Type.
40
	 *
41
	 * @var string
42
	 */
43
	protected $type;
44
45
	/**
46
	 * Latitude.
47
	 *
48
	 * @var float
49
	 */
50
	protected $latitude;
51
52
	/**
53
	 * Longitude.
54
	 *
55
	 * @var float
56
	 */
57
	protected $longitude;
58
59
	/**
60
	 * Place Id.
61
	 *
62
	 * @var string
63
	 */
64
	protected $placeId;
65
66
	/**
67
	 * Public constructor.
68
	 *
69
	 * @param array $parameters
70
	 */
71
	public function __construct(array $parameters = [])
72
	{
73
		$this->setMapper($parameters['mapper']);
74
		$this->setSearch($parameters['search']);
75
		$this->setAddress($parameters['address']);
76
        $this->setPostalCode($parameters['postalCode']);
77
		$this->setType($parameters['type']);
78
		$this->setLatitude($parameters['latitude']);
79
		$this->setLongitude($parameters['longitude']);
80
		$this->setPlaceId($parameters['placeId']);
81
	}
82
83
	/**
84
	 * Get the mapper instance.
85
	 *
86
	 * @return Mapper
87
	 */
88
	protected function getMapper()
89
	{
90
		return self::$mapper;
91
	}
92
93
	/**
94
	 * Set the mapper instance.
95
	 *
96
	 * @param Mapper $mapper
97
	 *
98
	 * @return void
99
	 */
100
	protected function setMapper(Mapper $mapper)
101
	{
102
		self::$mapper = $mapper;
103
	}
104
105
	/**
106
	 * Get the locations search.
107
	 *
108
	 * @return string
109
	 */
110
	public function getSearch()
111
	{
112
		return $this->search;
113
	}
114
115
	/**
116
	 * Set the locations search.
117
	 *
118
	 * @param string $search
119
	 *
120
	 * @return void
121
	 */
122
	protected function setSearch($search)
123
	{
124
		$this->search = $search;
125
	}
126
127
	/**
128
	 * Get the locations address.
129
	 *
130
	 * @return string
131
	 */
132
	public function getAddress()
133
	{
134
		return $this->address;
135
	}
136
137
	/**
138
	 * Set the locations address.
139
	 *
140
	 * @param string $address
141
	 *
142
	 * @return void
143
	 */
144
	protected function setAddress($address)
145
	{
146
		$this->address = $address;
147
	}
148
149
    /**
150
     * Get the locations postal code.
151
     *
152
     * @return string
153
     */
154
    public function getPostalCode()
155
    {
156
        return $this->postalCode;
157
    }
158
159
    /**
160
     * Set the locations postal code.
161
     *
162
     * @param string $postalCode
163
     *
164
     * @return void
165
     */
166
    protected function setPostalCode($postalCode)
167
    {
168
        $this->postalCode = $postalCode;
169
    }
170
171
	/**
172
	 * Get the locations type.
173
	 *
174
	 * @return string
175
	 */
176
	public function getType()
177
	{
178
		return $this->type;
179
	}
180
181
	/**
182
	 * Set the locations type.
183
	 *
184
	 * @param string $type
185
	 *
186
	 * @return void
187
	 */
188
	protected function setType($type)
189
	{
190
		$this->type = $type;
191
	}
192
193
	/**
194
	 * Get the locations latitude.
195
	 *
196
	 * @return float
197
	 */
198
	public function getLatitude()
199
	{
200
		return $this->latitude;
201
	}
202
203
	/**
204
	 * Set the locations latitude.
205
	 *
206
	 * @param float $latitude
207
	 *
208
	 * @return void
209
	 */
210
	protected function setLatitude($latitude)
211
	{
212
		$this->latitude = $latitude;
213
	}
214
215
	/**
216
	 * Get the locations longitude.
217
	 *
218
	 * @return float
219
	 */
220
	public function getLongitude()
221
	{
222
		return $this->longitude;
223
	}
224
225
	/**
226
	 * Set the locations longitude.
227
	 *
228
	 * @param float $longitude
229
	 *
230
	 * @return void
231
	 */
232
	protected function setLongitude($longitude)
233
	{
234
		$this->longitude = $longitude;
235
	}
236
237
	/**
238
	 * Get the place id.
239
	 *
240
	 * @return string
241
	 *
242
	 * @return string
243
	 */
244
	public function getPlaceId()
245
	{
246
		return $this->placeId;
247
	}
248
249
	/**
250
	 * Set the place id.
251
	 *
252
	 * @param string $placeId
253
	 *
254
	 * @return void
255
	 */
256
	protected function setPlaceId($placeId)
257
	{
258
		$this->placeId = $placeId;
259
	}
260
261
	/**
262
	 * Create a new map from location.
263
	 *
264
	 * @param array $options
265
	 *
266
	 * @return Mapper
267
	 */
268
	public function map(array $options = [])
269
	{
270
		return self::$mapper->map($this->getLatitude(), $this->getLongitude(), $options);
271
	}
272
273
	/**
274
	 * Create a new street view map from location.
275
	 *
276
	 * @param integer $heading
277
	 * @param integer $pitch
278
	 * @param array   $options
279
	 *
280
	 * @return Mapper
281
	 */
282
	public function streetview($heading, $pitch, array $options = [])
283
	{
284
		return self::$mapper->streetview($this->getLatitude(), $this->getLongitude(), $heading, $pitch, $options);
285
	}
286
287
}
288