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

RuleInterceptor::apply()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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