Path   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 24
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A valid() 0 4 1
A setPattern() 0 4 1
1
<?php
2
namespace AppBundle\Sync\Entity\Filter;
3
4
use AppBundle\Sync\Entity\File;
5
6
/**
7
 * Filter files by path
8
 *
9
 * @author Sergey Sadovoi <[email protected]>
10
 */
11
class Path implements FilterInterface
12
{
13
    /**
14
     * @var string  Regex pattern for file path
15
     */
16
    protected $pattern;
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 4
    public function valid(File $file)
22
    {
23 4
        return preg_match($this->pattern, $file->getPath());
24
    }
25
26
    /**
27
     * Set the file path pattern
28
     * @param string $pattern  Regex pattern for file path
29
     */
30 4
    public function setPattern($pattern)
31
    {
32 4
        $this->pattern = $pattern;
33 4
    }
34
}
35