Application   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 6
Bugs 0 Features 1
Metric Value
wmc 3
c 6
b 0
f 1
lcom 1
cbo 1
dl 0
loc 37
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A init() 0 6 1
1
<?php
2
3
/*
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the MIT license. For more information, see
18
 * <https://github.com/baleen/migrations>.
19
 */
20
21
namespace Baleen\Cli;
22
23
use League\Container\Container;
24
use Symfony\Component\Console\Application as ConsoleApplication;
25
use Symfony\Component\Console\Helper\HelperSet;
26
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
27
28
/**
29
 * The entry point to Baleen CLI's commands.
30
 *
31
 * @author Gabriel Somoza <[email protected]>
32
 */
33
class Application extends ConsoleApplication
34
{
35
    /** Version to show in the help / usage message. */
36
    const VERSION = '0.5.0';
37
38
    /**
39
     * The League\Container instance used by Baleen CLI.
40
     *
41
     * @var Container
42
     */
43
    protected $container;
44
45
    /**
46
     * @param \Symfony\Component\Console\Command\Command[] $commands Array of Commands available for the Application.
47
     * @param HelperSet $helperSet HelperSet to be used with the Application.
48
     * @param EventDispatcherInterface $dispatcher
49
     */
50
    public function __construct(array $commands, HelperSet $helperSet, EventDispatcherInterface $dispatcher = null)
51
    {
52
        parent::__construct('Baleen', self::VERSION);
53
        if (null !== $dispatcher) {
54
            $this->setDispatcher($dispatcher);
55
        }
56
        $this->init($commands, $helperSet);
57
    }
58
59
    /**
60
     * @param \Symfony\Component\Console\Command\Command[] $commands
61
     * @param HelperSet                                    $helperSet
62
     */
63
    protected function init(array $commands, HelperSet $helperSet)
64
    {
65
        $this->setCatchExceptions(true);
66
        $this->setHelperSet($helperSet);
67
        $this->addCommands($commands);
68
    }
69
}
70