These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace App\Providers; |
||
4 | |||
5 | use Illuminate\Translation\FileLoader; |
||
6 | use Illuminate\Filesystem\Filesystem; |
||
7 | use Illuminate\Translation\Translator; |
||
8 | use Illuminate\Validation\DatabasePresenceVerifier; |
||
9 | use Illuminate\Validation\Factory; |
||
10 | use Pimple\Container; |
||
11 | |||
12 | final class ValidationServiceProvider extends BaseServiceProvider |
||
13 | { |
||
14 | /** |
||
15 | * Register validation service provider. |
||
16 | * |
||
17 | * @param Container $container |
||
18 | */ |
||
19 | public function register(Container $container) |
||
20 | { |
||
21 | $config = $container['settings']; |
||
22 | |||
23 | // translation |
||
24 | $container['translator'] = function () use ($config) { |
||
25 | $translateFileLoader = new FileLoader(new Filesystem, $config['translate']['path']); |
||
26 | $translator = new Translator($translateFileLoader, $config['translate']['locale']); |
||
27 | |||
28 | return $translator; |
||
29 | }; |
||
30 | |||
31 | // validation |
||
32 | $container['validation'] = function (Container $c) use ($config) { |
||
0 ignored issues
–
show
|
|||
33 | $validation = new Factory($c->get('translator')); |
||
34 | $presence = new DatabasePresenceVerifier($c->get('databaseManager')); |
||
35 | $validation->setPresenceVerifier($presence); |
||
36 | |||
37 | return $validation; |
||
38 | }; |
||
39 | } |
||
40 | } |
||
41 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.