Passed
Push — master ( 0602c9...8f96ba )
by Thierry
02:02
created

AppTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 38
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A registerApp() 0 10 1
A getApp() 0 3 1
A getBootstrap() 0 3 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Jaxon\Container\Traits;
4
5
use Jaxon\Jaxon;
6
use Jaxon\App\App;
7
use Jaxon\App\Bootstrap;
8
use Jaxon\Plugin\Manager as PluginManager;
9
use Jaxon\Request\Handler\Handler as RequestHandler;
10
use Jaxon\Response\Manager as ResponseManager;
11
use Jaxon\Ui\View\Manager as ViewManager;
12
use Jaxon\Utils\Config\Reader as ConfigReader;
13
14
trait AppTrait
0 ignored issues
show
Coding Style introduced by
Missing doc comment for trait AppTrait
Loading history...
15
{
16
    /**
17
     * Register the values into the container
18
     *
19
     * @return void
20
     */
21
    private function registerApp()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
22
    {
23
        // Jaxon App
24
        $this->set(App::class, function($c) {
0 ignored issues
show
Bug introduced by
It seems like set() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        $this->/** @scrutinizer ignore-call */ 
25
               set(App::class, function($c) {
Loading history...
25
            return new App($c->g(Jaxon::class), $c->g(ResponseManager::class), $c->g(ConfigReader::class));
26
        });
27
        // Jaxon App bootstrap
28
        $this->set(Bootstrap::class, function($c) {
29
            return new Bootstrap($c->g(Jaxon::class), $c->g(PluginManager::class),
30
                $c->g(ViewManager::class), $c->g(RequestHandler::class));
31
        });
32
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
33
34
    /**
35
     * Get the App instance
36
     *
37
     * @return App
38
     */
39
    public function getApp()
40
    {
41
        return $this->g(App::class);
0 ignored issues
show
Bug introduced by
It seems like g() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
        return $this->/** @scrutinizer ignore-call */ g(App::class);
Loading history...
42
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
43
44
    /**
45
     * Get the App bootstrap
46
     *
47
     * @return Bootstrap
48
     */
49
    public function getBootstrap()
50
    {
51
        return $this->g(Bootstrap::class);
52
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
53
}
54