Passed
Branch reduce-soap-envelope-builder-c... (c98539)
by Rait
02:14
created

DOMElementAsSoapHeaderElement::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Raigu\XRoad\SoapEnvelope;
4
5
use DOMDocument;
6
use DOMElement;
7
use Raigu\XRoad\SoapEnvelope\Element\DOMElementInjection;
8
use Raigu\XRoad\SoapEnvelope\Element\XmlInjectable;
9
10
/**
11
 * I DOMElement of SOAP Header.
12
 *
13
 * I know how to inject myself into SOAP Header
14
 */
15
abstract class DOMElementAsSoapHeaderElement implements XmlInjectable
16
{
17
    /**
18
     * @var DOMElement
19
     */
20
    private $element;
21
22 2
    public function inject(DOMDocument $dom): void
23
    {
24 2
        $this->element->inject($dom);
0 ignored issues
show
Bug introduced by
The method inject() does not exist on DOMElement. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        $this->element->/** @scrutinizer ignore-call */ 
25
                        inject($dom);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25 2
    }
26
27 2
    public function __construct(DOMElement $element)
28
    {
29 2
        $this->element = new DOMElementInjection(
0 ignored issues
show
Documentation Bug introduced by
It seems like new Raigu\XRoad\SoapEnve.../', 'Header', $element) of type Raigu\XRoad\SoapEnvelope...ent\DOMElementInjection is incompatible with the declared type DOMElement of property $element.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
30 2
            'http://schemas.xmlsoap.org/soap/envelope/',
31 2
            'Header',
32
            $element
33
        );
34 2
    }
35
}
36