Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDotPro committed Jun 25, 2012
8 parents ab7d56c + 6dbeef6 + 84670b1 + cccfba9 + 2717653 + b4dd364 + 460818e + e904d92 commit 436e613
Show file tree
Hide file tree
Showing 10 changed files with 224 additions and 3,514 deletions.
54 changes: 0 additions & 54 deletions src/FilterBroker.php

This file was deleted.

77 changes: 16 additions & 61 deletions src/FilterChain.php
Expand Up @@ -21,8 +21,6 @@
namespace Zend\Filter;

use Countable;
use Zend\Loader\Broker;
use Zend\Loader\Pluggable;
use Zend\Stdlib\SplPriorityQueue;

/**
Expand All @@ -31,19 +29,17 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class FilterChain extends AbstractFilter implements
Pluggable,
Countable
class FilterChain extends AbstractFilter implements Countable
{
/**
* Default priority at which filters are added
*/
const DEFAULT_PRIORITY = 1000;

/**
* @var Broker
* @var FilterPluginManager
*/
protected $broker;
protected $plugins;

/**
* Filter chain
Expand Down Expand Up @@ -116,34 +112,27 @@ public function count()
}

/**
* Get plugin broker instance
* Get plugin manager instance
*
* @return Zend\Loader\Broker
* @return FilterPluginManager
*/
public function getBroker()
public function getPluginManager()
{
if (!$this->broker) {
$this->setBroker(new FilterBroker());
if (!$this->plugins) {
$this->setPluginManager(new FilterPluginManager());
}
return $this->broker;
return $this->plugins;
}

/**
* Set plugin broker instance
* Set plugin manager instance
*
* @param string|Broker $broker Plugin broker to load plugins
* @param FilterPluginManager $plugins
* @return FilterChain
*/
public function setBroker($broker)
public function setPluginManager(FilterPluginManager $plugins)
{
if (!$broker instanceof Broker) {
throw new Exception\InvalidArgumentException(sprintf(
'%s expects an argument of type Zend\Loader\Broker; received "%s"',
__METHOD__,
(is_object($broker) ? get_class($broker) : gettype($broker))
));
}
$this->broker = $broker;
$this->plugins = $plugins;
return $this;
}

Expand All @@ -156,42 +145,8 @@ public function setBroker($broker)
*/
public function plugin($name, array $options = array())
{
$broker = $this->getBroker();
return $broker->load($name, $options);
}

/**
* 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|FilterInterface
*/
public function broker($name = null, $options = array())
{
if ($name instanceof Broker) {
$this->setBroker($name);
return $this->broker;
}

$broker = $this->getBroker();

if (null === $name) {
return $broker;
}

return $broker->load($name, $options);
$plugins = $this->getPluginManager();
return $plugins->get($name, $options);
}

/**
Expand Down Expand Up @@ -238,7 +193,7 @@ public function attachByName($name, $options = array(), $priority = self::DEFAUL
$options = array($options);
}
}
$filter = $this->broker($name, $options);
$filter = $this->getPluginManager()->get($name, $options);
return $this->attach($filter, $priority);
}

Expand Down
153 changes: 0 additions & 153 deletions src/FilterLoader.php

This file was deleted.

0 comments on commit 436e613

Please sign in to comment.