@@ -52,14 +52,14 @@ public static function generate($state, \DateTime $generatedAt, Cnpj $cnpj, $ser
5252
5353 $ baseNumber = "{$ state }{$ yearMonth }{$ cnpj }{$ model }{$ serie }{$ invoiceNumber }{$ controlNumber }" ;
5454
55- $ digit = self ::calculateDigits ($ baseNumber );
55+ $ digit = self ::calculateDigit ($ baseNumber );
5656
5757 return new self ("{$ baseNumber }{$ digit }" );
5858 }
5959
6060 public function format ()
6161 {
62- return trim (preg_replace (static ::REGEX , static ::MASK , $ this ->nfeKey ));
62+ return trim (preg_replace (self ::REGEX , self ::MASK , $ this ->nfeKey ));
6363 }
6464
6565 public function __toString ()
@@ -70,29 +70,34 @@ public function __toString()
7070 private function validate ($ number )
7171 {
7272 if (empty ($ number )) {
73- throw InvalidDocumentException::notEmpty (static ::LABEL );
73+ throw InvalidDocumentException::notEmpty (self ::LABEL );
7474 }
7575 if (!$ this ->isValid ($ number )) {
76- throw InvalidDocumentException::isNotValid (static ::LABEL , $ number );
76+ throw InvalidDocumentException::isNotValid (self ::LABEL , $ number );
7777 }
7878 }
7979
8080 private function isValid ($ number )
8181 {
82- if (strlen ($ number ) != static ::LENGTH ) {
82+ if (strlen ($ number ) != self ::LENGTH ) {
8383 return false ;
8484 }
8585
86- if (preg_match ("/^ {$ number [0 ]}{ " . static ::LENGTH . '}$/ ' , $ number )) {
86+ if (preg_match ("/^ {$ number [0 ]}{ " . self ::LENGTH . '}$/ ' , $ number )) {
8787 return false ;
8888 }
8989
90- $ digits = static :: calculateDigits (substr ($ number , 0 , -1 ));
90+ $ digits = self :: calculateDigit (substr ($ number , 0 , -1 ));
9191
9292 return $ digits === substr ($ number , -1 );
9393 }
9494
95- private static function calculateDigits ($ baseNumber )
95+ /**
96+ * @param string $baseNumber
97+ *
98+ * @return string
99+ */
100+ private static function calculateDigit ($ baseNumber )
96101 {
97102 $ calculator = new DigitCalculator ($ baseNumber );
98103 $ calculator ->useComplementaryInsteadOfModule ();
0 commit comments