| 1 | <?php |
||
| 19 | class RelativeClause |
||
| 20 | { |
||
| 21 | const RELATIVE_DIRECTIVE = '@.'; |
||
| 22 | const SELF_DIRECTIVE = '@self.'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var TableInterface |
||
| 26 | */ |
||
| 27 | private $relatedTable; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var string |
||
| 31 | */ |
||
| 32 | private $clause; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param TableInterface $relatedTo |
||
| 36 | * @param string $clause |
||
| 37 | * @param string $directive |
||
| 38 | */ |
||
| 39 | public function __construct(TableInterface $relatedTo, $clause, $directive) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return string |
||
| 48 | */ |
||
| 49 | public function __toString() |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return TableInterface |
||
| 56 | */ |
||
| 57 | public function getRelatedTable() |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @return string |
||
| 64 | */ |
||
| 65 | public function getClause() |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | public function getDirective() |
||
| 77 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: