ServiceRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A inject() 0 3 1
A __construct() 0 6 1
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