-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNodeProcessorContext.php
51 lines (42 loc) · 1.01 KB
/
NodeProcessorContext.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
declare(strict_types=1);
namespace Netlogix\XmlProcessor\NodeProcessor\Context;
use Netlogix\XmlProcessor\XmlProcessorContext;
class NodeProcessorContext
{
private XmlProcessorContext $xmlProcessorContext;
/**
* @var array<string>
*/
private array $nodePath;
/**
* @param array<string> $nodePath
*/
public function __construct(
XmlProcessorContext $xmlProcessorContext,
array $nodePath
)
{
$this->xmlProcessorContext = $xmlProcessorContext;
$this->nodePath = $nodePath;
}
public function getXmlProcessorContext(): XmlProcessorContext
{
return $this->xmlProcessorContext;
}
public function getCurrentNodeName(): ?string
{
return end($this->nodePath) ?: NULL;
}
public function getNodePath(): string
{
return implode('/', $this->nodePath);
}
/**
* @return string[]
*/
public function getNodePathArray(): array
{
return $this->nodePath;
}
}