Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Common/Exception/InvalidServerResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class InvalidServerResponse extends \RuntimeException implements Exception
*
* @return InvalidServerResponse
*/
public static function create(string $query, int $code = 0): InvalidServerResponse
public static function create(string $query, int $code = 0): self
{
return new self(sprintf('The geocoder server returned an invalid response (%d) for query "%s". We could not parse it.', $code, $query));
}
Expand All @@ -35,7 +35,7 @@ public static function create(string $query, int $code = 0): InvalidServerRespon
*
* @return InvalidServerResponse
*/
public static function emptyResponse(string $query): InvalidServerResponse
public static function emptyResponse(string $query): self
{
return new self(sprintf('The geocoder server returned an empty response for query "%s".', $query));
}
Expand Down
12 changes: 6 additions & 6 deletions src/Common/Query/GeocodeQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private function __construct(string $text)
*
* @return GeocodeQuery
*/
public static function create(string $text): GeocodeQuery
public static function create(string $text): self
{
return new self($text);
}
Expand All @@ -75,7 +75,7 @@ public static function create(string $text): GeocodeQuery
*
* @return GeocodeQuery
*/
public function withText(string $text): GeocodeQuery
public function withText(string $text): self
{
$new = clone $this;
$new->text = $text;
Expand All @@ -88,7 +88,7 @@ public function withText(string $text): GeocodeQuery
*
* @return GeocodeQuery
*/
public function withBounds(Bounds $bounds): GeocodeQuery
public function withBounds(Bounds $bounds): self
{
$new = clone $this;
$new->bounds = $bounds;
Expand All @@ -101,7 +101,7 @@ public function withBounds(Bounds $bounds): GeocodeQuery
*
* @return GeocodeQuery
*/
public function withLocale(string $locale): GeocodeQuery
public function withLocale(string $locale): self
{
$new = clone $this;
$new->locale = $locale;
Expand All @@ -114,7 +114,7 @@ public function withLocale(string $locale): GeocodeQuery
*
* @return GeocodeQuery
*/
public function withLimit(int $limit): GeocodeQuery
public function withLimit(int $limit): self
{
$new = clone $this;
$new->limit = $limit;
Expand All @@ -128,7 +128,7 @@ public function withLimit(int $limit): GeocodeQuery
*
* @return GeocodeQuery
*/
public function withData(string $name, $value): GeocodeQuery
public function withData(string $name, $value): self
{
$new = clone $this;
$new->data[$name] = $value;
Expand Down
10 changes: 5 additions & 5 deletions src/Common/Query/ReverseQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function create(Coordinates $coordinates)
*
* @return ReverseQuery
*/
public static function fromCoordinates($latitude, $longitude): ReverseQuery
public static function fromCoordinates($latitude, $longitude): self
{
return new self(new Coordinates($latitude, $longitude));
}
Expand All @@ -74,7 +74,7 @@ public static function fromCoordinates($latitude, $longitude): ReverseQuery
*
* @return ReverseQuery
*/
public function withCoordinates(Coordinates $coordinates): ReverseQuery
public function withCoordinates(Coordinates $coordinates): self
{
$new = clone $this;
$new->coordinates = $coordinates;
Expand All @@ -87,7 +87,7 @@ public function withCoordinates(Coordinates $coordinates): ReverseQuery
*
* @return ReverseQuery
*/
public function withLimit(int $limit): ReverseQuery
public function withLimit(int $limit): self
{
$new = clone $this;
$new->limit = $limit;
Expand All @@ -100,7 +100,7 @@ public function withLimit(int $limit): ReverseQuery
*
* @return ReverseQuery
*/
public function withLocale(string $locale): ReverseQuery
public function withLocale(string $locale): self
{
$new = clone $this;
$new->locale = $locale;
Expand All @@ -114,7 +114,7 @@ public function withLocale(string $locale): ReverseQuery
*
* @return ReverseQuery
*/
public function withData(string $name, $value): ReverseQuery
public function withData(string $name, $value): self
{
$new = clone $this;
$new->data[$name] = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/FreeGeoIp/FreeGeoIp.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function geocodeQuery(GeocodeQuery $query): Collection
$builder->addAdminLevel(1, $data['region_name'], $data['region_code'] ?? null);
}

if ($data['latitude'] !== 0 || $data['longitude'] !== 0) {
if (0 !== $data['latitude'] || 0 !== $data['longitude']) {
$builder->setCoordinates($data['latitude'] ?? null, $data['longitude'] ?? null);
}
$builder->setLocality(empty($data['city']) ? null : $data['city']);
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/GoogleMaps/GoogleMaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ private function signQuery(string $query): string
private function validateResponse(string $url, $content)
{
// Throw exception if invalid clientID and/or privateKey used with GoogleMapsBusinessProvider
if (strpos($content, "Provided 'signature' is not valid for the provided client ID") !== false) {
if (false !== strpos($content, "Provided 'signature' is not valid for the provided client ID")) {
throw new InvalidCredentials(sprintf('Invalid client ID / API Key %s', $url));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Provider/Mapzen/Mapzen.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private function executeQuery(string $url): AddressCollection
}
}

if (!isset($json['type']) || $json['type'] !== 'FeatureCollection' || !isset($json['features']) || count($json['features']) === 0) {
if (!isset($json['type']) || 'FeatureCollection' !== $json['type'] || !isset($json['features']) || 0 === count($json['features'])) {
return new AddressCollection([]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Provider/OpenCage/OpenCage.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private function executeQuery(string $url, string $locale = null): AddressCollec
}
}

if (!isset($json['total_results']) || $json['total_results'] == 0) {
if (!isset($json['total_results']) || 0 == $json['total_results']) {
return new AddressCollection([]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Provider/Yandex/Model/YandexAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getPrecision()
*
* @return YandexAddress
*/
public function withPrecision(string $precision = null): YandexAddress
public function withPrecision(string $precision = null): self
{
$new = clone $this;
$new->precision = $precision;
Expand All @@ -65,7 +65,7 @@ public function getName()
*
* @return YandexAddress
*/
public function withName(string $name = null): YandexAddress
public function withName(string $name = null): self
{
$new = clone $this;
$new->name = $name;
Expand Down