Skip to content

Commit 8d2736c

Browse files
Merge pull request #15 from brazanation/patch
all classes are declared final
2 parents eb5e707 + 6b5d83f commit 8d2736c

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

src/Cnh.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public function __construct($cnh)
4040
private function validate($number)
4141
{
4242
if (empty($number)) {
43-
throw InvalidArgumentException::notEmpty(static::LABEL);
43+
throw InvalidArgumentException::notEmpty(self::LABEL);
4444
}
4545
if (!$this->isValidCV($number)) {
46-
throw InvalidArgumentException::isNotValid(static::LABEL, $number);
46+
throw InvalidArgumentException::isNotValid(self::LABEL, $number);
4747
}
4848
}
4949

@@ -56,9 +56,9 @@ private function validate($number)
5656
*/
5757
private function isValidCV($number)
5858
{
59-
$isRepeated = preg_match("/^{$number[0]}{" . static::LENGTH . '}$/', $number);
59+
$isRepeated = preg_match("/^{$number[0]}{" . self::LENGTH . '}$/', $number);
6060

61-
if (strlen($number) != static::LENGTH || $isRepeated) {
61+
if (strlen($number) != self::LENGTH || $isRepeated) {
6262
return false;
6363
}
6464

src/Cnpj.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public function __construct($cnpj)
4040
private function validate($number)
4141
{
4242
if (empty($number)) {
43-
throw InvalidDocumentException::notEmpty(static::LABEL);
43+
throw InvalidDocumentException::notEmpty(self::LABEL);
4444
}
4545
if (!$this->isValid($number)) {
46-
throw InvalidDocumentException::isNotValid(static::LABEL, $number);
46+
throw InvalidDocumentException::isNotValid(self::LABEL, $number);
4747
}
4848
}
4949

@@ -56,11 +56,11 @@ private function validate($number)
5656
*/
5757
private function isValid($number)
5858
{
59-
if (strlen($number) != static::LENGTH) {
59+
if (strlen($number) != self::LENGTH) {
6060
return false;
6161
}
6262

63-
if (preg_match("/^{$number[0]}{" . static::LENGTH . '}$/', $number)) {
63+
if (preg_match("/^{$number[0]}{" . self::LENGTH . '}$/', $number)) {
6464
return false;
6565
}
6666

@@ -76,7 +76,7 @@ private function isValid($number)
7676
*/
7777
public function format()
7878
{
79-
return preg_replace(static::REGEX, '$1.$2.$3/$4-$5', $this->cnpj);
79+
return preg_replace(self::REGEX, '$1.$2.$3/$4-$5', $this->cnpj);
8080
}
8181

8282
/**

src/Cpf.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public function __construct($number)
4040
private function validate($number)
4141
{
4242
if (empty($number)) {
43-
throw InvalidDocumentException::notEmpty(static::LABEL);
43+
throw InvalidDocumentException::notEmpty(self::LABEL);
4444
}
4545
if (!$this->isValid($number)) {
46-
throw InvalidDocumentException::isNotValid(static::LABEL, $number);
46+
throw InvalidDocumentException::isNotValid(self::LABEL, $number);
4747
}
4848
}
4949

@@ -56,11 +56,11 @@ private function validate($number)
5656
*/
5757
private function isValid($number)
5858
{
59-
if (strlen($number) != static::LENGTH) {
59+
if (strlen($number) != self::LENGTH) {
6060
return false;
6161
}
6262

63-
if (preg_match("/^{$number[0]}{" . static::LENGTH . '}$/', $number)) {
63+
if (preg_match("/^{$number[0]}{" . self::LENGTH . '}$/', $number)) {
6464
return false;
6565
}
6666

@@ -76,7 +76,7 @@ private function isValid($number)
7676
*/
7777
public function format()
7878
{
79-
return preg_replace(static::REGEX, '$1.$2.$3-$4', $this->cpf);
79+
return preg_replace(self::REGEX, '$1.$2.$3-$4', $this->cpf);
8080
}
8181

8282
/**

src/PisPasep.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ public function __construct($number)
3232
private function validate($number)
3333
{
3434
if (empty($number)) {
35-
throw InvalidDocument::notEmpty(static::LABEL);
35+
throw InvalidDocument::notEmpty(self::LABEL);
3636
}
3737
if (!$this->isValidCV($number)) {
38-
throw InvalidDocument::isNotValid(static::LABEL, $number);
38+
throw InvalidDocument::isNotValid(self::LABEL, $number);
3939
}
4040
}
4141

4242
private function isValidCV($number)
4343
{
44-
if (strlen($number) != static::LENGTH) {
44+
if (strlen($number) != self::LENGTH) {
4545
return false;
4646
}
4747

48-
if (preg_match("/^{$number[0]}{" . static::LENGTH . '}$/', $number)) {
48+
if (preg_match("/^{$number[0]}{" . self::LENGTH . '}$/', $number)) {
4949
return false;
5050
}
5151

@@ -61,7 +61,7 @@ private function isValidCV($number)
6161
*/
6262
public function format()
6363
{
64-
return preg_replace(static::REGEX, '$1.$2.$3-$4', $this->pispasep);
64+
return preg_replace(self::REGEX, '$1.$2.$3-$4', $this->pispasep);
6565
}
6666

6767
public function __toString()

0 commit comments

Comments
 (0)