ProvidesDi   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A di() 0 7 2
1
<?php
2
3
/*
4
 * This file is part of the PHALCON-EXT package.
5
 *
6
 * (c) Jitendra Adhikari <[email protected]>
7
 *     <https://github.com/adhocore>
8
 *
9
 * Licensed under MIT license.
10
 */
11
12
namespace PhalconExt\Di;
13
14
use Phalcon\Di;
0 ignored issues
show
Bug introduced by
The type Phalcon\Di 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...
15
16
/**
17
 * Provides di service.
18
 */
19
trait ProvidesDi
20
{
21
    /**
22
     * Provide the di instance or a service if its name is given.
23
     *
24
     * @param string|null $service
25
     * @param array       $parameters
26
     *
27
     * @return mixed
28
     */
29
    public function di(string $service = null, array $parameters = [])
30
    {
31
        if (null === $service) {
32
            return Di::getDefault();
33
        }
34
35
        return Di::getDefault()->resolve($service, $parameters);
36
    }
37
}
38