for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Percy\Decorator;
use Cocur\Slugify\Slugify;
use Percy\Entity\EntityInterface;
class SlugDecorator implements DecoratorInterface
{
/**
* {@inheritdoc}
*/
public function __invoke(EntityInterface $entity, array $properties = [])
$props = [];
foreach ($properties as $property) {
$props[] = $entity[$property];
}
$entity['slug'] = (new Slugify)->slugify(implode('-', $props));