1 | <?php |
||
17 | abstract class Variable extends Def\Definition { |
||
18 | // TODO: Use these in Graph/IndexDB. |
||
19 | const NAMESPACE_TYPE = "namespace"; |
||
20 | const CLASS_TYPE = "class"; |
||
21 | const INTERFACE_TYPE = "interface"; |
||
22 | const TRAIT_TYPE = "trait"; |
||
23 | const FILE_TYPE = "file"; |
||
24 | const GLOBAL_TYPE = "global"; |
||
25 | const FUNCTION_TYPE = "function"; |
||
26 | const METHOD_TYPE = "method"; |
||
27 | const LANGUAGE_CONSTRUCT_TYPE = "language construct"; |
||
28 | |||
29 | public static function is_type($t) { |
||
43 | |||
44 | /** |
||
45 | * @var string|null |
||
46 | */ |
||
47 | private $name; |
||
48 | |||
49 | 105 | public function __construct($name = null) { |
|
53 | |||
54 | /** |
||
55 | * @return string|null |
||
56 | */ |
||
57 | 307 | public function name() { |
|
60 | |||
61 | /** |
||
62 | * @param string $name |
||
63 | * @return self |
||
64 | */ |
||
65 | 43 | public function withName($name) { |
|
71 | |||
72 | /** |
||
73 | * Get the meaning of the variable. |
||
74 | * |
||
75 | * In opposite to name, this gives insight in the structure of this variable. |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | abstract public function meaning(); |
||
80 | |||
81 | /** |
||
82 | * Compile the variable to a predicate on a graph node. |
||
83 | * |
||
84 | * @param PredicateFactory $f |
||
85 | * @return Predicate |
||
86 | */ |
||
87 | abstract public function compile(PredicateFactory $f); |
||
88 | } |
||
89 | |||
90 |