https://github.com/bariseser/php_decorator_pattern
Decorator is a structural design pattern that lets you attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors.
https://github.com/bariseser/php_decorator_pattern
decorator-pattern decorators design-architecture design-patterns php-design-pattern
Last synced: about 1 year ago
JSON representation
Decorator is a structural design pattern that lets you attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors.
- Host: GitHub
- URL: https://github.com/bariseser/php_decorator_pattern
- Owner: bariseser
- License: mit
- Created: 2020-02-21T20:46:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-21T20:50:42.000Z (over 6 years ago)
- Last Synced: 2025-01-18T04:26:34.165Z (over 1 year ago)
- Topics: decorator-pattern, decorators, design-architecture, design-patterns, php-design-pattern
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php_decorator_pattern
Decorator is a structural design pattern that lets you attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors.
```php
use IceCream\IceCream;
use IceCream\Nutty;
$iceCream = new IceCream();
$nutty = new Nutty($iceCream);
echo $nutty->makeIceCream() . PHP_EOL;
echo $nutty->getPrice() . PHP_EOL;
```