Skip to content

Commit

Permalink
Writer gets messages collector, not whole phpdebugbar
Browse files Browse the repository at this point in the history
  • Loading branch information
snapshotpl committed Apr 22, 2015
1 parent 7e0fd61 commit e6b21f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/ZfSnapPhpDebugBar/Log/Writer/PhpDebugBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ZfSnapPhpDebugBar\Log\Writer;

use DebugBar\DebugBar;
use DebugBar\DataCollector\MessagesCollector;
use Zend\Log\Writer\AbstractWriter;

/**
Expand All @@ -13,17 +13,17 @@
class PhpDebugBar extends AbstractWriter
{
/**
* @var DebugBar
* @var MessagesCollector
*/
protected $debugbar;
protected $messagesCollector;

/**
*
* @param DebugBar $debugbar
* @param MessagesCollector $debugbar
*/
public function __construct(DebugBar $debugbar)
public function __construct(MessagesCollector $debugbar)
{
$this->debugbar = $debugbar;
$this->messagesCollector = $debugbar;
}

/**
Expand All @@ -32,7 +32,7 @@ public function __construct(DebugBar $debugbar)
protected function doWrite(array $event)
{
$priority = $this->priorityMap($event['priorityName']);
$this->debugbar['messages']->addMessage($event['message'], $priority);
$this->messagesCollector->addMessage($event['message'], $priority);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/ZfSnapPhpDebugBar/Log/Writer/PhpDebugBarFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public function createService(ServiceLocatorInterface $serviceLocator)
/* @var $debugbar \DebugBar\DebugBar */
$debugbar = $serviceLocator->get('debugbar');

return new PhpDebugBar($debugbar);
$messagesCollector = $debugbar['messages'];

return new PhpDebugBar($messagesCollector);
}

}

0 comments on commit e6b21f2

Please sign in to comment.