-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPath.php
More file actions
54 lines (43 loc) · 1 KB
/
Copy pathPath.php
File metadata and controls
54 lines (43 loc) · 1 KB
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
52
53
54
<?php
declare(strict_types=1);
namespace Paths;
use Paths\GraphNode\Terminal;
class Path
{
private Terminal $source;
/**
* @var array<\Paths\GraphNode\NonTerminal>
*/
private array $path;
private Terminal $target;
/**
* @param $path array<\Paths\GraphNode\NonTerminal>
*/
public function __construct(Terminal $source, array $path, Terminal $target)
{
$this->source = $source;
$this->target = $target;
$this->path = $path;
}
public function getSource(): Terminal
{
return $this->source;
}
public function getTarget(): Terminal
{
return $this->target;
}
/** @return array<\Paths\GraphNode\NonTerminal> */
public function getPath(): array
{
return $this->path;
}
public function __toString(): string
{
return implode(',', [
$this->source->__toString(),
implode('|', $this->path),
$this->target->__toString(),
]);
}
}