Пример #1
0
 /**
  * Get the pattern broker
  *
  * @return Broker
  */
 public static function getBroker()
 {
     if (static::$broker === null) {
         static::$broker = new PatternBroker();
         static::$broker->setRegisterPluginsOnLoad(false);
     }
     return static::$broker;
 }
Пример #2
0
 /**
  * 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);
 }
Пример #3
0
 /**
  * Get the plugin broker
  *
  * @return Broker
  */
 public static function getPluginBroker()
 {
     if (static::$pluginBroker === null) {
         static::$pluginBroker = new Storage\PluginBroker();
         static::$pluginBroker->setRegisterPluginsOnLoad(false);
     }
     return static::$pluginBroker;
 }
Пример #4
0
 /**
  * Set plugin broker instance
  *
  * @param  string|Broker $broker Plugin broker to load plugins
  * @return Zend\Loader\Pluggable
  */
 public function setBroker($broker)
 {
     if (!$broker instanceof Broker) {
         throw new Exception\InvalidArgumentException('Broker must implement Zend\\Loader\\Broker');
     }
     $this->broker = $broker;
     if (method_exists($broker, 'setController')) {
         $this->broker->setController($this);
     }
     return $this;
 }
Пример #5
0
 /**
  * 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);
 }