<?php

class decorator {
  protected $decoratee;
  function __construct( $object ) {
    $this->decoratee = $object;
  }
}

class test {
  function addObject( &$object ) {
    $object = $this->decorate( $object );
  }
  function addObjects( array &$objects ) {
    foreach( $objects as &$object ) {
      $this->addObject( $object );
    }
  }
  function decorate( $object ) {
    return new decorator( $object );
  }
}

$dec = new test;
$std = new StdClass;
$a = array( $std );
$dec->addObjects( $a);
print_r( $std );