for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Chubbyphp\Serialization\Normalizer;
use Chubbyphp\Serialization\SerializerLogicException;
use Psr\Link\LinkInterface;
final class LinkNormalizer implements LinkNormalizerInterface
{
/**
* @var LinkInterface
*/
private $link;
public function __construct(LinkInterface $link)
$this->link = $link;
}
* @param object|mixed $object
*
* @throws SerializerLogicException
* @return array|null
public function normalizeLink(string $path, $object, NormalizerContextInterface $context)
return [
'href' => $this->link->getHref(),
'templated' => $this->link->isTemplated(),
'rel' => $this->link->getRels(),
'attributes' => $this->link->getAttributes(),
];