FixtureServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 50
rs 10
wmc 3

4 Methods

Rating   Name   Duplication   Size   Complexity  
A extendFileManager() 0 4 1
anonymous() 0 2 ?
A loadPath() 0 3 1
A register() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PrettyBx\Fixtures;
6
7
use PrettyBx\Support\Base\AbstractServiceProvider;
8
use PrettyBx\Support\Filesystem\Manager;
9
use PrettyBx\Support\Contracts\ConfigurationContract;
0 ignored issues
show
Bug introduced by
The type PrettyBx\Support\Contracts\ConfigurationContract was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
class FixtureServiceProvider extends AbstractServiceProvider
12
{
13
    /**
14
     * @var string $path
15
     */
16
    protected $path;
17
18
    /**
19
     * @var array $singletons
20
     */
21
    protected $singletons = [
22
        FixtureManager::class => function() {
23
            return new FixtureManager($this->path);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
24
        }
25
    ];
26
27
    /**
28
     * @inheritDoc
29
     */
30
    public function register(): void
31
    {
32
        parent::register();
33
34
        $this->extendFileManager();
35
36
        $this->loadPath();
37
    }
38
39
    /**
40
     * Add include method into File Manager
41
     *
42
     * @access	protected
43
     * @return	void
44
     */
45
    protected function extendFileManager(): void
46
    {
47
        Manager::macro('include', function ($filename) {
48
            return include $filename;
49
        });
50
    }
51
52
    /**
53
     * Loads fixture path
54
     *
55
     * @access	protected
56
     * @return	void
57
     */
58
    protected function loadPath(): void
59
    {
60
        $this->path = config('fixture_path');
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

60
        $this->path = /** @scrutinizer ignore-call */ config('fixture_path');
Loading history...
61
    }
62
}
63