GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractBaseCommand   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 5
dl 0
loc 90
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A configureFormatter() 0 22 1
A createProgressBar() 0 12 1
A writeTaskStart() 0 4 1
A writeTaskSuccess() 0 4 1
A writeTaskFailure() 0 4 1
A writeSuccessMessage() 0 4 1
A writeErrorMessage() 0 4 1
1
<?php
2
3
namespace Nimble\ElasticBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
7
use Symfony\Component\Console\Helper\ProgressBar;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
abstract class AbstractBaseCommand extends ContainerAwareCommand
11
{
12
    const TASKS_PAD_LENGTH = 88;
13
14
    /**
15
     * Configures common formatting.
16
     */
17
    protected function configureFormatter(OutputInterface $output)
18
    {
19
        $output->getFormatter()->setStyle('info', new OutputFormatterStyle(
20
            'blue', null
21
        ));
22
23
        $output->getFormatter()->setStyle('error', new OutputFormatterStyle(
24
            'red', null
25
        ));
26
27
        $output->getFormatter()->setStyle('success', new OutputFormatterStyle(
28
            'green', null
29
        ));
30
31
        $output->getFormatter()->setStyle('warning', new OutputFormatterStyle(
32
            'yellow', null
33
        ));
34
35
        $output->getFormatter()->setStyle('graphic', new OutputFormatterStyle(
36
            'cyan', null
37
        ));
38
    }
39
40
    /**
41
     * @param OutputInterface $output
42
     * @return ProgressBar
43
     */
44
    protected function createProgressBar(OutputInterface $output)
45
    {
46
        $progress = new ProgressBar($output);
47
48
        $progress->setBarWidth(50);
49
        $progress->setFormat('%current%/%max% (%percent:2s%%) [%bar%] <info>%elapsed:6s%</info> (EST %estimated:6s%) %memory:6s%');
50
        $progress->setBarCharacter('<success>=</success>');
51
        $progress->setProgressCharacter('<success>></success>');
52
        $progress->setEmptyBarCharacter('<error>=</error>');
53
54
        return $progress;
55
    }
56
57
    /**
58
     * @param OutputInterface $output
59
     * @param string $name
60
     */
61
    protected function writeTaskStart(OutputInterface $output, $name)
62
    {
63
        $output->write(str_pad(sprintf('<graphic>•</graphic> %s ', $name), self::TASKS_PAD_LENGTH, '.', STR_PAD_RIGHT));
64
    }
65
66
    /**
67
     * @param OutputInterface $output
68
     */
69
    protected function writeTaskSuccess(OutputInterface $output)
70
    {
71
        $output->writeln(' <success>✓</success>');
72
    }
73
74
    /**
75
     * @param OutputInterface $output
76
     */
77
    protected function writeTaskFailure(OutputInterface $output)
78
    {
79
        $output->writeln(' <error>✗</error>');
80
    }
81
82
    /**
83
     * @param OutputInterface $output
84
     * @param string $message
85
     */
86
    protected function writeSuccessMessage(OutputInterface $output, $message = '')
87
    {
88
        $output->writeln("\n" . '<success>✓</success> ' . $message);
89
    }
90
91
    /**
92
     * @param OutputInterface $output
93
     * @param string $message
94
     */
95
    protected function writeErrorMessage(OutputInterface $output, $message = '')
96
    {
97
        $output->writeln("\n" . '<error>✗</error> ' . $message);
98
    }
99
}
100