File tree 4 files changed +34
-3
lines changed
4 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 15
15
use Worksome \UkTaxCodeValidator \Rules \NoTaxesRule ;
16
16
use Worksome \UkTaxCodeValidator \Rules \RuleInterface ;
17
17
use Worksome \UkTaxCodeValidator \Rules \TemporaryTaxCodeRule ;
18
+ use Worksome \UkTaxCodeValidator \Rules \AdvancedScottishRateRule ;
18
19
use Worksome \UkTaxCodeValidator \Rules \TopScottishRateRule ;
19
20
use Worksome \UkTaxCodeValidator \TaxCode ;
20
21
@@ -35,6 +36,7 @@ public function __construct()
35
36
new MarriageAllowanceTransferredRule ($ this ),
36
37
new HigherRateRule ($ this ),
37
38
new AdditionalRateRule ($ this ),
39
+ new AdvancedScottishRateRule ($ this ),
38
40
new TopScottishRateRule ($ this ),
39
41
new NoTaxesRule ($ this ),
40
42
];
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Worksome \UkTaxCodeValidator \Rules ;
4
+
5
+ use Worksome \UkTaxCodeValidator \TaxCode ;
6
+
7
+ class AdvancedScottishRateRule extends RegexRule
8
+ {
9
+ public function validate (TaxCode $ taxCode ): bool
10
+ {
11
+ // Validate against full tax code, as a D2
12
+ // should always have a scottish regime modifier in front.
13
+ return parent ::validate (
14
+ new TaxCode ($ taxCode ->getOriginalTaxCode ())
15
+ );
16
+ }
17
+
18
+ protected function regex (): string
19
+ {
20
+ return /* @lang RegExp */ '/^SD2/ ' ;
21
+ }
22
+
23
+ protected function regexForConsume (): string
24
+ {
25
+ return /* @lang RegExp */ '/^D2/ ' ;
26
+ }
27
+ }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class TopScottishRateRule extends RegexRule
8
8
{
9
9
public function validate (TaxCode $ taxCode ): bool
10
10
{
11
- // Validate against full tax code, as a D2
11
+ // Validate against full tax code, as a D3
12
12
// should always have a scottish regime modifier in front.
13
13
return parent ::validate (
14
14
new TaxCode ($ taxCode ->getOriginalTaxCode ())
@@ -17,11 +17,11 @@ public function validate(TaxCode $taxCode): bool
17
17
18
18
protected function regex (): string
19
19
{
20
- return /* @lang RegExp */ '/^SD2 / ' ;
20
+ return /* @lang RegExp */ '/^SD3 / ' ;
21
21
}
22
22
23
23
protected function regexForConsume (): string
24
24
{
25
- return /* @lang RegExp */ '/^D2 / ' ;
25
+ return /* @lang RegExp */ '/^D3 / ' ;
26
26
}
27
27
}
Original file line number Diff line number Diff line change 28
28
// Not taxed
29
29
'NT ' , 'NTX ' , 'NTM1 ' ,
30
30
// Top scottish rates
31
+ 'SD3 ' , 'SD3X ' ,
32
+ // Advanced scottish rates
31
33
'SD2 ' , 'SD2X ' ,
32
34
// Random tests
33
35
'S 123 3 L ' ,
You can’t perform that action at this time.
0 commit comments