You are here

public function CpfService::digits in CPF 8

Returns only the digits of a CPF number.

2 calls to CpfService::digits()
CpfService::isValid in src/CpfService.php
Checks if the value you entered is a valid CPF number.
CpfService::mask in src/CpfService.php
Returns only the digits of a CPF number.

File

src/CpfService.php, line 90

Class

CpfService
Defines the CpfService service, for CPF module.

Namespace

Drupal\cpf

Code

public function digits($value) {
  $digits = '';
  if (!empty($value)) {
    $digits = preg_replace("/[^0-9]/", "", $value);
  }
  return $digits;
}