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.

InitCommand   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 76
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
B method() 0 31 1
A separator() 0 4 1
A renderMethodsTable() 0 7 1
A _getRows() 0 6 1
A serviceInfo() 0 6 1
1
<?php
2
namespace Clients;
3
4
use DOMDocument;
5
use SoapClient;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class InitCommand extends Command
11
{
12
    /**
13
     * @var OutputInterface
14
     */
15
    protected $output;
16
    /**
17
     * @var SoapClient
18
     */
19
    protected $soapClient;
20
21
    public function __construct()
22
    {
23
        parent::__construct();
24
        ini_set("soap.wsdl_cache_enabled", 0);
25
    }
26
27
    protected function method($method, $requestParams, $response)
28
    {
29
        $this->separator();
30
31
        $this->output->writeln('Method <info>' . $method . '</info>:');
32
        $this->output->writeln('');
33
34
        $this->output->writeln('<comment>Request params:</comment>');
35
        $output = $this->output;
36
        array_walk($requestParams, function ($param, $key) use ($output) {
37
            $output->writeln('Param ' . ($key + 1) . ':');
38
            var_dump($param);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($param); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
39
            $output->writeln('');
40
        });
41
42
        $this->output->writeln('<comment>Response:</comment>');
43
        print_r($response);
44
        $this->output->writeln('');
45
        $this->output->writeln('');
46
47
        $DOMDocument = new DOMDocument();
48
        $DOMDocument->formatOutput = true;
49
50
        $this->output->writeln('<comment>Request headers:</comment>');
51
        $DOMDocument->loadXML($this->soapClient->__getLastRequest());
52
        $this->output->writeln($DOMDocument->saveXML());
53
54
        $this->output->writeln('<comment>Response headers:</comment>');
55
        $DOMDocument->loadXML($this->soapClient->__getLastResponse());
56
        $this->output->writeln($DOMDocument->saveXML());
57
    }
58
59
    protected function separator()
60
    {
61
        return $this->output->writeln("\n---------\n");
62
    }
63
64
    protected function renderMethodsTable()
65
    {
66
        $table = $this->getHelper('table');
67
        $table->setHeaders(array('Method name'));
68
        $table->setRows($this->_getRows());
69
        $table->render($this->output);
70
    }
71
72
    private function _getRows()
73
    {
74
        return array_map(function ($function) {
75
            return array($function);
76
        }, $this->soapClient->__getFunctions());
77
    }
78
79
    protected function serviceInfo($name)
80
    {
81
        $style = new OutputFormatterStyle('red', 'green', array('bold'));
82
        $this->output->getFormatter()->setStyle('header', $style);
83
        $this->output->writeln("<header>\n\t$name\n</header>");
84
    }
85
}