Test Failed
Push — master ( e3b5b4...43c430 )
by Kirill
04:55
created

RuleInterceptor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A match() 0 4 1
A apply() 0 4 1
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\SDL\Frontend\Interceptor;
11
12
use Railt\Io\Readable;
13
use Railt\Parser\Ast\NodeInterface;
14
use Railt\Parser\Ast\RuleInterface;
15
16
/**
17
 * Class RuleInterceptor
18
 */
19
class RuleInterceptor extends BaseInterceptor
20
{
21
    /**
22
     * @param mixed $result
23
     * @return bool
24
     */
25
    public function match($result): bool
26
    {
27
        return $result instanceof RuleInterface;
28
    }
29
30
    /**
31
     * @param Readable $file
32
     * @param RuleInterface $node
33
     * @return mixed
34
     * @throws \Railt\Io\Exception\ExternalFileException
35
     */
36
    public function apply(Readable $file, $node)
37
    {
38
        return $this->builder->reduce($file, $node);
39
    }
40
}
41