| 1 | <?php |
||
| 9 | class HelpDocument implements DomDataInterface |
||
| 10 | { |
||
| 11 | /** var Command */ |
||
| 12 | protected $command; |
||
| 13 | |||
| 14 | /** var \DOMDocument */ |
||
| 15 | protected $dom; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Create a help document from a Symfony Console command |
||
| 19 | */ |
||
| 20 | public function __construct(Command $command) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Convert data into a \DomDocument. |
||
| 31 | * |
||
| 32 | * @return \DomDocument |
||
| 33 | */ |
||
| 34 | public function getDomData() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Create the base help DOM prior to alteration by the Command object. |
||
| 41 | * @param Command $command |
||
| 42 | * @return \DomDocument |
||
| 43 | */ |
||
| 44 | private static function generateBaseHelpDom(Command $command) |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Alter the DOM document per the command object |
||
| 54 | * @param Command $command |
||
| 55 | * @param \DomDocument $dom |
||
| 56 | * @return \DomDocument |
||
| 57 | */ |
||
| 58 | private static function alterHelpDocument(Command $command, \DomDocument $dom) |
||
| 65 | } |
||
| 66 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClassto useselfinstead: