dantleech/decorator-generator

Generate decorators for PHP classes

dev-master 2015-05-11 12:50 UTC

This package is auto-updated.

Last update: 2024-10-29 03:28:00 UTC


README

This is a small library for generating decorators for objects. Its only purpose is to provide the object with a new class name whilst maintaining its class type.

$object = new \stdClass;

$factory = new DecoratorFactory('/path/to/cache', new DecoratorGenerator());
$decorator = $factory->generate($object, 'NewClass\Fqn\ClassName');
$decorated = new \NewClass\Fqn\ClassName();