Skip to content

Commit

Permalink
W3W Service: cs
Browse files Browse the repository at this point in the history
  • Loading branch information
DJTommek committed Oct 3, 2021
1 parent 165e589 commit 9bcc817
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/libs/BetterLocation/Service/WhatThreeWordService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\BetterLocation\BetterLocation;
use App\BetterLocation\Service\Exceptions\NotSupportedException;
use App\WhatThreeWord\Helper;
use App\WhatThreeWord;
use Nette\Utils\Arrays;

final class WhatThreeWordService extends AbstractService
Expand All @@ -22,7 +22,7 @@ public static function getLink(float $lat, float $lon, bool $drive = false): str
if ($drive) {
throw new NotSupportedException('Drive link is not supported.');
} else {
return Helper::coordsToWords($lat, $lon)->map;
return WhatThreeWord\Helper::coordsToWords($lat, $lon)->map;
}
}

Expand All @@ -33,7 +33,7 @@ public function isValid(): bool

public function process(): void
{
$data = Helper::wordsToCoords($this->data->words);
$data = WhatThreeWord\Helper::wordsToCoords($this->data->words);
$betterLocation = new BetterLocation($this->input, $data->coordinates->lat, $data->coordinates->lng, self::class);
$betterLocation->setPrefixMessage(sprintf('<a href="%s">%s</a>: <code>%s</code>', $data->map, self::NAME, $data->words));
$this->collection->add($betterLocation);
Expand All @@ -45,7 +45,7 @@ public function process(): void
*/
private function isWords(): bool
{
if ($words = Helper::validateWords($this->input)) {
if ($words = WhatThreeWord\Helper::validateWords($this->input)) {
$this->data->words = $words;
return true;
}
Expand All @@ -63,7 +63,7 @@ private function isUrl(): bool
Arrays::contains(['what3words.com', 'w3w.co'], $this->url->getDomain(2))
) {
$words = ltrim(urldecode($this->url->getPath()), '/');
if ($words = Helper::validateWords($words)) {
if ($words = WhatThreeWord\Helper::validateWords($words)) {
$this->data->words = $words;
return true;
}
Expand All @@ -73,7 +73,7 @@ private function isUrl(): bool

public static function getShareText(float $lat, float $lon): string
{
$data = Helper::coordsToWords($lat, $lon);
$data = WhatThreeWord\Helper::coordsToWords($lat, $lon);
return '///' . $data->words;
}
}

0 comments on commit 9bcc817

Please sign in to comment.