Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed CS

  • Loading branch information...
commit 1c54d2da7467c5436a50483a85972d92fe2616f8 1 parent 904e035
@stefankleff stefankleff authored
View
10 library/Zend/Log/Writer/FingersCrossed.php
@@ -73,7 +73,7 @@ class FingersCrossed extends AbstractWriter
public function __construct(WriterInterface $writer, $activationStrategyOrPriority = null, $bufferSize = 0)
{
$this->writer = $writer;
-
+
if ($activationStrategyOrPriority === null) {
$this->activationStrategy = new ErrorLevelActivationStrategy(Logger::WARN);
} elseif (! $activationStrategyOrPriority instanceof ActivationStrategyInterface) {
@@ -81,7 +81,7 @@ public function __construct(WriterInterface $writer, $activationStrategyOrPriori
} else {
$this->activationStrategy = $activationStrategyOrPriority;
}
-
+
$this->bufferSize = $bufferSize;
}
@@ -95,14 +95,14 @@ protected function doWrite(array $event)
{
if ($this->buffering) {
$this->buffer[] = $event;
-
+
if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
array_shift($this->buffer);
}
-
+
if ($this->activationStrategy->isWriterActivated($event)) {
$this->buffering = false;
-
+
foreach ($this->buffer as $bufferedEvent) {
$this->writer->write($bufferedEvent);
}
View
16 tests/ZendTest/Log/Writer/FingersCrossedTest.php
@@ -26,32 +26,32 @@ public function testBuffering()
{
$wrappedWriter = new MockWriter();
$writer = new FingersCrossedWriter($wrappedWriter, 2);
-
+
$writer->write(array('priority' => 3, 'message' => 'foo'));
-
+
$this->assertSame(count($wrappedWriter->events), 0);
}
-
+
public function testFlushing()
{
$wrappedWriter = new MockWriter();
$writer = new FingersCrossedWriter($wrappedWriter, 2);
-
+
$writer->write(array('priority' => 3, 'message' => 'foo'));
$writer->write(array('priority' => 1, 'message' => 'bar'));
-
+
$this->assertSame(count($wrappedWriter->events), 2);
}
-
+
public function testAfterFlushing()
{
$wrappedWriter = new MockWriter();
$writer = new FingersCrossedWriter($wrappedWriter, 2);
-
+
$writer->write(array('priority' => 3, 'message' => 'foo'));
$writer->write(array('priority' => 1, 'message' => 'bar'));
$writer->write(array('priority' => 3, 'message' => 'bar'));
-
+
$this->assertSame(count($wrappedWriter->events), 3);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.