Passed
Push — master ( 463105...84cd59 )
by Roberto
04:47
created

SoapClientExtended   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 36
ccs 0
cts 15
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __doRequest() 0 11 1
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...
Coding Style introduced by
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