for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Phossa Project
*
* PHP version 5.4
* @category Library
* @package Phossa2\Route
* @copyright Copyright (c) 2016 phossa.com
* @license http://mit-license.org/ MIT License
* @link http://www.phossa.com/
*/
/*# declare(strict_types=1); */
namespace Phossa2\Route\Traits;
use Phossa2\Route\Message\Message;
use Phossa2\Shared\Debug\DebuggableInterface;
use Phossa2\Route\Interfaces\CollectorInterface;
use Phossa2\Route\Interfaces\CollectorAwareInterface;
* CollectorAwareTrait
* Implementation of CollectorAwareInterface
* @author Hong Zhang <[email protected]>
* @see CollectorAwareInterface
* @version 2.1.0
* @since 2.0.0 added
* @since 2.1.0 added `addCollectors()`
trait CollectorAwareTrait
{
* collector pool
* @var CollectorInterface[]
* @access protected
protected $collectors = [];
* {@inheritDoc}
public function addCollector(CollectorInterface $collector)
// debugging
if ($this instanceof DebuggableInterface && $this->isDebugging()) {
$this->debug(
Message::get(Message::RTE_COLLECTOR_ADD, get_class($collector))
);
$this->delegateDebugger($collector);
}
$this->collectors[] = $collector;
return $this;
public function addCollectors(array $collectors)
foreach ($collectors as $coll) {
$this->addCollector($coll);
public function getCollectors()/*# : array */
return $this->collectors;