@@ -9,7 +9,7 @@ |
||
9 | 9 | const COMMA = self::SPACES . ',' . self::SPACES; |
10 | 10 | const PIPE = self::SPACES . '\|' . self::SPACES; |
11 | 11 | const NUMBER = '(-?\d*\.?\d+)'; |
12 | - const NUMBER_OR_PERCENT = '('. self::NUMBER . '%?)'; //'((-?\d*\.?\d+)%?)'; |
|
12 | + const NUMBER_OR_PERCENT = '(' . self::NUMBER . '%?)'; //'((-?\d*\.?\d+)%?)'; |
|
13 | 13 | const PERCENT = self::NUMBER . '%'; |
14 | 14 | const POSITIVE_NUMBER = '(\d*\.?\d+)'; |
15 | 15 | const POSITIVE_NUMBER_OR_ASTERISK = '(\d*\.?\d+|\*)'; |
@@ -10,8 +10,8 @@ |
||
10 | 10 | final class PercentageBillInterpreter extends AbstractBillInterpreter |
11 | 11 | { |
12 | 12 | private const EXPRESSION = Expr::PERCENT . |
13 | - Expr::COMMA . |
|
14 | - Expr::RANGE; |
|
13 | + Expr::COMMA . |
|
14 | + Expr::RANGE; |
|
15 | 15 | private $ranges = []; |
16 | 16 | |
17 | 17 | public function __construct() |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $amount = $context->getAmount(); |
44 | 44 | |
45 | 45 | if (RangeHelper::isInRange($range, $amount)) { |
46 | - $bill = ($matches[1] * $amount)/ 100.00; |
|
46 | + $bill = ($matches[1] * $amount) / 100.00; |
|
47 | 47 | break; |
48 | 48 | } |
49 | 49 | } |
@@ -37,12 +37,12 @@ |
||
37 | 37 | |
38 | 38 | if ($amount === '*') { |
39 | 39 | $percentageCtxt->setAmount(floatval($billableAmount)) |
40 | - ->setStructure($matches[1] . ', 1 - * '); |
|
40 | + ->setStructure($matches[1] . ', 1 - * '); |
|
41 | 41 | $bill += $percentageBillInterpreter->interpret($percentageCtxt); |
42 | 42 | } else { |
43 | 43 | $billableAmount -= $amount; |
44 | 44 | $percentageCtxt->setAmount($amount) |
45 | - ->setStructure($matches[1] . ', 1 - * '); |
|
45 | + ->setStructure($matches[1] . ', 1 - * '); |
|
46 | 46 | $bill += $percentageBillInterpreter->interpret($percentageCtxt); |
47 | 47 | } |
48 | 48 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | final class SteppedBillInterpreter extends AbstractBillInterpreter |
17 | 17 | { |
18 | - private const EXPRESSION = Expr::POSITIVE_NUMBER . |
|
18 | + private const EXPRESSION = Expr::POSITIVE_NUMBER . |
|
19 | 19 | Expr::COMMA . |
20 | 20 | Expr::POSITIVE_NUMBER . |
21 | 21 | '\+'; |
@@ -16,8 +16,8 @@ |
||
16 | 16 | final class FlatRateBillInterpreter extends AbstractBillInterpreter |
17 | 17 | { |
18 | 18 | private const EXPRESSION = Expr::POSITIVE_NUMBER . |
19 | - Expr::COMMA . |
|
20 | - Expr::RANGE; |
|
19 | + Expr::COMMA . |
|
20 | + Expr::RANGE; |
|
21 | 21 | private $ranges = []; |
22 | 22 | |
23 | 23 | public function __construct() |