for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the puli/repository package.
*
* (c) Bernhard Schussek <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Puli\Repository\ChangeStream\Normalizer;
use Puli\Repository\Api\Resource\PuliResource;
use Puli\Repository\Resource\LinkResource;
/**
* Normalizer for link resources.
* @since 1.0
* @author Titouan Galopin <[email protected]>
class LinkResourceNormalizer extends GenericResourceNormalizer
{
* @inheritdoc
public function normalize(PuliResource $resource)
/** @var LinkResource $resource */
$data = parent::normalize($resource);
$data['target_path'] = $resource->getTargetPath();
return $data;
}
public function denormalize($data)
return new LinkResource($data['target_path'], $data['path']);
public function supports(PuliResource $resource)
return $resource instanceof LinkResource;