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.

SimpleSoapServer::getNameWithAge()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 29 and the first side effect is on line 6.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
use WSDL\DocumentLiteralWrapper;
3
use WSDL\WSDLCreator;
4
use WSDL\XML\Styles\DocumentLiteralWrapped;
5
6
require_once '../../vendor/autoload.php';
7
8
ini_set("soap.wsdl_cache_enabled", 0);
9
10
$wsdl = new WSDLCreator('SimpleSoapServer', 'http://localhost/wsdl-creator/examples/document_literal_wrapped/SimpleExampleSoapServer.php');
11
$wsdl->setNamespace("http://foo.bar/")->setBindingStyle(new DocumentLiteralWrapped());
12
13
if (isset($_GET['wsdl'])) {
14
    $wsdl->renderWSDL();
15
    exit;
16
}
17
18
$wsdl->renderWSDLService();
19
20
$server = new SoapServer('http://localhost/wsdl-creator/examples/document_literal_wrapped/SimpleExampleSoapServer.php?wsdl', array(
21
    'uri' => $wsdl->getNamespaceWithSanitizedClass(),
22
    'location' => $wsdl->getLocation(),
23
    'style' => SOAP_DOCUMENT,
24
    'use' => SOAP_LITERAL, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS
25
));
26
$server->setObject(new DocumentLiteralWrapper(new SimpleSoapServer()));
27
$server->handle();
28
29 View Code Duplication
class SimpleSoapServer
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
30
{
31
    /**
32
     * @WebMethod
33
     * @param string $name
34
     * @param int $age
35
     * @return string $nameWithAge
36
     */
37
    public function getNameWithAge($name, $age)
38
    {
39
        return 'Your name is: ' . $name . ' and you have ' . $age . ' years old';
40
    }
41
42
    /**
43
     * @WebMethod
44
     * @param string[] $names
45
     * @return string $userNames
46
     */
47
    public function getNameForUsers($names)
48
    {
49
        //FIXME correct array of $names
50
        return 'User names: ' . implode(', ', $names);
51
    }
52
53
    /**
54
     * @WebMethod
55
     * @param int $max
56
     * @return string[] $count
57
     */
58
    public function countTo($max)
59
    {
60
        //FIXME incorrect structure of response
61
        $array = array();
62
        for ($i = 0; $i < $max; $i++) {
63
            $array[] = 'Number: ' . ($i + 1);
64
        }
65
        return $array;
66
    }
67
}