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.

ObjectCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 60
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 4 1
A execute() 0 52 1
1
<?php
2
namespace Clients\DocumentLiteralWrapped;
3
4
use Clients\InitCommand;
5
use SoapClient;
6
use stdClass;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class ObjectCommand extends InitCommand
11
{
12
    protected function configure()
13
    {
14
        $this->setName('document_literal:object');
15
    }
16
17
    protected function execute(InputInterface $input, OutputInterface $output)
18
    {
19
        $this->output = $output;
20
21
        $this->soapClient = new SoapClient('http://localhost/wsdl-creator/examples/document_literal_wrapped/ObjectExampleSoapServer.php?wsdl', array(
22
            'uri' => "http://foo.bar/", 'location' => 'http://localhost/wsdl-creator/examples/document_literal_wrapped/ObjectExampleSoapServer.php',
23
            'trace' => true, 'cache_wsdl' => WSDL_CACHE_NONE
24
        ));
25
26
        $this->serviceInfo('Client Object - document/literal wrapped');
27
28
        $this->renderMethodsTable();
29
30
        $user = new stdClass();
31
        $user->name = 'john';
32
        $user->age = 32;
33
        $response = $this->soapClient->userInfo(array('info' => $user));
34
        $this->method('userInfo', array(array('info' => $user)), $response);
35
36
        $params = new stdClass();
37
        $params->name = 'peter';
38
        $params->number = 999444;
39
        $response = $this->soapClient->getAgentWithId($params);
40
        $this->method('getAgentWithId', array($params), $response);
41
42
        $namesInfo = new stdClass();
43
        $namesInfo->names = array('billy', 'clark');
44
        $namesInfo->id = 333;
45
        $response = $this->soapClient->namesForId(array('namesInfo' => $namesInfo));
46
        $this->method('namesForId', array(array('namesInfo' => $namesInfo)), $response);
47
48
        $response = $this->soapClient->getCompanies();
49
        $this->method('getCompanies', array(), $response);
50
51
        $response = $this->soapClient->getListOfAgentsWithId();
52
        $this->method('getListOfAgentsWithId', array(), $response);
53
54
        $payments[0] = new stdClass();
0 ignored issues
show
Coding Style Comprehensibility introduced by
$payments was never initialized. Although not strictly required by PHP, it is generally a good practice to add $payments = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
55
        $payments[0]->payment = array(1.21, 3.21, 100.60);
56
        $payments[0]->user = 'john';
57
        $payments[1] = new stdClass();
58
        $payments[1]->payment = array(120.60);
59
        $payments[1]->user = 'peter';
60
        $response = $this->soapClient->setPayment(array('payments' => $payments));
61
        $this->method('setPayment', array(array('payments' => $payments)), $response);
62
63
        $response = $this->soapClient->getAgentsWithPayment();
64
        $this->method('getAgentsWithPayment', array(), $response);
65
66
        $response = $this->soapClient->getEmployeesWithAgents();
67
        $this->method('getEmployeesWithAgents', array(), $response);
68
    }
69
}