DirectoryFilter.php 765 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

/*
 * © 2016 IRSTEA
 * Guillaume Perréal <guillaume.perreal@irstea.fr>
 * Tous droits réservés.
 */

namespace Irstea\PlantUmlBundle\Model\Filter;

use ReflectionClass;

/**
 * Description of DirectoryFilter
 *
 * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
 */
18
class DirectoryFilter extends AbstractListFilter
19
{
20
21
    const CONF_TYPE = 'directories';

22
23
24
25
    protected function extract(ReflectionClass $class)
    {
        return dirname($class->getFileName());
    }
26

27
    protected function matches($tested, $reference)
28
    {
29
        return strpos($tested, $reference) === 0;
30
31
    }

32
    protected function normalize($path)
33
    {
34
         return rtrim(strtr($path, '/\\', DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
35
36
    }
}