App   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 84
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A stopping() 0 3 1
A inputs() 0 3 1
A input() 0 3 1
A starting() 0 3 1
A named() 0 3 1
A conf() 0 3 1
A ctx() 0 3 1
A name() 0 3 1
1
<?php
2
/**
3
 * Bootstrap app
4
 * User: moyo
5
 * Date: 12/12/2017
6
 * Time: 4:44 PM
7
 */
8
9
namespace Carno\Console;
10
11
use function Carno\Config\conf;
12
use Carno\Config\Config;
13
use Carno\Console\Boot\Waited;
14
use Carno\Console\Contracts\Application;
15
use Carno\Coroutine\Context;
16
use Symfony\Component\Console\Input\InputInterface;
17
18
class App implements Application
19
{
20
    /**
21
     * @var Context
22
     */
23
    private $ctx = null;
24
25
    /**
26
     * @var Input
27
     */
28
    private $input = null;
29
30
    /**
31
     * @var Waited
32
     */
33
    private $starting = null;
34
35
    /**
36
     * @var Waited
37
     */
38
    private $stopping = null;
39
40
    /**
41
     * @return Context
42
     */
43
    public function ctx() : Context
44
    {
45
        return $this->ctx ?? $this->ctx = new Context();
46
    }
47
48
    /**
49
     * @return Config
50
     */
51
    public function conf() : Config
52
    {
53
        return conf();
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function name() : string
60
    {
61
        return $this->ctx()->get('APP_NAME') ?? '';
62
    }
63
64
    /**
65
     * @param string $name
66
     */
67
    public function named(string $name) : void
68
    {
69
        $this->ctx()->set('APP_NAME', $name);
70
    }
71
72
    /**
73
     * @return Input
74
     */
75
    public function input() : Input
76
    {
77
        return $this->input;
78
    }
79
80
    /**
81
     * @param InputInterface $set
82
     */
83
    public function inputs(InputInterface $set) : void
84
    {
85
        $this->input = new Input($set);
86
    }
87
88
    /**
89
     * @return Waited
90
     */
91
    public function starting() : Waited
92
    {
93
        return $this->starting ?? $this->starting = new Waited();
94
    }
95
96
    /**
97
     * @return Waited
98
     */
99
    public function stopping() : Waited
100
    {
101
        return $this->stopping ?? $this->stopping = new Waited();
102
    }
103
}
104