1 | <?php |
||
5 | final class SpedAccessKey extends AbstractDocument |
||
6 | { |
||
7 | const LABEL = 'SpedAccessKey'; |
||
8 | |||
9 | const LENGTH = 44; |
||
10 | |||
11 | const REGEX = '/([\d]{4})/'; |
||
12 | |||
13 | const MASK = '$1 '; |
||
14 | |||
15 | const MODEL = 55; |
||
16 | |||
17 | /** |
||
18 | * SpedAccessKey constructor. |
||
19 | * |
||
20 | * @param $nfeKey |
||
21 | */ |
||
22 | 17 | public function __construct($nfeKey) |
|
27 | |||
28 | /** |
||
29 | * Generates a valid NFe Access Key. |
||
30 | * |
||
31 | * @param int $state IBGE state code. |
||
32 | * @param \DateTime $generatedAt Year and month when invoice was created. |
||
33 | * @param Cnpj $cnpj Cnpj from issuer. |
||
34 | * @param int $sequence Invoice sequence. |
||
35 | * @param int $invoiceNumber Invoice number. |
||
36 | * @param int $controlNumber Control number. |
||
37 | * |
||
38 | * @return SpedAccessKey |
||
39 | */ |
||
40 | 1 | public static function generate( |
|
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | 1 | public function format() |
|
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | 13 | public function calculateDigit($baseNumber) |
|
76 | |||
77 | /** |
||
78 | * Calculate check digit from base number. |
||
79 | * |
||
80 | * It is static because is used from generate static method. |
||
81 | * |
||
82 | * @param string $baseNumber Base numeric section to be calculate your digit. |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | 13 | private static function calculateDigitFrom($baseNumber) |
|
95 | } |
||
96 |