Application   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 10

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 2 Features 0
Metric Value
wmc 2
c 5
b 2
f 0
lcom 0
cbo 10
dl 0
loc 32
ccs 17
cts 17
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 24 2
1
<?php
2
3
namespace CL\ComposerInit;
4
5
use GuzzleHttp\Client;
6
use CL\ComposerInit\Prompt\Prompts;
7
use CL\ComposerInit\SearchCommand;
8
use CL\ComposerInit\UseCommand;
9
10
class Application extends \Symfony\Component\Console\Application
11
{
12
    /**
13
     * @var Container
14
     */
15
    private $app;
16
17 2
    public function __construct($tokenFile = '~/.composer-init')
18
    {
19 2
        parent::__construct('Composer Init', '0.3');
20
21 2
        $packagist = new Client(['base_uri' => 'https://packagist.org']);
22 2
        $token = new Token($tokenFile);
23
24 2
        $githubOptions = ['base_uri' => 'https://api.github.com'];
25
26 2
        if (null !== $token->get()) {
27 1
            $githubOptions['query']['access_token'] = $token->get();
28 1
        }
29
30 2
        $github = new Client($githubOptions);
31
32 2
        $gitConfig = new GitConfig();
33 2
        $inflector = new Inflector();
34 2
        $prompts = new Prompts($gitConfig, $github, $inflector);
35 2
        $template = new Template($github);
36
37 2
        $this->add(new SearchCommand($packagist));
38 2
        $this->add(new UseCommand($template, $prompts, $packagist));
39 2
        $this->add(new TokenCommand($token));
40 2
    }
41
}
42