Completed
Push — master ( 0978bf...663ac6 )
by Andrii
01:58
created

Action::isApplicable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
crap 2
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, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\action;
12
13
use hiqdev\php\billing\price\PriceInterface;
14
15
/**
16
 * Simple Action.
17
 * Applicable when same target and same type.
18
 *
19
 * @author Andrii Vasyliev <[email protected]>
20
 */
21
class Action extends AbstractAction
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26 5
    public function isApplicable(PriceInterface $price)
27
    {
28 5
        return $this->target->equals($price->getTarget()) &&
29 5
            $this->type->equals($price->getType());
30
    }
31
}
32