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

HelpersServiceProvider::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 3
c 1
b 0
f 1
nc 2
nop 2
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
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