Completed
Push — master ( c132c8...42afef )
by Dmitry
06:08
created

Application   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 4
Metric Value
wmc 3
c 5
b 0
f 4
lcom 0
cbo 4
dl 0
loc 28
ccs 15
cts 15
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A get() 0 4 1
A dispatch() 0 4 1
1
<?php
2
3
namespace Basis;
4
5
use League\Container\Container;
6
use League\Container\ReflectionContainer;
7
8
class Application
9
{
10 10
    function __construct($root)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
11
    {
12 10
        $container = $this->container = new Container;
0 ignored issues
show
Bug introduced by
The property container does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
13
14 10
        $container->share(Container::class, $container);
15 10
        $container->share(Application::class, $this);
16 10
        $container->share(Filesystem::class, new Filesystem($this, $root));
17 10
        $container->share(Framework::class, new Framework($this));
0 ignored issues
show
Unused Code introduced by
The call to Framework::__construct() has too many arguments starting with $this.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
18
19 10
        $container->addServiceProvider(Providers\Core::class);
20 10
        $container->addServiceProvider(Providers\Logging::class);
21 10
        $container->addServiceProvider(Providers\Tarantool::class);
22
23 10
        $container->delegate(new ReflectionContainer());
24 10
    }
25
26 10
    function get($class)
27
    {
28 10
        return $this->container->get($class);
29
    }
30
31 4
    function dispatch($command, $params = [])
32
    {
33 4
        return $this->get(Runner::class)->dispatch($command, $params);
34
    }
35
}