Passed
Push — master ( 767d4f...898805 )
by Roberto
44s
created

src/Soap/SoapClientExtended.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace NFePHP\Common\Soap;
4
5
use SoapClient;
6
7
class SoapClientExtended extends SoapClient
8
{
9
    /**
10
     * __construct
11
     * @param mixed $wsdl NULL for non-wsdl mode or URL string for wsdl mode
12
     * @param array $options
13
     */
14
    public function __construct($wsdl, $options)
15
    {
16
        parent::SoapClient($wsdl, $options);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (SoapClient() instead of __construct()). Are you sure this is correct? If so, you might want to change this to $this->SoapClient().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
PHP4 style calls to parent constructors are not allowed; use "parent::__construct()" instead
Loading history...
17
    }
18
    
19
    /**
20
     * __doRequest
21
     * Changes the original behavior of the class by removing prefixes,
22
     * suffixes and line breaks that are not supported by some webservices
23
     * due to their particular settings
24
     * @param  string $request
25
     * @param  string$location
26
     * @param  string $action
27
     * @param  int $version
28
     * @param  int $oneWay
29
     * @return string
30
     */
31
    public function __doRequest($request, $location, $action, $version, $oneWay = 0)
32
    {
33
        $search = [":ns1","ns1:","\n","\r"];
34
        return parent::__doRequest(
35
            str_replace($search, '', $request),
36
            $location,
37
            $action,
38
            $version,
39
            $oneWay
40
        );
41
    }
42
}
43