diff options
Diffstat (limited to 'core/Log/Formatter/Formatter.php')
-rw-r--r-- | core/Log/Formatter/Formatter.php | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/core/Log/Formatter/Formatter.php b/core/Log/Formatter/Formatter.php deleted file mode 100644 index 6f5ac67e64..0000000000 --- a/core/Log/Formatter/Formatter.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * Piwik - free/libre analytics platform - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -namespace Piwik\Log\Formatter; - -use Monolog\Formatter\FormatterInterface; - -/** - * Formats a log message. - * - * Follows the Chain of responsibility design pattern. - */ -abstract class Formatter implements FormatterInterface -{ - /** - * @var Formatter|null - */ - protected $next; - - public function __construct(Formatter $next = null) - { - $this->next = $next; - } - - /** - * {@inheritdoc} - */ - public function formatBatch(array $records) - { - foreach ($records as $key => $record) { - $records[$key] = $this->format($record); - } - - return $records; - } - - /** - * Chain of responsibility pattern. - * - * @param Formatter $formatter - */ - public function setNext(Formatter $formatter) - { - $this->next = $formatter; - } - - protected function next(array $record) - { - if (! $this->next) { - throw new \RuntimeException('No next formatter to call'); - } - - return $this->next->format($record); - } -} |