Skip to content

Instantly share code, notes, and snippets.

@lloc
Created October 2, 2011 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lloc/1257185 to your computer and use it in GitHub Desktop.
Save lloc/1257185 to your computer and use it in GitHub Desktop.
Decorator Example Old
<?php
class Decorator {
var $_obj;
function Decorator ($obj) {
$this->_obj = $obj;
}
}
class PDecorator extends Decorator {
function repr () {
return '<p>' . $this->_obj->repr() . '</p>';
}
}
class DivDecorator extends Decorator {
function repr () {
return ' <div>' . $this->_obj->repr() . '</div> ';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment