Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
67 lines (60 sloc) 1.83 KB
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Log
*/
namespace Zend\Log\Writer;
use Zend\ServiceManager\AbstractPluginManager;
use Zend\Log\Formatter;
use Zend\Log\Exception;
/**
* @category Zend
* @package Zend_Log
*/
class FormatterPluginManager extends AbstractPluginManager
{
/**
* Default set of formatters
*
* @var array
*/
protected $invokableClasses = array(
'base' => 'Zend\Log\Formatter\Base',
'simple' => 'Zend\Log\Formatter\Simple',
'xml' => 'Zend\Log\Formatter\Xml',
'db' => 'Zend\Log\Formatter\Db',
'errorhandler' => 'Zend\Log\Formatter\ErrorHandler',
'exceptionhandler' => 'Zend\Log\Formatter\ExceptionHandler',
);
/**
* Allow many filters of the same type
*
* @var bool
*/
protected $shareByDefault = false;
/**
* Validate the plugin
*
* Checks that the formatter loaded is an instance of Formatter\FormatterInterface.
*
* @param mixed $plugin
* @return void
* @throws Exception\InvalidArgumentException if invalid
*/
public function validatePlugin($plugin)
{
if ($plugin instanceof Formatter\FormatterInterface) {
// we're okay
return;
}
throw new Exception\InvalidArgumentException(sprintf(
'Plugin of type %s is invalid; must implement %s\Formatter\FormatterInterface',
(is_object($plugin) ? get_class($plugin) : gettype($plugin)),
__NAMESPACE__
));
}
}
Jump to Line
Something went wrong with that request. Please try again.