|
@@ -27,6 +27,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa
|
|
|
{
|
|
{
|
|
|
use ProcessableHandlerTrait;
|
|
use ProcessableHandlerTrait;
|
|
|
|
|
|
|
|
|
|
+ /** @var HandlerInterface */
|
|
|
protected $handler;
|
|
protected $handler;
|
|
|
protected $bufferSize = 0;
|
|
protected $bufferSize = 0;
|
|
|
protected $bufferLimit;
|
|
protected $bufferLimit;
|
|
@@ -137,9 +138,13 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa
|
|
|
*/
|
|
*/
|
|
|
public function setFormatter(FormatterInterface $formatter): HandlerInterface
|
|
public function setFormatter(FormatterInterface $formatter): HandlerInterface
|
|
|
{
|
|
{
|
|
|
- $this->handler->setFormatter($formatter);
|
|
|
|
|
|
|
+ if ($this->handler instanceof FormattableHandlerInterface) {
|
|
|
|
|
+ $this->handler->setFormatter($formatter);
|
|
|
|
|
|
|
|
- return $this;
|
|
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ throw new \UnexpectedValueException('The nested handler of type '.get_class($this->handler).' does not support formatters.');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -147,6 +152,10 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa
|
|
|
*/
|
|
*/
|
|
|
public function getFormatter(): FormatterInterface
|
|
public function getFormatter(): FormatterInterface
|
|
|
{
|
|
{
|
|
|
- return $this->handler->getFormatter();
|
|
|
|
|
|
|
+ if ($this->handler instanceof FormattableHandlerInterface) {
|
|
|
|
|
+ return $this->handler->getFormatter();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ throw new \UnexpectedValueException('The nested handler of type '.get_class($this->handler).' does not support formatters.');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|