Skip to content

Commit

Permalink
use the instance config trait on dispatch filters
Browse files Browse the repository at this point in the history
  • Loading branch information
AD7six committed Mar 25, 2014
1 parent c1c64f7 commit f4d1eb1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Routing/DispatcherFilter.php
Expand Up @@ -17,9 +17,9 @@

namespace Cake\Routing;

use Cake\Core\InstanceConfigTrait;
use Cake\Event\Event;
use Cake\Event\EventListener;
use Cake\Utility\Hash;

/**
* This abstract class represents a filter to be applied to a dispatcher cycle. It acts as as
Expand All @@ -29,6 +29,8 @@
*/
abstract class DispatcherFilter implements EventListener {

use InstanceConfigTrait;

/**
* Default priority for all methods in this filter
*
Expand All @@ -37,19 +39,21 @@ abstract class DispatcherFilter implements EventListener {
public $priority = 10;

/**
* Settings for this filter
* Default config
*
* These are merged with user-provided config when the class is used.
*
* @var array
*/
public $settings = array();
protected $_defaultConfig = [];

/**
* Constructor.
*
* @param array $settings Configuration settings for the filter.
* @param array $config Settings for the filter.
*/
public function __construct($settings = array()) {
$this->settings = Hash::merge($this->settings, $settings);
public function __construct($config = []) {
$this->config($config);
}

/**
Expand Down

0 comments on commit f4d1eb1

Please sign in to comment.