ClassFilter.php 1.46 KB
Newer Older
1
<?php declare(strict_types=1);
2
/*
Guillaume Perréal's avatar
CS.  
Guillaume Perréal committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 * This file is part of "irstea/plantuml-bundle".
 *
 * Copyright (C) 2016-2019 IRSTEA
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License and the GNU
 * Lesser General Public License along with this program. If not, see
 * <https://www.gnu.org/licenses/>.
19 20 21 22 23 24 25
 */

namespace Irstea\PlantUmlBundle\Model\Filter;

use ReflectionClass;

/**
Guillaume Perréal's avatar
CS.  
Guillaume Perréal committed
26
 * Description of DirectoryFilter.
27
 */
28
class ClassFilter extends AbstractListFilter
29
{
30 31 32
    /**
     * @var string
     */
33
    public const CONF_TYPE = 'classes';
34

35 36 37 38
    /**
     * {@inheritDoc}
     */
    protected function extract(ReflectionClass $class): string
39 40 41
    {
        return $class->getName();
    }
42

43 44 45 46
    /**
     * {@inheritDoc}
     */
    protected function matches($tested, $reference): bool
47
    {
48
        return $tested === $reference;
49 50
    }

51 52 53 54
    /**
     * {@inheritDoc}
     */
    protected function normalize($className): string
55
    {
Guillaume Perréal's avatar
CS.  
Guillaume Perréal committed
56
        return trim($className, '\\');
57 58
    }
}