• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geekcom / validator-docs / 7547744364

16 Jan 2024 09:29PM UTC coverage: 94.672%. First build
7547744364

Pull #141

github

web-flow
Merge 4149012f3 into de6e5ff9e
Pull Request #141: suporte validação passaporte

231 of 244 relevant lines covered (94.67%)

9.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.77
/src/validator-docs/ValidatorProvider.php
1
<?php
2

3
namespace geekcom\ValidatorDocs;
4

5
use Illuminate\Support\ServiceProvider;
6

7
class ValidatorProvider extends ServiceProvider
8
{
9
    /**
10
     * Indicates if loading of the provider is deferred.
11
     *
12
     * @var bool
13
     */
14
    protected $defer = false;
15

16
    /**
17
     * Bootstrap the application events.
18
     *
19
     * @return void
20
     */
21
    public function boot()
22
    {
23
        $me = $this;
59✔
24

25
        $validatorFormats = new ValidatorFormats();
59✔
26

27
        $this->app['validator']
60✔
28
            ->resolver(
60✔
29
                function ($translator, $data, $rules, $messages, $attributes) use ($me, $validatorFormats) {
60✔
30
                    $messages += $me->getMessages();
50✔
31

32
                    return new Validator($translator, $validatorFormats, $data, $rules, $messages, $attributes);
50✔
33
                }
60✔
34
            );
60✔
35
    }
36

37
    protected function getMessages()
38
    {
39
        return [
50✔
40
            'cnh' => 'Carteira Nacional de Habilitação inválida',
50✔
41
            'titulo_eleitor' => 'Título de Eleitor inválido',
50✔
42
            'cnpj' => 'CNPJ inválido',
50✔
43
            'cpf' => 'CPF inválido',
50✔
44
            'renavam' => 'Renavam inválido',
50✔
45
            'cpf_cnpj' => 'CPF ou CNPJ inválido',
50✔
46
            'nis' => 'PIS/PASEP/NIT/NIS inválido',
50✔
47
            'cns' => 'Cartão Nacional de Saúde inválido',
50✔
48
            'inscricao_estadual' => 'Inscrição Estadual ou UF inválidas',
50✔
49
            'certidao' => 'Número da Certidão inválido',
50✔
50
            'ddd' => 'DDD inválido',
50✔
51
            'placa' => 'Placa inválida',
50✔
52
            'passaporte' => 'Passaporte inválido',
50✔
53
            'formato_cnpj' => 'Formato inválido para CNPJ',
50✔
54
            'formato_cpf' => 'Formato inválido para CPF',
50✔
55
            'formato_cpf_cnpj' => 'Formato inválido para CPF ou CNPJ',
50✔
56
            'formato_nis' => 'Formato inválido para PIS/PASEP/NIT/NIS',
50✔
57
            'formato_certidao' => 'Formato inválido para Certidão',
50✔
58
        ];
50✔
59
    }
60

61
    /**
62
     * Register the service provider.
63
     *
64
     * @return void
65
     */
66
    public function register()
67
    {
68
    }
59✔
69

70
    /**
71
     * Get the services provided by the provider.
72
     *
73
     * @return array
74
     */
75
    public function provides()
76
    {
77
        return [];
×
78
    }
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc