Matcher::match()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Mattbit\Flat\Query;
4
5
use Mattbit\Flat\Model\DocumentInterface;
6
use Mattbit\Flat\Query\Expression\ExpressionInterface;
7
8
class Matcher
9
{
10
    /**
11
     * @var ExpressionInterface
12
     */
13
    protected $expression;
14
15
    /**
16
     * Construct a Matcher instance.
17
     *
18
     * @param ExpressionInterface $expression
19
     */
20 4
    public function __construct(ExpressionInterface $expression)
21
    {
22
        // @todo: the expression should be parsed here
23 4
        $this->expression = $expression;
24 4
    }
25
26
    /**
27
     * Check if a document matches the expression.
28
     *
29
     * @param DocumentInterface $document
30
     * @return mixed
31
     */
32 1
    public function match(DocumentInterface $document)
33
    {
34 1
        return $this->expression->match($document);
35
    }
36
}
37