Test Setup Failed
Push — master ( 4a062f...ba1251 )
by Php Easy Api
03:27
created

ContainerClosureResolver   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 12 3
1
<?php
2
3
namespace Resta\Container;
4
5
use Resta\Support\JsonHandler;
6
use Resta\Support\SuperClosure;
7
use Resta\Exception\FileNotFoundException;
8
9
class ContainerClosureResolver
10
{
11
    /**
12
     * container resolver service json file
13
     * 
14
     * @param $key
15
     * @return mixed|null
16
     *
17
     * @throws FileNotFoundException
18
     */
19
    public static function get($key)
20
    {
21
        if(file_exists(serviceJson())){
22
            JsonHandler::$file = serviceJson();
23
            $serviceJson = JsonHandler::get();
24
25
            if(isset($serviceJson['container'][$key])){
26
                return SuperClosure::get($serviceJson['container'][$key]);
0 ignored issues
show
Bug introduced by
Are you sure the usage of Resta\Support\SuperClosu...son['container'][$key]) targeting Resta\Support\SuperClosure::get() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
27
            }
28
        }
29
        
30
        return null;
31
    }
32
}