mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 01:03:13 +08:00
Created tags visits command, with abstract class wrapping common logic for visits lists commands
This commit is contained in:
@@ -10,7 +10,6 @@ use Shlinkio\Shlink\Common\Entity\AbstractEntity;
|
||||
use Shlinkio\Shlink\Common\Exception\InvalidArgumentException;
|
||||
use Shlinkio\Shlink\Common\Util\IpAddress;
|
||||
use Shlinkio\Shlink\Core\Model\Visitor;
|
||||
use Shlinkio\Shlink\Core\Visit\Model\VisitLocationInterface;
|
||||
use Shlinkio\Shlink\Core\Visit\Model\VisitType;
|
||||
use Shlinkio\Shlink\Importer\Model\ImportedShlinkVisit;
|
||||
|
||||
@@ -119,7 +118,7 @@ class Visit extends AbstractEntity implements JsonSerializable
|
||||
return $this->shortUrl;
|
||||
}
|
||||
|
||||
public function getVisitLocation(): ?VisitLocationInterface
|
||||
public function getVisitLocation(): ?VisitLocation
|
||||
{
|
||||
return $this->visitLocation;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,10 @@ declare(strict_types=1);
|
||||
namespace Shlinkio\Shlink\Core\Entity;
|
||||
|
||||
use Shlinkio\Shlink\Common\Entity\AbstractEntity;
|
||||
use Shlinkio\Shlink\Core\Visit\Model\VisitLocationInterface;
|
||||
use Shlinkio\Shlink\Importer\Model\ImportedShlinkVisitLocation;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model\Location;
|
||||
|
||||
class VisitLocation extends AbstractEntity implements VisitLocationInterface
|
||||
class VisitLocation extends AbstractEntity
|
||||
{
|
||||
private string $countryCode;
|
||||
private string $countryName;
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\Visit\Model;
|
||||
|
||||
final class UnknownVisitLocation implements VisitLocationInterface
|
||||
{
|
||||
public function getCountryName(): string
|
||||
{
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
public function getLatitude(): float
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
public function getLongitude(): float
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
public function getCityName(): string
|
||||
{
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'countryCode' => 'Unknown',
|
||||
'countryName' => 'Unknown',
|
||||
'regionName' => 'Unknown',
|
||||
'cityName' => 'Unknown',
|
||||
'latitude' => 0.0,
|
||||
'longitude' => 0.0,
|
||||
'timezone' => 'Unknown',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\Visit\Model;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
interface VisitLocationInterface extends JsonSerializable
|
||||
{
|
||||
public function getCountryName(): string;
|
||||
|
||||
public function getLatitude(): float;
|
||||
|
||||
public function getLongitude(): float;
|
||||
|
||||
public function getCityName(): string;
|
||||
}
|
||||
Reference in New Issue
Block a user