Esempio n. 1
0
 /**
  * Perform the actual decoration of all registered decorators for an object
  *
  * @param ObjectIdentifier  $identifier
  * @param ObjectDecoratable $delegate
  * @return ObjectDecorator  The decorated object
  */
 protected function _decorate(ObjectIdentifier $identifier, $delegate)
 {
     if ($delegate instanceof ObjectDecoratable) {
         $decorators = $identifier->getDecorators();
         foreach ($decorators as $decorator) {
             $delegate = $delegate->decorate($decorator);
         }
     }
     return $delegate;
 }
Esempio n. 2
0
 /**
  * Perform the actual decoration of all registered decorators for an object
  *
  * @param  ObjectIdentifier  $identifier
  * @param  ObjectDecoratable $delegate
  * @return ObjectDecorator  The decorated object
  */
 protected function _decorate(ObjectIdentifier $identifier, $delegate)
 {
     if ($delegate instanceof ObjectDecoratable) {
         $decorators = $identifier->getDecorators();
         foreach ($decorators as $key => $value) {
             if (is_numeric($key)) {
                 $delegate = $delegate->decorate($value);
             } else {
                 $delegate = $delegate->decorate($key, $value);
             }
         }
     }
     return $delegate;
 }