Passed
Push — master ( 09194d...95db02 )
by Yuichi
02:42
created

HelpersServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 19
ccs 11
cts 11
cp 1
rs 10
wmc 5
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A register() 0 8 3
1
<?php
2
namespace Sonar\Common;
3
use Illuminate\Filesystem\Filesystem;
4
use Illuminate\Support\ServiceProvider;
5
6
class HelpersServiceProvider extends ServiceProvider
7
{
8
    private $filesystem;
0 ignored issues
show
Unused Code introduced by
The property $filesystem is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
9
10 2
    public function __construct($app,Filesystem $file=null)
11
    {
12 2
        parent::__construct($app);
13
14 2
        $this->file_system = $file ? $file : new Filesystem;
0 ignored issues
show
Bug introduced by
The property file_system does not seem to exist. Did you mean filesystem?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
15 2
    }
16 1
    public function register()
17
    {
18 1
        foreach ( $this->file_system->allFiles(__DIR__ . '/Helpers') as $rec ) {
0 ignored issues
show
Bug introduced by
The property file_system does not seem to exist. Did you mean filesystem?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
19 1
            if ( preg_match("/\.php$/",$rec->getFilename()) ) {
20 1
                require_once($rec->getPathname());
21 1
            }
22 1
        }
23 1
    }
24
}
25