FragmentInjection   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A inject() 0 3 1
1
<?php
2
3
namespace Raigu\XRoad\SoapEnvelope\Element;
4
5
use DOMDocument;
6
7
/**
8
 * I append XML fragment as child to referred node.
9
 */
10
final class FragmentInjection implements XmlInjectable
11
{
12
    /**
13
     * @var DeferredFragmentInjection
14
     */
15
    private $injection;
16
17 7
    public function inject(DOMDocument $dom): void
18
    {
19 7
        $this->injection->inject($dom);
20 7
    }
21
22 7
    public function __construct(string $parentNS, string $parentTagName, string $fragment)
23
    {
24 7
        $this->injection = new DeferredFragmentInjection(
25 7
            $parentNS,
26 7
            $parentTagName,
27
            function () use ($fragment): string {
28 7
                return $fragment;
29 7
            }
30
        );
31 7
    }
32
}
33