1 | <?php |
||
9 | class Class_ extends Declaration |
||
10 | { |
||
11 | protected $name; |
||
12 | |||
13 | protected $extends = null; |
||
14 | protected $implements = array(); |
||
15 | protected $type = 0; |
||
16 | |||
17 | protected $uses = array(); |
||
18 | protected $constants = array(); |
||
19 | protected $properties = array(); |
||
20 | protected $methods = array(); |
||
21 | |||
22 | /** |
||
23 | * Creates a class builder. |
||
24 | * |
||
25 | * @param string $name Name of the class |
||
26 | */ |
||
27 | public function __construct($name) { |
||
28 | $this->name = $name; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Extends a class. |
||
33 | * |
||
34 | * @param Name|string $class Name of class to extend |
||
35 | * |
||
36 | * @return $this The builder instance (for fluid interface) |
||
37 | */ |
||
38 | public function extend($class) { |
||
43 | |||
44 | /** |
||
45 | * Implements one or more interfaces. |
||
46 | * |
||
47 | * @param Name|string ...$interfaces Names of interfaces to implement |
||
48 | * |
||
49 | * @return $this The builder instance (for fluid interface) |
||
50 | */ |
||
51 | public function implement() { |
||
58 | |||
59 | /** |
||
60 | * Makes the class abstract. |
||
61 | * |
||
62 | * @return $this The builder instance (for fluid interface) |
||
63 | */ |
||
64 | public function makeAbstract() { |
||
69 | |||
70 | /** |
||
71 | * Makes the class final. |
||
72 | * |
||
73 | * @return $this The builder instance (for fluid interface) |
||
74 | */ |
||
75 | public function makeFinal() { |
||
80 | |||
81 | /** |
||
82 | * Adds a statement. |
||
83 | * |
||
84 | * @param Stmt|PhpParser\Builder $stmt The statement to add |
||
85 | * |
||
86 | * @return $this The builder instance (for fluid interface) |
||
87 | */ |
||
88 | public function addStmt($stmt) { |
||
107 | |||
108 | /** |
||
109 | * Returns the built class node. |
||
110 | * |
||
111 | * @return Stmt\Class_ The built class node |
||
112 | */ |
||
113 | public function getNode() { |
||
121 | } |