1 | <?php |
||
17 | abstract class Variable extends Def\Definition { |
||
18 | // TODO: Use these in Graph/IndexDB. |
||
19 | const CLASS_TYPE = "class"; |
||
20 | const INTERFACE_TYPE = "interface"; |
||
21 | const FILE_TYPE = "file"; |
||
22 | const GLOBAL_TYPE = "global"; |
||
23 | const FUNCTION_TYPE = "function"; |
||
24 | const METHOD_TYPE = "method"; |
||
25 | const LANGUAGE_CONSTRUCT_TYPE = "language construct"; |
||
26 | |||
27 | 43 | static public function is_type($t) { |
|
39 | |||
40 | /** |
||
41 | * @var string|null |
||
42 | */ |
||
43 | private $name; |
||
44 | |||
45 | 94 | public function __construct($name = null) { |
|
49 | |||
50 | /** |
||
51 | * @return string|null |
||
52 | */ |
||
53 | 301 | public function name() { |
|
56 | |||
57 | /** |
||
58 | * @param string $name |
||
59 | * @return self |
||
60 | */ |
||
61 | 37 | public function withName($name) { |
|
67 | |||
68 | /** |
||
69 | * Get the meaning of the variable. |
||
70 | * |
||
71 | * In opposite to name, this gives insight in the structure of this variable. |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | abstract public function meaning(); |
||
76 | |||
77 | /** |
||
78 | * Compile the variable to a predicate on a graph node. |
||
79 | * |
||
80 | * @return PredicateFactory $f |
||
81 | * @return Predicate |
||
82 | */ |
||
83 | abstract public function compile(PredicateFactory $f); |
||
84 | } |
||
85 | |||
86 |