<?php

namespace AutoAdmin\Bundle\Content\Entity\Duplicators;

use AutoAdmin\Bundle\Content\Entity\Interfaces\CacheRuleInterface;

class CacheRuleDuplicator extends AbstractDuplicator
{
    public function support(): array
    {
        return [
            CacheRuleInterface::class
        ];
    }

    /**
     * @param CacheRuleInterface $entity
     * @param CacheRuleInterface $duplicate
     *
     * @return CacheRuleInterface
     */
    public function duplicate($entity, $duplicate, $parent = null)
    {
        $duplicate->setPattern($entity->getPattern());
        $duplicate->setIsExcluded($entity->isExcluded());
        $duplicate->setExactMatch($entity->isExactMatch());

        return $duplicate;
    }
}