| 1 | <?php |
||
| 18 | abstract class Builder |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var array |
||
| 22 | */ |
||
| 23 | protected $children = []; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var int |
||
| 27 | */ |
||
| 28 | protected $id; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var Mapping |
||
| 32 | */ |
||
| 33 | protected $mapper; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var null|string |
||
| 37 | */ |
||
| 38 | protected $name; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Builder constructor. |
||
| 42 | * @param Mapping $mapper |
||
| 43 | * @param string|null $name |
||
| 44 | */ |
||
| 45 | public function __construct(Mapping $mapper, string $name = null) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return int |
||
| 53 | */ |
||
| 54 | public function getId(): int |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param string $name |
||
| 65 | */ |
||
| 66 | public function rename(string $name): void |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @param int $child |
||
| 73 | */ |
||
| 74 | public function addChild(int $child): void |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @param Builder $builder |
||
| 81 | */ |
||
| 82 | public function addChildBuilder(Builder $builder): void |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @param array $builders |
||
| 89 | */ |
||
| 90 | public function addChildrenBuilders(array $builders): void |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @return bool |
||
| 99 | */ |
||
| 100 | public function hasName(): bool |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @return Symbol |
||
| 107 | */ |
||
| 108 | abstract public function reduce(): Symbol; |
||
| 109 | } |
||
| 110 |