GarbageCollector.php
00001 <?php
00015 class Dsao_GarbageCollector
00016 {
00020 protected $_items;
00021
00043 public function __construct(array $items)
00044 {
00045 $this->_items = array();
00046
00047 foreach ($items as $item)
00048 {
00049 $this->_items[] = new Dsao_GarbageCollector_Item($item);
00050 }
00051 }
00052
00063 public function addItem($method, $object = null, $probability = 10)
00064 {
00065 $this->_items[] =
00066 new Dsao_GarbageCollector_Item($method, $object, $probability);
00067
00068 return $this;
00069 }
00070
00076 public function run()
00077 {
00078 foreach ($this->_items as $item)
00079 {
00080 $item->run();
00081 }
00082
00083 return $this;
00084 }
00085 }