Test Failed
Push — master ( c589a4...66fb05 )
by Roberto
06:10 queued 12s
created

TimeZone   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 9
c 1
b 0
f 0
dl 0
loc 33
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 13 2
1
<?php
2
/**
3
 * Copyright (c) 2019 - present
4
 * Google Maps PHP - TimeZone.php
5
 * author: Roberto Belotti - [email protected]
6
 * web : robertobelotti.com, github.com/biscolab
7
 * Initial version created on: 8/10/2019
8
 * MIT license: https://github.com/biscolab/google-maps-php/blob/master/LICENSE
9
 */
10
11
namespace Biscolab\GoogleMaps\Api;
12
13
use Biscolab\GoogleMaps\Abstracts\Api;
14
use Biscolab\GoogleMaps\Fields\GoogleMapsRequestFields;
15
use Biscolab\GoogleMaps\Http\GoogleMapsResult;
16
use Biscolab\GoogleMaps\Http\Result\ElevationResultsCollection;
17
use Biscolab\GoogleMaps\Http\Result\TimeZoneResult;
18
use Biscolab\GoogleMaps\Object\Location;
19
20
/**
21
 * Class TimeZone
22
 * @package Biscolab\GoogleMaps\Api
23
 *
24
 * @since   0.7.0
25
 * @see     https://developers.google.com/maps/documentation/timezone/intro
26
 */
27
class TimeZone extends Api
28
{
29
30
	/**
31
	 * @var string
32
	 */
33
	const SERVICE_ENDPOINT = 'timezone';
34
35
	/**
36
	 * @var string
37
	 */
38
	protected $result_type = TimeZoneResult::class;
39
40
	/**
41
	 * @param Location    $location
42
	 * @param int         $timestamp
43
	 * @param string|null $language
44
	 *
45
	 * @return GoogleMapsResult
46
	 */
47
	public function get(Location $location, int $timestamp, string $language = null): GoogleMapsResult
48
	{
49
50
		$params = [
51
			GoogleMapsRequestFields::LOCATION => $location,
52
			GoogleMapsRequestFields::TIMESTAMP => $timestamp,
53
		];
54
55
		if ($language) {
56
			$params[GoogleMapsRequestFields::LANGUAGE] = $language;
57
		}
58
59
		return $this->callApi($params);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->callApi($params) could return the type Biscolab\GoogleMaps\Http...leMapsResultsCollection which is incompatible with the type-hinted return Biscolab\GoogleMaps\Http\GoogleMapsResult. Consider adding an additional type-check to rule them out.
Loading history...
60
	}
61
}