993 B
993 B
ZAPHandler Interface
| File | Change |
|---|---|
lib/ZAPHandler.interface.php |
Created — defines ZAPHandler interface with public function getContent() |
lib/ZAPHome.class.php |
Added implements ZAPHandler |
lib/ZAPDisplay.class.php |
Added implements ZAPHandler |
lib/ZAPZap.class.php |
Added implements ZAPHandler |
lib/ZAPController.class.php |
Added instanceof ZAPHandler guard inside fetch() before calling getContent() |
How it works
- Any class named
ZAP{Mode}inlib/is autoloaded and instantiated byZAPController - The controller now checks
$this->action instanceof ZAPHandlerbefore callinggetContent() - If a handler forgets to implement the interface, you get a clear
die()message instead of a cryptic runtime error - The interface file uses the
.interface.phpnaming convention, which the existing autoloader already handles (it checks.interface.phpfirst, then.class.php)