Completed
Push — master ( ea1b5f...ff080b )
by judicael
09:32
created

Help::load()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 12
cp 0
cc 3
eloc 8
nc 3
nop 1
crap 12
1
<?php
2
3
namespace Venus\src\Batch\Controller;
4
5
use \Venus\src\Batch\common\Controller as Controller;
6
use \Venus\core\Config;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, Venus\src\Batch\Controller\Config.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
7
8
class Help extends Controller
9
{
10
    /**
11
     * Constructs a test case with the given name.
12
     *
13
     */
14
    public function __construct()
15
    {
16
        parent::__construct();
17
    }
18
19
    /**
20
     * new method to launch a web server
21
     * @param array $options
22
     * @tutorial php bin/console server:run
23
     *           php bin/console server:run -a 192.168.0.1:8000
24
     */
25
    public function load(array $options = array())
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        $BatchConf = Config::get('Route')->batch->script;
28
29
        foreach ($BatchConf as $key => $batchContent) {
30
31
            echo '-----------------------------------------------------------------------------------------------------'."\n";
32
            echo '|'.$key.' => '.$batchContent->description."\n|\n";
33
34
            foreach ($batchContent->options as $keyOption => $optionContent) {
35
36
                echo '|   '.$keyOption.' : '.$optionContent->description."\n";
37
            }
38
            echo '-----------------------------------------------------------------------------------------------------'."\n";
39
        }
40
    }
41
}
42