1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-11 03:46:28 +02:00

Merge pull request #251 from Pachonk/master

PHPDoc Fixes
This commit is contained in:
Barry vd. Heuvel
2016-04-29 11:02:07 +02:00
24 changed files with 303 additions and 10 deletions

View File

@ -31,6 +31,13 @@ class CacheCacheCollector extends MonologCollector
{ {
protected $logger; protected $logger;
/**
* CacheCacheCollector constructor.
* @param Cache|null $cache
* @param Logger|null $logger
* @param bool $level
* @param bool $bubble
*/
public function __construct(Cache $cache = null, Logger $logger = null, $level = Logger::DEBUG, $bubble = true) public function __construct(Cache $cache = null, Logger $logger = null, $level = Logger::DEBUG, $bubble = true)
{ {
parent::__construct(null, $level, $bubble); parent::__construct(null, $level, $bubble);
@ -45,6 +52,9 @@ class CacheCacheCollector extends MonologCollector
} }
} }
/**
* @param Cache $cache
*/
public function addCache(Cache $cache) public function addCache(Cache $cache)
{ {
$backend = $cache->getBackend(); $backend = $cache->getBackend();
@ -55,6 +65,9 @@ class CacheCacheCollector extends MonologCollector
$this->addLogger($backend->getLogger()); $this->addLogger($backend->getLogger());
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return 'cache'; return 'cache';

View File

@ -34,6 +34,11 @@ class DoctrineCollector extends DataCollector implements Renderable, AssetProvid
{ {
protected $debugStack; protected $debugStack;
/**
* DoctrineCollector constructor.
* @param $debugStackOrEntityManager
* @throws DebugBarException
*/
public function __construct($debugStackOrEntityManager) public function __construct($debugStackOrEntityManager)
{ {
if ($debugStackOrEntityManager instanceof EntityManager) { if ($debugStackOrEntityManager instanceof EntityManager) {
@ -45,6 +50,9 @@ class DoctrineCollector extends DataCollector implements Renderable, AssetProvid
$this->debugStack = $debugStackOrEntityManager; $this->debugStack = $debugStackOrEntityManager;
} }
/**
* @return array
*/
public function collect() public function collect()
{ {
$queries = array(); $queries = array();
@ -67,11 +75,17 @@ class DoctrineCollector extends DataCollector implements Renderable, AssetProvid
); );
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return 'doctrine'; return 'doctrine';
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
return array( return array(
@ -88,6 +102,9 @@ class DoctrineCollector extends DataCollector implements Renderable, AssetProvid
); );
} }
/**
* @return array
*/
public function getAssets() public function getAssets()
{ {
return array( return array(

View File

@ -56,6 +56,9 @@ class MonologCollector extends AbstractProcessingHandler implements DataCollecto
$logger->pushHandler($this); $logger->pushHandler($this);
} }
/**
* @param array $record
*/
protected function write(array $record) protected function write(array $record)
{ {
$this->records[] = array( $this->records[] = array(
@ -66,11 +69,17 @@ class MonologCollector extends AbstractProcessingHandler implements DataCollecto
); );
} }
/**
* @return array
*/
public function getMessages() public function getMessages()
{ {
return $this->records; return $this->records;
} }
/**
* @return array
*/
public function collect() public function collect()
{ {
return array( return array(
@ -79,11 +88,17 @@ class MonologCollector extends AbstractProcessingHandler implements DataCollecto
); );
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return $this->name; return $this->name;
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
$name = $this->getName(); $name = $this->getName();

View File

@ -100,6 +100,9 @@ class AggregatedCollector implements DataCollectorInterface, ArrayAccess
return $this->sort; return $this->sort;
} }
/**
* @return array
*/
public function collect() public function collect()
{ {
$aggregate = array(); $aggregate = array();
@ -136,6 +139,9 @@ class AggregatedCollector implements DataCollectorInterface, ArrayAccess
return $data; return $data;
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return $this->name; return $this->name;
@ -144,21 +150,38 @@ class AggregatedCollector implements DataCollectorInterface, ArrayAccess
// -------------------------------------------- // --------------------------------------------
// ArrayAccess implementation // ArrayAccess implementation
/**
* @param mixed $key
* @param mixed $value
* @throws DebugBarException
*/
public function offsetSet($key, $value) public function offsetSet($key, $value)
{ {
throw new DebugBarException("AggregatedCollector[] is read-only"); throw new DebugBarException("AggregatedCollector[] is read-only");
} }
/**
* @param mixed $key
* @return mixed
*/
public function offsetGet($key) public function offsetGet($key)
{ {
return $this->collectors[$key]; return $this->collectors[$key];
} }
/**
* @param mixed $key
* @return bool
*/
public function offsetExists($key) public function offsetExists($key)
{ {
return isset($this->collectors[$key]); return isset($this->collectors[$key]);
} }
/**
* @param mixed $key
* @throws DebugBarException
*/
public function offsetUnset($key) public function offsetUnset($key)
{ {
throw new DebugBarException("AggregatedCollector[] is read-only"); throw new DebugBarException("AggregatedCollector[] is read-only");

View File

@ -39,6 +39,9 @@ class ConfigCollector extends DataCollector implements Renderable
$this->data = $data; $this->data = $data;
} }
/**
* @return array
*/
public function collect() public function collect()
{ {
$data = array(); $data = array();
@ -51,11 +54,17 @@ class ConfigCollector extends DataCollector implements Renderable
return $data; return $data;
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return $this->name; return $this->name;
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
$name = $this->getName(); $name = $this->getName();

View File

@ -49,6 +49,7 @@ abstract class DataCollector implements DataCollectorInterface
* Sets the data formater instance used by this collector * Sets the data formater instance used by this collector
* *
* @param DataFormatterInterface $formater * @param DataFormatterInterface $formater
* @return $this
*/ */
public function setDataFormatter(DataFormatterInterface $formater) public function setDataFormatter(DataFormatterInterface $formater)
{ {
@ -56,6 +57,9 @@ abstract class DataCollector implements DataCollectorInterface
return $this; return $this;
} }
/**
* @return DataFormatterInterface
*/
public function getDataFormatter() public function getDataFormatter()
{ {
if ($this->dataFormater === null) { if ($this->dataFormater === null) {

View File

@ -88,11 +88,17 @@ class ExceptionsCollector extends DataCollector implements Renderable
); );
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return 'exceptions'; return 'exceptions';
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
return array( return array(

View File

@ -35,6 +35,9 @@ class LocalizationCollector extends DataCollector implements Renderable
return textdomain(); return textdomain();
} }
/**
* @return array
*/
public function collect() public function collect()
{ {
return array( return array(
@ -43,11 +46,17 @@ class LocalizationCollector extends DataCollector implements Renderable
); );
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return 'localization'; return 'localization';
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
return array( return array(

View File

@ -35,6 +35,9 @@ class MemoryCollector extends DataCollector implements Renderable
$this->peakUsage = memory_get_peak_usage(true); $this->peakUsage = memory_get_peak_usage(true);
} }
/**
* @return array
*/
public function collect() public function collect()
{ {
$this->updatePeakUsage(); $this->updatePeakUsage();
@ -44,11 +47,17 @@ class MemoryCollector extends DataCollector implements Renderable
); );
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return 'memory'; return 'memory';
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
return array( return array(

View File

@ -38,6 +38,7 @@ class MessagesCollector extends AbstractLogger implements DataCollectorInterface
* Sets the data formater instance used by this collector * Sets the data formater instance used by this collector
* *
* @param DataFormatterInterface $formater * @param DataFormatterInterface $formater
* @return $this
*/ */
public function setDataFormatter(DataFormatterInterface $formater) public function setDataFormatter(DataFormatterInterface $formater)
{ {
@ -45,6 +46,9 @@ class MessagesCollector extends AbstractLogger implements DataCollectorInterface
return $this; return $this;
} }
/**
* @return DataFormatterInterface
*/
public function getDataFormatter() public function getDataFormatter()
{ {
if ($this->dataFormater === null) { if ($this->dataFormater === null) {
@ -85,6 +89,9 @@ class MessagesCollector extends AbstractLogger implements DataCollectorInterface
$this->aggregates[] = $messages; $this->aggregates[] = $messages;
} }
/**
* @return array
*/
public function getMessages() public function getMessages()
{ {
$messages = $this->messages; $messages = $this->messages;
@ -107,6 +114,11 @@ class MessagesCollector extends AbstractLogger implements DataCollectorInterface
return $messages; return $messages;
} }
/**
* @param $level
* @param $message
* @param array $context
*/
public function log($level, $message, array $context = array()) public function log($level, $message, array $context = array())
{ {
$this->addMessage($message, $level); $this->addMessage($message, $level);
@ -120,6 +132,9 @@ class MessagesCollector extends AbstractLogger implements DataCollectorInterface
$this->messages = array(); $this->messages = array();
} }
/**
* @return array
*/
public function collect() public function collect()
{ {
$messages = $this->getMessages(); $messages = $this->getMessages();
@ -129,11 +144,17 @@ class MessagesCollector extends AbstractLogger implements DataCollectorInterface
); );
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return $this->name; return $this->name;
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
$name = $this->getName(); $name = $this->getName();

View File

@ -43,11 +43,17 @@ class PDOCollector extends DataCollector implements Renderable, AssetProvider
$this->sqlQuotationChar = $quotationChar; $this->sqlQuotationChar = $quotationChar;
} }
/**
* @return bool
*/
public function isSqlRenderedWithParams() public function isSqlRenderedWithParams()
{ {
return $this->renderSqlWithParams; return $this->renderSqlWithParams;
} }
/**
* @return string
*/
public function getSqlQuotationChar() public function getSqlQuotationChar()
{ {
return $this->sqlQuotationChar; return $this->sqlQuotationChar;
@ -77,6 +83,9 @@ class PDOCollector extends DataCollector implements Renderable, AssetProvider
return $this->connections; return $this->connections;
} }
/**
* @return array
*/
public function collect() public function collect()
{ {
$data = array( $data = array(
@ -151,11 +160,17 @@ class PDOCollector extends DataCollector implements Renderable, AssetProvider
); );
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return 'pdo'; return 'pdo';
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
return array( return array(
@ -172,6 +187,9 @@ class PDOCollector extends DataCollector implements Renderable, AssetProvider
); );
} }
/**
* @return array
*/
public function getAssets() public function getAssets()
{ {
return array( return array(

View File

@ -179,16 +179,29 @@ class TraceablePDO extends PDO
return array_filter($this->executedStatements, function ($s) { return !$s->isSuccess(); }); return array_filter($this->executedStatements, function ($s) { return !$s->isSuccess(); });
} }
/**
* @param $name
* @return mixed
*/
public function __get($name) public function __get($name)
{ {
return $this->pdo->$name; return $this->pdo->$name;
} }
/**
* @param $name
* @param $value
*/
public function __set($name, $value) public function __set($name, $value)
{ {
$this->pdo->$name = $value; $this->pdo->$name = $value;
} }
/**
* @param $name
* @param $args
* @return mixed
*/
public function __call($name, $args) public function __call($name, $args)
{ {
return call_user_func_array(array($this->pdo, $name), $args); return call_user_func_array(array($this->pdo, $name), $args);

View File

@ -15,11 +15,23 @@ class TraceablePDOStatement extends PDOStatement
protected $boundParameters = array(); protected $boundParameters = array();
/**
* TraceablePDOStatement constructor.
* @param TraceablePDO $pdo
*/
protected function __construct(TraceablePDO $pdo) protected function __construct(TraceablePDO $pdo)
{ {
$this->pdo = $pdo; $this->pdo = $pdo;
} }
/**
* @param mixed $column
* @param mixed $param
* @param null $type
* @param null $maxlen
* @param null $driverdata
* @return mixed
*/
public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null) public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
{ {
$this->boundParameters[$column] = $param; $this->boundParameters[$column] = $param;
@ -27,6 +39,14 @@ class TraceablePDOStatement extends PDOStatement
return call_user_func_array(array("parent", 'bindColumn'), $args); return call_user_func_array(array("parent", 'bindColumn'), $args);
} }
/**
* @param mixed $param
* @param mixed $var
* @param int $data_type
* @param null $length
* @param null $driver_options
* @return mixed
*/
public function bindParam($param, &$var, $data_type = PDO::PARAM_STR, $length = null, $driver_options = null) public function bindParam($param, &$var, $data_type = PDO::PARAM_STR, $length = null, $driver_options = null)
{ {
$this->boundParameters[$param] = $var; $this->boundParameters[$param] = $var;
@ -34,12 +54,23 @@ class TraceablePDOStatement extends PDOStatement
return call_user_func_array(array("parent", 'bindParam'), $args); return call_user_func_array(array("parent", 'bindParam'), $args);
} }
/**
* @param mixed $param
* @param mixed $value
* @param int $data_type
* @return mixed
*/
public function bindValue($param, $value, $data_type = PDO::PARAM_STR) public function bindValue($param, $value, $data_type = PDO::PARAM_STR)
{ {
$this->boundParameters[$param] = $value; $this->boundParameters[$param] = $value;
return call_user_func_array(array("parent", 'bindValue'), func_get_args()); return call_user_func_array(array("parent", 'bindValue'), func_get_args());
} }
/**
* @param null $params
* @return bool
* @throws null
*/
public function execute($params = null) public function execute($params = null)
{ {
$preparedId = spl_object_hash($this); $preparedId = spl_object_hash($this);

View File

@ -31,11 +31,6 @@ class TracedStatement
* @param string $sql * @param string $sql
* @param array $params * @param array $params
* @param string $preparedId * @param string $preparedId
* @param integer $rowCount
* @param integer $startTime
* @param integer $endTime
* @param integer $memoryUsage
* @param \Exception $e
*/ */
public function __construct($sql, array $params = array(), $preparedId = null) public function __construct($sql, array $params = array(), $preparedId = null)
{ {
@ -44,12 +39,22 @@ class TracedStatement
$this->preparedId = $preparedId; $this->preparedId = $preparedId;
} }
/**
* @param null $startTime
* @param null $startMemory
*/
public function start($startTime = null, $startMemory = null) public function start($startTime = null, $startMemory = null)
{ {
$this->startTime = $startTime ?: microtime(true); $this->startTime = $startTime ?: microtime(true);
$this->startMemory = $startMemory ?: memory_get_usage(true); $this->startMemory = $startMemory ?: memory_get_usage(true);
} }
/**
* @param \Exception|null $exception
* @param int $rowCount
* @param null $endTime
* @param null $endMemory
*/
public function end(\Exception $exception = null, $rowCount = 0, $endTime = null, $endMemory = null) public function end(\Exception $exception = null, $rowCount = 0, $endTime = null, $endMemory = null)
{ {
$this->endTime = $endTime ?: microtime(true); $this->endTime = $endTime ?: microtime(true);
@ -158,11 +163,17 @@ class TracedStatement
return $this->preparedId !== null; return $this->preparedId !== null;
} }
/**
* @return mixed
*/
public function getStartTime() public function getStartTime()
{ {
return $this->startTime; return $this->startTime;
} }
/**
* @return mixed
*/
public function getEndTime() public function getEndTime()
{ {
return $this->endTime; return $this->endTime;
@ -178,11 +189,17 @@ class TracedStatement
return $this->duration; return $this->duration;
} }
/**
* @return mixed
*/
public function getStartMemory() public function getStartMemory()
{ {
return $this->startMemory; return $this->startMemory;
} }
/**
* @return mixed
*/
public function getEndMemory() public function getEndMemory()
{ {
return $this->endMemory; return $this->endMemory;

View File

@ -15,6 +15,9 @@ namespace DebugBar\DataCollector;
*/ */
class PhpInfoCollector extends DataCollector class PhpInfoCollector extends DataCollector
{ {
/**
* @return array
*/
public function collect() public function collect()
{ {
return array( return array(
@ -23,6 +26,9 @@ class PhpInfoCollector extends DataCollector
); );
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return 'php'; return 'php';

View File

@ -15,6 +15,9 @@ namespace DebugBar\DataCollector;
*/ */
class RequestDataCollector extends DataCollector implements Renderable class RequestDataCollector extends DataCollector implements Renderable
{ {
/**
* @return array
*/
public function collect() public function collect()
{ {
$vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER'); $vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER');
@ -29,11 +32,17 @@ class RequestDataCollector extends DataCollector implements Renderable
return $data; return $data;
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return 'request'; return 'request';
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
return array( return array(

View File

@ -187,6 +187,10 @@ class TimeDataCollector extends DataCollector implements Renderable
return microtime(true) - $this->requestStartTime; return microtime(true) - $this->requestStartTime;
} }
/**
* @return array
* @throws DebugBarException
*/
public function collect() public function collect()
{ {
$this->requestEndTime = microtime(true); $this->requestEndTime = microtime(true);
@ -203,11 +207,17 @@ class TimeDataCollector extends DataCollector implements Renderable
); );
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return 'time'; return 'time';
} }
/**
* @return array
*/
public function getWidgets() public function getWidgets()
{ {
return array( return array(

View File

@ -15,12 +15,19 @@ use Symfony\Component\VarDumper\Dumper\CliDumper;
class DataFormatter implements DataFormatterInterface class DataFormatter implements DataFormatterInterface
{ {
/**
* DataFormatter constructor.
*/
public function __construct() public function __construct()
{ {
$this->cloner = new VarCloner(); $this->cloner = new VarCloner();
$this->dumper = new CliDumper(); $this->dumper = new CliDumper();
} }
/**
* @param $data
* @return string
*/
public function formatVar($data) public function formatVar($data)
{ {
$output = ''; $output = '';
@ -39,6 +46,10 @@ class DataFormatter implements DataFormatterInterface
return trim($output); return trim($output);
} }
/**
* @param float $seconds
* @return string
*/
public function formatDuration($seconds) public function formatDuration($seconds)
{ {
if ($seconds < 0.001) { if ($seconds < 0.001) {
@ -49,6 +60,11 @@ class DataFormatter implements DataFormatterInterface
return round($seconds, 2) . 's'; return round($seconds, 2) . 's';
} }
/**
* @param string $size
* @param int $precision
* @return string
*/
public function formatBytes($size, $precision = 2) public function formatBytes($size, $precision = 2)
{ {
if ($size === 0 || $size === null) { if ($size === 0 || $size === null) {

View File

@ -84,6 +84,7 @@ class DebugBar implements ArrayAccess
* *
* @param string $name * @param string $name
* @return DataCollectorInterface * @return DataCollectorInterface
* @throws DebugBarException
*/ */
public function getCollector($name) public function getCollector($name)
{ {
@ -107,6 +108,7 @@ class DebugBar implements ArrayAccess
* Sets the request id generator * Sets the request id generator
* *
* @param RequestIdGeneratorInterface $generator * @param RequestIdGeneratorInterface $generator
* @return $this
*/ */
public function setRequestIdGenerator(RequestIdGeneratorInterface $generator) public function setRequestIdGenerator(RequestIdGeneratorInterface $generator)
{ {
@ -142,6 +144,7 @@ class DebugBar implements ArrayAccess
* Sets the storage backend to use to store the collected data * Sets the storage backend to use to store the collected data
* *
* @param StorageInterface $storage * @param StorageInterface $storage
* @return $this
*/ */
public function setStorage(StorageInterface $storage = null) public function setStorage(StorageInterface $storage = null)
{ {
@ -171,6 +174,7 @@ class DebugBar implements ArrayAccess
* Sets the HTTP driver * Sets the HTTP driver
* *
* @param HttpDriverInterface $driver * @param HttpDriverInterface $driver
* @return $this
*/ */
public function setHttpDriver(HttpDriverInterface $driver) public function setHttpDriver(HttpDriverInterface $driver)
{ {
@ -287,6 +291,7 @@ class DebugBar implements ArrayAccess
* @param bool $useOpenHandler * @param bool $useOpenHandler
* @param string $headerName * @param string $headerName
* @param integer $maxHeaderLength * @param integer $maxHeaderLength
* @return $this
*/ */
public function sendDataInHeaders($useOpenHandler = null, $headerName = 'phpdebugbar', $maxHeaderLength = 4096) public function sendDataInHeaders($useOpenHandler = null, $headerName = 'phpdebugbar', $maxHeaderLength = 4096)
{ {
@ -369,6 +374,7 @@ class DebugBar implements ArrayAccess
* Sets the key to use in the $_SESSION array * Sets the key to use in the $_SESSION array
* *
* @param string $ns * @param string $ns
* @return $this
*/ */
public function setStackDataSessionNamespace($ns) public function setStackDataSessionNamespace($ns)
{ {
@ -391,6 +397,7 @@ class DebugBar implements ArrayAccess
* if a storage is enabled * if a storage is enabled
* *
* @param boolean $enabled * @param boolean $enabled
* @return $this
*/ */
public function setStackAlwaysUseSessionStorage($enabled = true) public function setStackAlwaysUseSessionStorage($enabled = true)
{ {
@ -411,8 +418,8 @@ class DebugBar implements ArrayAccess
/** /**
* Initializes the session for stacked data * Initializes the session for stacked data
*
* @return HttpDriverInterface * @return HttpDriverInterface
* @throws DebugBarException
*/ */
protected function initStackSession() protected function initStackSession()
{ {
@ -430,9 +437,8 @@ class DebugBar implements ArrayAccess
/** /**
* Returns a JavascriptRenderer for this instance * Returns a JavascriptRenderer for this instance
*
* @param string $baseUrl * @param string $baseUrl
* @param string $basePathng * @param string $basePath
* @return JavascriptRenderer * @return JavascriptRenderer
*/ */
public function getJavascriptRenderer($baseUrl = null, $basePath = null) public function getJavascriptRenderer($baseUrl = null, $basePath = null)

View File

@ -19,7 +19,8 @@ interface HttpDriverInterface
/** /**
* Sets HTTP headers * Sets HTTP headers
* *
* @param string $headers * @param array $headers
* @return
*/ */
function setHeaders(array $headers); function setHeaders(array $headers);

View File

@ -764,6 +764,8 @@ class JavascriptRenderer
* *
* @param boolean $here Set position of HTML. True if is to current position or false for end file * @param boolean $here Set position of HTML. True if is to current position or false for end file
* @param boolean $initialize Whether to render the de bug bar initialization code * @param boolean $initialize Whether to render the de bug bar initialization code
* @param bool $renderStackedData
* @param bool $head
* @return string Return "{--DEBUGBAR_OB_START_REPLACE_ME--}" or return an empty string if $here == false * @return string Return "{--DEBUGBAR_OB_START_REPLACE_ME--}" or return an empty string if $here == false
*/ */
public function renderOnShutdown($here = true, $initialize = true, $renderStackedData = true, $head = false) public function renderOnShutdown($here = true, $initialize = true, $renderStackedData = true, $head = false)
@ -795,6 +797,8 @@ class JavascriptRenderer
* *
* @param boolean $here Set position of HTML. True if is to current position or false for end file * @param boolean $here Set position of HTML. True if is to current position or false for end file
* @param boolean $initialize Whether to render the de bug bar initialization code * @param boolean $initialize Whether to render the de bug bar initialization code
* @param bool $renderStackedData
* @param bool $head
*/ */
public function replaceTagInBuffer($here = true, $initialize = true, $renderStackedData = true, $head = false) public function replaceTagInBuffer($here = true, $initialize = true, $renderStackedData = true, $head = false)
{ {
@ -815,7 +819,8 @@ class JavascriptRenderer
* *
* AJAX request should not render the initialization code. * AJAX request should not render the initialization code.
* *
* @param boolean $initialize Whether to render the de bug bar initialization code * @param boolean $initialize Whether or not to render the debug bar initialization code
* @param bool $renderStackedData Whether or not to render the stacked data
* @return string * @return string
*/ */
public function render($initialize = true, $renderStackedData = true) public function render($initialize = true, $renderStackedData = true)
@ -945,6 +950,7 @@ class JavascriptRenderer
* *
* @param string $requestId * @param string $requestId
* @param array $data * @param array $data
* @param null $suffix
* @return string * @return string
*/ */
protected function getAddDatasetCode($requestId, $data, $suffix = null) protected function getAddDatasetCode($requestId, $data, $suffix = null)

View File

@ -19,6 +19,7 @@ class OpenHandler
/** /**
* @param DebugBar $debugBar * @param DebugBar $debugBar
* @throws DebugBarException
*/ */
public function __construct(DebugBar $debugBar) public function __construct(DebugBar $debugBar)
{ {
@ -32,6 +33,10 @@ class OpenHandler
* Handles the current request * Handles the current request
* *
* @param array $request Request data * @param array $request Request data
* @param bool $echo
* @param bool $sendHeader
* @return string
* @throws DebugBarException
*/ */
public function handle($request = null, $echo = true, $sendHeader = true) public function handle($request = null, $echo = true, $sendHeader = true)
{ {
@ -62,6 +67,8 @@ class OpenHandler
/** /**
* Find operation * Find operation
* @param $request
* @return array
*/ */
protected function find($request) protected function find($request)
{ {
@ -87,6 +94,9 @@ class OpenHandler
/** /**
* Get operation * Get operation
* @param $request
* @return array
* @throws DebugBarException
*/ */
protected function get($request) protected function get($request)
{ {

View File

@ -15,6 +15,9 @@ namespace DebugBar;
*/ */
class PhpHttpDriver implements HttpDriverInterface class PhpHttpDriver implements HttpDriverInterface
{ {
/**
* @param array $headers
*/
function setHeaders(array $headers) function setHeaders(array $headers)
{ {
foreach ($headers as $name => $value) { foreach ($headers as $name => $value) {
@ -22,26 +25,44 @@ class PhpHttpDriver implements HttpDriverInterface
} }
} }
/**
* @return bool
*/
function isSessionStarted() function isSessionStarted()
{ {
return isset($_SESSION); return isset($_SESSION);
} }
/**
* @param string $name
* @param string $value
*/
function setSessionValue($name, $value) function setSessionValue($name, $value)
{ {
$_SESSION[$name] = $value; $_SESSION[$name] = $value;
} }
/**
* @param string $name
* @return bool
*/
function hasSessionValue($name) function hasSessionValue($name)
{ {
return array_key_exists($name, $_SESSION); return array_key_exists($name, $_SESSION);
} }
/**
* @param string $name
* @return mixed
*/
function getSessionValue($name) function getSessionValue($name)
{ {
return $_SESSION[$name]; return $_SESSION[$name];
} }
/**
* @param string $name
*/
function deleteSessionValue($name) function deleteSessionValue($name)
{ {
unset($_SESSION[$name]); unset($_SESSION[$name]);

View File

@ -15,6 +15,9 @@ namespace DebugBar;
*/ */
class RequestIdGenerator implements RequestIdGeneratorInterface class RequestIdGenerator implements RequestIdGeneratorInterface
{ {
/**
* @return string
*/
public function generate() public function generate()
{ {
return md5(serialize($_SERVER) . microtime()); return md5(serialize($_SERVER) . microtime());