Test Failed
Push — master ( 91a335...e8c3d6 )
by Dmitriy
10:59
created

ObjectExpressionProvider::getFunctions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 10
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace App;
5
6
use Opis\Closure\SerializableClosure;
7
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
8
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
9
use Yiisoft\Injector\Injector;
10
11
class ObjectExpressionProvider implements ExpressionFunctionProviderInterface
12
{
13
    public function getFunctions()
14
    {
15
        return [
16
            new ExpressionFunction('object',
17
                function ($arg) {
18
                    return ($arg);
19
                }, function (array $variables, $value) {
20
                    return unserialize($value);
21
                    $injector = new Injector($variables['container']);
0 ignored issues
show
Unused Code introduced by
$injector = new Yiisoft\...variables['container']) is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
22
                    return $injector->invoke($c);
23
                }),
24
        ];
25
    }
26
}
27