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.
Completed
Pull Request — master (#60)
by Marc
02:41
created

InfoCommand::process()   C

Complexity

Conditions 8
Paths 8

Size

Total Lines 37
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 24
CRAP Score 8

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 37
ccs 24
cts 24
cp 1
rs 5.3846
cc 8
eloc 20
nc 8
nop 0
crap 8
1
<?php
2
/**
3
 * @package: chapi
4
 *
5
 * @author:  msiebeneicher
6
 * @since:   2015-07-30
7
 *
8
 */
9
10
namespace Chapi\Commands;
11
12
use Chapi\Service\JobRepository\JobRepositoryInterface;
13
use Symfony\Component\Console\Helper\Table;
14
use Symfony\Component\Console\Input\InputArgument;
15
16
class InfoCommand extends AbstractCommand
17
{
18
    /**
19
     * Configures the current command.
20
     */
21 1
    protected function configure()
22
    {
23 1
        $this->setName('info')
24 1
            ->setDescription('Display your job information from chronos')
25 1
            ->addArgument('jobName', InputArgument::REQUIRED, 'selected job')
26
        ;
27 1
    }
28
29
    /**
30
     * @return int
31
     */
32 1
    protected function process()
33
    {
34
        /** @var JobRepositoryInterface  $_oJobRepositoryChronos */
35 1
        $_oJobRepositoryChronos = $this->getContainer()->get(JobRepositoryInterface::DIC_NAME_CHRONOS);
36
37 1
        $_sJobName = $this->oInput->getArgument('jobName');
38 1
        $_oJobEntity = $_oJobRepositoryChronos->getJob($_sJobName);
39
40 1
        $this->oOutput->writeln(sprintf("\n<comment>info '%s'</comment>\n", $_oJobEntity->name));
41
42 1
        $_oTable = new Table($this->oOutput);
43 1
        $_oTable->setHeaders(array('Property', 'Value'));
44
45 1
        foreach ($_oJobEntity as $_sKey => $_mValue)
46
        {
47 1
            if (is_array($_mValue) || is_object($_mValue))
48 1
            {
49 1
                $_sEmptyString = (is_object($_mValue)) ? '{ }' : '[ ]';
50
51 1
                $_mValue = (!empty($_mValue))
52 1
                    ? json_encode($_mValue, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
53 1
                    : $_sEmptyString;
54 1
            }
55 1
            elseif (is_bool($_mValue))
56
            {
57 1
                $_mValue = (true === $_mValue)
58 1
                    ? 'true'
59 1
                    : 'false';
60 1
            }
61
62 1
            $_oTable->addRow(array($_sKey, $_mValue));
63 1
        }
64
65 1
        $_oTable->render();
66
67 1
        return 0;
68
    }
69
}