Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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 = [
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 = ['e Filhos', 'e Associados', 'Ltda.', 'S.A.'];
18
 
19
    /**
20
     * A random CNPJ number.
21
     *
22
     * @see http://en.wikipedia.org/wiki/CNPJ
23
     *
24
     * @param bool $formatted If the number should have dots/slashes/dashes or not.
25
     *
26
     * @return string
27
     */
28
    public function cnpj($formatted = true)
29
    {
30
        $n = $this->generator->numerify('########0001');
31
        $n .= check_digit($n);
32
        $n .= check_digit($n);
33
 
34
        return $formatted ? vsprintf('%d%d.%d%d%d.%d%d%d/%d%d%d%d-%d%d', str_split($n)) : $n;
35
    }
36
}