Completed
Push — master ( eebd57...9e79a2 )
by Andrii
07:00
created

Asserter::visitModel()   A

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 3
crap 1
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\formula;
12
13
use hiqdev\php\billing\charge\modifiers\LastCombination;
14
use Hoa\Ruler\Context;
15
use Hoa\Ruler\Model;
16
17
/**
18
 * @author Andrii Vasyliev <[email protected]>
19
 */
20
class Asserter extends \Hoa\Ruler\Visitor\Asserter
21
{
22
    /**
23
     * @param Context $context context
24
     */
25 2
    public function __construct(Context $context = null)
26
    {
27 2
        if (null !== $context) {
28
            $this->setContext($context);
29
        }
30
31 2
        $this->setOperator('and', [$this, 'makeAnd']);
32 2
    }
33
34
    public function makeAnd($lhs, $rhs)
35
    {
36
        return new LastCombination($lhs, $rhs);
37
    }
38
39 2
    public function visitModel(Model $element, &$handle = null, $eldnah = null)
40
    {
41 2
        return $element->getExpression()->accept($this, $handle, $eldnah);
42
    }
43
}
44