Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
[zen-44][#1801] Created default FirePHP implementation of FirePhpInte…
Browse files Browse the repository at this point in the history
…rface

- Created a bridge, FirePhpBridge, to bridge the FirePHP implementation
  and the FirePhp log writer
  • Loading branch information
weierophinney committed Jul 23, 2012
1 parent 7b95aa5 commit 4dc18b1
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 7 deletions.
10 changes: 5 additions & 5 deletions library/Zend/Log/Writer/FirePhp.php
Expand Up @@ -30,10 +30,10 @@ class FirePhp extends AbstractWriter
/**
* Initializes a new instance of this class.
*
* @param FirePhpInterface $instance An instance of FirePhpInterface
* @param null|FirePhp\FirePhpInterface $instance An instance of FirePhpInterface
* that should be used for logging
*/
public function __construct(FirePhpInterface $instance)
public function __construct(FirePhp\FirePhpInterface $instance = null)
{
$this->firephp = $instance;
$this->formatter = new FirePhpFormatter();
Expand Down Expand Up @@ -82,17 +82,17 @@ protected function doWrite(array $event)
* @return FirePhpInstance
*/
public function getFirePhp()
{
{;

This comment has been minimized.

Copy link
@Maks3w

Maks3w Jul 23, 2012

Member

Typo

return $this->firephp;
}

/**
* Sets the FirePhp instance that is used for logging.
*
* @param FirePhpInterface $instance The FirePhp instance to set.
* @param FirePhp\FirePhpInterface $instance The FirePhp instance to set.
* @return FirePhp
*/
public function setFirePhp(FirePhpInterface $instance)
public function setFirePhp(FirePhp\FirePhpInterface $instance)
{
$this->firephp = $instance;
return $this;
Expand Down
112 changes: 112 additions & 0 deletions library/Zend/Log/Writer/FirePhp/FirePhpBridge.php
@@ -0,0 +1,112 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Log
*/

namespace Zend\Log\Writer\FirePhp;

use FirePHP;

/**
* @category Zend
* @package Zend_Log
* @subpackage Writer
*/
class FirePhpBridge implements FirePhpInterface
{
/**
* FirePHP instance
* @var FirePHP
*/
protected $firephp;

/**
* Constructor
*
* @param FirePHP $firephp
*/
public function __construct(FirePHP $firephp)
{
$this->firephp = $firephp;
}

/**
* Retrieve FirePHP instance
*
* @return FirePHP
*/
public function getFirePhp()
{
return $this->firephp;
}

/**
* Determine whether or not FirePHP is enabled
*
* @return bool
*/
public function getEnabled()
{
return $this->firephp->getEnabled();
}

/**
* Log an error message
*
* @param string $line
* @return void
*/
public function error($line)
{
return $this->firephp->error($line);
}

/**
* Log a warning
*
* @param string $line
* @return void
*/
public function warn($line)
{
return $this->firephp->warn($line);
}

/**
* Log informational message
*
* @param string $line
* @return void
*/
public function info($line)
{
return $this->firephp->info($line);
}

/**
* Log a trace
*
* @param string $line
* @return void
*/
public function trace($line)
{
return $this->firephp->trace($line);
}

/**
* Log a message
*
* @param string $line
* @return void
*/
public function log($line)
{
return $this->firephp->trace($line);
}
}
Expand Up @@ -7,14 +7,14 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Log
*/
namespace Zend\Log\Writer;

namespace Zend\Log\Writer\FirePhp;

/**
* @category Zend
* @package Zend_Log
* @subpackage Writer
*/

interface FirePhpInterface
{
public function getEnabled();
Expand Down

0 comments on commit 4dc18b1

Please sign in to comment.