This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * Proxy Pattern Example | |
| * -------------------------- | |
| * | |
| * Wiki: A proxy, in its most general form, is a class functioning as an interface | |
| * to something else. The proxy could interface to * anything: a network connection, | |
| * a large object in memory, a file, or some other resource that is expensive or impossible | |
| * to duplicate. In short, a proxy is a wrapper or agent object that is being called by the | |
| * client to access the real serving object behind the scenes. Use of the proxy can simply be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| abstract class Beverage{ | |
| /* Hook methods */ | |
| public abstract function boilWater(); | |
| public abstract function brew(); | |
| public abstract function serve(); | |
| public abstract function addSupplements(); | |
| /* The template method */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * Singleton Pattern Example | |
| * -------------------------- | |
| * | |
| * Wiki: In software engineering, the singleton pattern is | |
| * a design pattern that restricts the instantiation of a | |
| * class to one * object. This is useful when exactly one object | |
| * is needed to coordinate actions across the system. | |
| * |
NewerOlder