Skip to content

Commit eb5e707

Browse files
Merge pull request #14 from brazanation/cleanup
remove unsed code
2 parents 6a2c868 + 68addaa commit eb5e707

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

src/Cnpj.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ final class Cnpj implements DocumentInterface
1212

1313
const REGEX = '/^([\d]{2,3})([\d]{3})([\d]{3})([\d]{4})([\d]{2})$/';
1414

15-
const FORMAT_REGEX = '/^[\d]{2,3}\.[\d]{3}\.[\d]{3}\/[\d]{4}-[\d]{2}$/';
16-
1715
/**
1816
* @var string
1917
*/

src/Cpf.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ final class Cpf implements DocumentInterface
1212

1313
const REGEX = '/^([\d]{3})([\d]{3})([\d]{3})([\d]{2})$/';
1414

15-
const FORMAT_REGEX = '/^[\d]{3}\.[\d]{3}\.[\d]{3}-[\d]{2}$/';
16-
1715
/**
1816
* @var string
1917
*/

src/NFeAccessKey.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

src/PisPasep.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ final class PisPasep implements DocumentInterface
1212

1313
const REGEX = '/^([\d]{3})([\d]{5})([\d]{2})([\d]{1})$/';
1414

15-
const FORMAT_REGEX = '/^[\d]{3}\.[\d]{5}\.[\d]{2}-[\d]{1}$/';
16-
1715
/**
1816
* @var string
1917
*/
2018
private $pispasep;
2119

22-
protected $mask = '000.00000.00-0';
23-
2420
/**
2521
* PisPasep constructor.
2622
*
@@ -53,7 +49,7 @@ private function isValidCV($number)
5349
return false;
5450
}
5551

56-
$digits = $this->calculateDigits(substr($number, 0, -1));
52+
$digits = $this->calculateDigit(substr($number, 0, -1));
5753

5854
return $digits === substr($number, -1);
5955
}
@@ -80,7 +76,7 @@ public function __toString()
8076
*
8177
* @return string
8278
*/
83-
private function calculateDigits($number)
79+
private function calculateDigit($number)
8480
{
8581
$calculator = new DigitCalculator($number);
8682
$calculator->withMultipliersInterval(2, 9);

0 commit comments

Comments
 (0)