PEIP_Parameter_Holder_Collection.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of the PEIP package.
00005  * (c) 2010 Timo Michna <timomichna/yahoo.de>
00006  * 
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00022 class PEIP_Parameter_Holder_Collection 
00023     implements PEIP_INF_Parameter_Holder_Collection {
00024 
00025     protected $factory;
00026     
00027     protected $stores;
00028 
00029     
00035     public function __construct(PEIP_INF_Dedicated_Factory $factory){
00036         $this->factory = $factory;
00037     }
00038 
00039     
00045     protected function getParameterHolderOrCreate($namespace){
00046         if(!$this->hasParameterHolder($namespace)){
00047             $store = $this->factory->build();
00048             if($store instanceof PEIP_INF_Parameter_Holder){
00049                 $this->stores[$namespace] = $store;
00050             }else{
00051                 throw new Exception('Could not build Instance of PEIP_INF_Parameter_Holder from factory.');
00052             }
00053         }
00054         return $this->stores[$namespace];
00055     }   
00056     
00057   
00072     public function setParameters($namespace, array $parameters){
00073         $this->getParameterHolderOrCreate($namespace)->setParameters($parameters);
00074    }
00075   
00076   
00083     public function addParameters($namespace, array $parameters){
00084         $this->getParameterHolderOrCreate($namespace)->addParameters($parameters);
00085    }
00086   
00087   
00100     public function getParameters($namespace){
00101         $this->getParameterHolderOrCreate($namespace)->getParameters();
00102    }
00103   
00104   
00111     public function getParameter($namespace, $name){
00112         $this->getParameterHolderOrCreate($namespace)->getParameter($name);
00113    }
00114   
00115   
00123     public function setParameter($namespace, $name, $value){
00124         $this->getParameterHolderOrCreate($namespace)->setParameters($parameters);
00125    }
00126   
00127   
00134     public function hasParameter($namespace, $name){
00135         $this->getParameterHolderOrCreate($namespace)->hasParameter($name);
00136    }
00137 
00138   
00145     public function deleteParameter($namespace, $name){
00146         $this->getParameterHolderOrCreate($namespace)->setParameters($parameters);
00147    }
00148 
00149   
00164     public function setParameterHolder($namespace, PEIP_INF_Parameter_Holder $holder){
00165     $this->stores[$namespace] = $holder;
00166   } 
00167 
00168   
00181     public function getParameterHolder($namespace){
00182     return $this->stores[$namespace];
00183   }
00184 
00185   
00198     public function hasParameterHolder($namespace){
00199     return array_key_exists($namespace, $this->stores);
00200   }
00201 
00202   
00215     public function deleteParameterHolder($namespace){
00216     unset($this->stores[$namespace]);
00217   } 
00218     
00219     
00220 
00221 
00222 }

Generated on Mon Apr 12 11:39:00 2010 for PEIP by  doxygen 1.5.1