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

ServiceRequest::inject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Raigu\XRoad\SoapEnvelope;
4
5
use DOMDocument;
6
use Raigu\XRoad\SoapEnvelope\Element\FragmentInjection;
7
use Raigu\XRoad\SoapEnvelope\Element\XmlInjectable;
8
9
/**
10
 * I am a request of an X-Road service.
11
 *
12
 * I can inject myself into SOAP Envelope Body.
13
 */
14
final class ServiceRequest implements XmlInjectable
15
{
16
    /**
17
     * @var XmlInjectable
18
     */
19
    private $element;
20
21 1
    public function inject(DOMDocument $dom): void
22
    {
23 1
        $this->element->inject($dom);
24 1
    }
25
26 1
    public function __construct(string $serviceRequest)
27
    {
28 1
        $this->element = new FragmentInjection(
29 1
            'http://schemas.xmlsoap.org/soap/envelope/',
30 1
            'Body',
31
            $serviceRequest
32
        );
33 1
    }
34
}
35