コード例 #1
0
ファイル: Action.php プロジェクト: rexmac/zf2
 /**
  * Get the helper broker or a helper instance
  *
  * @return Broker|Action\Helper\AbstractHelper
  */
 public function broker($name = null)
 {
     if (null === $name) {
         return $this->broker;
     }
     return $this->broker->load($name);
 }
コード例 #2
0
ファイル: FilterChain.php プロジェクト: rexmac/zf2
 /**
  * Plugin Broker
  *
  * Set or retrieve the plugin broker, or retrieve a specific plugin from it.
  *
  * If $name is null, the broker instance is returned; it will be lazy-loaded
  * if not already present.
  *
  * If $name is a Broker instance, this broker instance will replace or set 
  * the internal broker, and the instance will be returned.
  *
  * If $name is a string, $name and $options will be passed to the broker's 
  * load() method.
  * 
  * @param  null|Broker|string $name 
  * @param array $options 
  * @return Broker|Filter
  */
 public function broker($name = null, $options = array())
 {
     if ($name instanceof Broker) {
         $this->broker = $broker;
         return $this->broker;
     }
     if (null === $this->broker) {
         $this->broker = new FilterBroker();
     }
     if (null === $name) {
         return $this->broker;
     }
     return $this->broker->load($name, $options);
 }