ServiceRequest::inject()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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
    public function inject(DOMDocument $dom): void
22
    {
23
        $this->element->inject($dom);
24
    }
25
26
    /**
27
     * @param string $serviceRequest service request as XML.
28
     *                               Demo video how you can construct me:
29
     *                               https://www.youtube.com/watch?v=ziQIwlTtPLA
30
     */
31
    public function __construct(string $serviceRequest)
32
    {
33
        $this->element = new FragmentInjection(
34
            'http://schemas.xmlsoap.org/soap/envelope/',
35
            'Body',
36
            $serviceRequest
37
        );
38
    }
39
}
40