. */ namespace Irstea\PlantUmlBundle\Model\Filter; use ReflectionClass; /** * Description of DirectoryFilter. */ class DirectoryFilter extends AbstractListFilter { /** * @var string */ public const CONF_TYPE = 'directories'; /** * {@inheritDoc} */ protected function extract(ReflectionClass $class): string { $filename = $class->getFileName(); if ($filename === false) { return ''; } return dirname($class->getFileName()); } /** * @param mixed $tested * @param mixed $reference * @return bool */ protected function matches($tested, $reference): bool { return strpos($tested, $reference) === 0; } /** * @param string $path * @return string */ protected function normalize($path): string { return rtrim(strtr($path, '/\\', DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; } }