Completed
Push — master ( a2b732...080f9b )
by Rai
10s
created

RegisterCustomAnnotationsServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 27
rs 10
c 1
b 1
f 0
wmc 5
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
B register() 0 24 5
1
<?php
2
3
namespace Bludata\Lumen\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class RegisterCustomAnnotationsServiceProvider extends ServiceProvider
8
{
9
    public function register()
10
    {
11
        /**
12
         * Caso haja outras annotations que necessitem ser registradas, basta adicionar o path das mesmas no array $paths.
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 80 characters; contains 122 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
13
         */
14
        $paths = [
15
            __DIR__.'/../../Doctrine/Common/Annotations', //referente a Bludata\Doctrine\Common\Annotations
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 80 characters; contains 107 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
16
            base_path().'/vendor/symfony/validator/Constraints', //referente a Symfony\Component\Validator\Constraints
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 80 characters; contains 118 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
17
        ];
18
19
        foreach ($paths as $path) {
20
            if ($handle = opendir($path)) {
21
                while (false !== ($file = readdir($handle))) {
22
                    $pathFile = $path.'/'.$file;
23
24
                    if (pathinfo($pathFile)['extension'] == 'php') {
25
                        \Doctrine\Common\Annotations\AnnotationRegistry::registerFile($pathFile);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 80 characters; contains 97 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
26
                    }
27
                }
28
29
                closedir($handle);
30
            }
31
        }
32
    }
33
}
34