mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 17:23:12 +08:00
Update to latest shlink-common and remove deprecation references
This commit is contained in:
@@ -4,14 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\EventDispatcher;
|
||||
|
||||
use Shlinkio\Shlink\Common\Rest\DataTransformerInterface;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\Update;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Transformer\ShortUrlDataTransformerInterface;
|
||||
use Shlinkio\Shlink\Core\Visit\Entity\Visit;
|
||||
|
||||
final readonly class PublishingUpdatesGenerator implements PublishingUpdatesGeneratorInterface
|
||||
{
|
||||
public function __construct(private DataTransformerInterface $shortUrlTransformer)
|
||||
public function __construct(private ShortUrlDataTransformerInterface $shortUrlTransformer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -4,24 +4,17 @@ declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\ShortUrl\Transformer;
|
||||
|
||||
use Shlinkio\Shlink\Common\Rest\DataTransformerInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifierInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlWithVisitsSummary;
|
||||
|
||||
/**
|
||||
* @fixme Do not implement DataTransformerInterface, but a separate interface
|
||||
*/
|
||||
readonly class ShortUrlDataTransformer implements DataTransformerInterface
|
||||
readonly class ShortUrlDataTransformer implements ShortUrlDataTransformerInterface
|
||||
{
|
||||
public function __construct(private ShortUrlStringifierInterface $stringifier)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ShortUrlWithVisitsSummary|ShortUrl $data
|
||||
*/
|
||||
public function transform($data): array // phpcs:ignore
|
||||
public function transform(ShortUrlWithVisitsSummary|ShortUrl $data): array
|
||||
{
|
||||
$shortUrl = $data instanceof ShortUrlWithVisitsSummary ? $data->shortUrl : $data;
|
||||
return [
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\ShortUrl\Transformer;
|
||||
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlWithVisitsSummary;
|
||||
|
||||
interface ShortUrlDataTransformerInterface
|
||||
{
|
||||
public function transform(ShortUrlWithVisitsSummary|ShortUrl $data): array;
|
||||
}
|
||||
Reference in New Issue
Block a user