FragmentInjection::inject()   A
last analyzed

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 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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