1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-23 17:46:09 +02:00

Made the write method protected

Tests are not a good reason to make it public.
This commit is contained in:
Christophe Coevoet
2011-04-06 13:22:06 +02:00
parent 87332a3e4e
commit 3cb3dbdc8f
16 changed files with 125 additions and 124 deletions

View File

@@ -41,24 +41,6 @@ class StreamHandler extends AbstractHandler
}
}
/**
* {@inheritdoc}
*/
public function write(array $record)
{
if (null === $this->stream) {
if (!$this->url) {
throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
}
$this->stream = fopen($this->url, 'a');
if (!is_resource($this->stream)) {
$this->stream = null;
throw new \UnexpectedValueException('The stream could not be opened, "'.$this->url.'" may be an invalid url.');
}
}
fwrite($this->stream, (string) $record['message']);
}
/**
* {@inheritdoc}
*/
@@ -69,4 +51,22 @@ class StreamHandler extends AbstractHandler
$this->stream = null;
}
}
/**
* {@inheritdoc}
*/
protected function write(array $record)
{
if (null === $this->stream) {
if (!$this->url) {
throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
}
$this->stream = @fopen($this->url, 'a');
if (!is_resource($this->stream)) {
$this->stream = null;
throw new \UnexpectedValueException('The stream could not be opened, "'.$this->url.'" may be an invalid url.');
}
}
fwrite($this->stream, (string) $record['message']);
}
}