Address.php
5 years ago
Company.php
5 years ago
Internet.php
5 years ago
Payment.php
5 years ago
Person.php
5 years ago
PhoneNumber.php
5 years ago
check_digit.php
5 years ago
Company.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Faker\Provider\pt_BR; |
| 4 | |
| 5 | require_once "check_digit.php"; |
| 6 | |
| 7 | class Company extends \Faker\Provider\Company |
| 8 | { |
| 9 | protected static $formats = array( |
| 10 | '{{lastName}} {{companySuffix}}', |
| 11 | '{{lastName}}-{{lastName}}', |
| 12 | '{{lastName}} e {{lastName}}', |
| 13 | '{{lastName}} e {{lastName}} {{companySuffix}}', |
| 14 | '{{lastName}} Comercial Ltda.' |
| 15 | ); |
| 16 | |
| 17 | protected static $companySuffix = array('e Filhos', 'e Associados', 'Ltda.', 'S.A.'); |
| 18 | |
| 19 | /** |
| 20 | * A random CNPJ number. |
| 21 | * @link http://en.wikipedia.org/wiki/CNPJ |
| 22 | * @param bool $formatted If the number should have dots/slashes/dashes or not. |
| 23 | * @return string |
| 24 | */ |
| 25 | public function cnpj($formatted = true) |
| 26 | { |
| 27 | $n = $this->generator->numerify('########0001'); |
| 28 | $n .= check_digit($n); |
| 29 | $n .= check_digit($n); |
| 30 | |
| 31 | return $formatted? vsprintf('%d%d.%d%d%d.%d%d%d/%d%d%d%d-%d%d', str_split($n)) : $n; |
| 32 | } |
| 33 | } |
| 34 |