1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace DependencyAnalyzer\DependencyGraph\FullyQualifiedStructuralElementName; |
5
|
|
|
|
6
|
|
|
use DependencyAnalyzer\DependencyGraph\FullyQualifiedStructuralElementName; |
7
|
|
|
|
8
|
|
|
abstract class Base |
9
|
|
|
{ |
10
|
|
|
abstract public function getType(): string; |
11
|
|
|
abstract public function include(Base $that): bool; |
12
|
|
|
abstract public function getFullyQualifiedNamespaceNameAsArray(): array; |
13
|
|
|
abstract public function getFullyQualifiedClassNameAsArray(): ?array; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
protected $elementName; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @param string $elementName |
22
|
|
|
* @deps-internal \DependencyAnalyzer\DependencyGraph\FullyQualifiedStructuralElementName |
23
|
|
|
* @deps-internal \DependencyAnalyzer\DependencyGraph\FullyQualifiedStructuralElementName\ |
24
|
|
|
*/ |
25
|
|
|
public function __construct(string $elementName) |
26
|
|
|
{ |
27
|
|
|
$this->elementName = $elementName; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function toString(): string |
31
|
|
|
{ |
32
|
|
|
return $this->elementName; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function isNamespace(): bool |
36
|
|
|
{ |
37
|
|
|
return false; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function isClass(): bool |
41
|
|
|
{ |
42
|
|
|
return false; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function isMethod(): bool |
46
|
|
|
{ |
47
|
|
|
return false; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function isProperty(): bool |
51
|
|
|
{ |
52
|
|
|
return false; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function isClassConstant(): bool |
56
|
|
|
{ |
57
|
|
|
return false; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function isInterface(): bool |
61
|
|
|
{ |
62
|
|
|
return false; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function isTrait(): bool |
66
|
|
|
{ |
67
|
|
|
return false; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function isFunction(): bool |
71
|
|
|
{ |
72
|
|
|
return false; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function isConstant(): bool |
76
|
|
|
{ |
77
|
|
|
return false; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function isSame(Base $that): bool |
81
|
|
|
{ |
82
|
|
|
return $this->getType() === $that->getType() && $this->toString() === $that->toString(); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getFullyQualifiedNamespaceName(): Namespace_ |
86
|
|
|
{ |
87
|
|
|
return FullyQualifiedStructuralElementName::createNamespace(implode('\\', $this->getFullyQualifiedNamespaceNameAsArray())); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|