Completed
Push — master ( 1a117b...43f8bd )
by Mikael
11:04
created

config/di/content.php (1 issue)

Check for unnecessary variable assignments.

Unused Code Major

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Configuration file for DI container.
4
 */
5
return [
6
7
    // Services to add to the container.
8 1
    "services" => [
9
        "content" => [
10
            "shared" => true,
11
            "callback" => function () {
12 1
                $content = new \Anax\Content\FileBasedContent();
13 1
                $content->setDI($this);
14
15
                // Load the configuration files
16 1
                $cfg = $this->get("configuration");
17 1
                $config = $cfg->load("content.php");
18 1
                $file = $config["file"] ?? null;
0 ignored issues
show
$file is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
19
20 1
                return $content;
21 1
            }
22
        ],
23
    ],
24
];
25