TooShort::filter()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 1
dl 0
loc 10
ccs 7
cts 7
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Aoe\Asdis\System\Uri\Filter;
3
4
use Aoe\Asdis\System\Uri\Filter\FilterInterface;
5
6
/**
7
 * Filters paths which are too short.
8
 */
9
class TooShort implements FilterInterface
10
{
11
    /**
12
     * @var integer
13
     */
14
    const MIN_LENGTH = 5;
15
16
    /**
17
     * @param array $paths Array of paths.
18
     * @return array Valid paths.
19
     */
20 1
    public function filter(array $paths)
21
    {
22 1
        $filteredPaths = array();
23 1
        foreach ($paths as $path) {
24 1
            if (strlen($path) < self::MIN_LENGTH) {
25 1
                continue;
26
            }
27 1
            $filteredPaths[] = $path;
28
        }
29 1
        return $filteredPaths;
30
    }
31
}