1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 05:18:32 +01:00

Fix phpdoc for JavascriptRenderer::render()

Add missing phpdoc params

Add missing phpdoc params and return

Add missing phpdoc param

Make php doc param type correct

Add exception to phpdoc

Add return to phpdoc

Add return to phpdoc

Add return to phpdoc

Add return to phpdoc

Add return to phpdoc

Add return to phpdoc

Add exception to phpdoc

Fix phpdoc

Add exception to phpdoc

Add return to phpdoc

Add params and exception to phpdoc

Add param and return to phpdoc

Add params and exception and return to phpdoc

Add phpdocs

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add return to phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add return to phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Remove old params from phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc

Add phpdoc
This commit is contained in:
Alex Piechowski 2016-01-20 18:03:20 -06:00
parent 0d17956dda
commit 488cca2516
24 changed files with 303 additions and 10 deletions

View File

@ -31,6 +31,13 @@ class CacheCacheCollector extends MonologCollector
{
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)
{
parent::__construct(null, $level, $bubble);
@ -45,6 +52,9 @@ class CacheCacheCollector extends MonologCollector
}
}
/**
* @param Cache $cache
*/
public function addCache(Cache $cache)
{
$backend = $cache->getBackend();
@ -55,6 +65,9 @@ class CacheCacheCollector extends MonologCollector
$this->addLogger($backend->getLogger());
}
/**
* @return string
*/
public function getName()
{
return 'cache';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -179,16 +179,29 @@ class TraceablePDO extends PDO
return array_filter($this->executedStatements, function ($s) { return !$s->isSuccess(); });
}
/**
* @param $name
* @return mixed
*/
public function __get($name)
{
return $this->pdo->$name;
}
/**
* @param $name
* @param $value
*/
public function __set($name, $value)
{
$this->pdo->$name = $value;
}
/**
* @param $name
* @param $args
* @return mixed
*/
public function __call($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();
/**
* TraceablePDOStatement constructor.
* @param TraceablePDO $pdo
*/
protected function __construct(TraceablePDO $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)
{
$this->boundParameters[$column] = $param;
@ -27,6 +39,14 @@ class TraceablePDOStatement extends PDOStatement
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)
{
$this->boundParameters[$param] = $var;
@ -34,12 +54,23 @@ class TraceablePDOStatement extends PDOStatement
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)
{
$this->boundParameters[$param] = $value;
return call_user_func_array(array("parent", 'bindValue'), func_get_args());
}
/**
* @param null $params
* @return bool
* @throws null
*/
public function execute($params = null)
{
$preparedId = spl_object_hash($this);

View File

@ -31,11 +31,6 @@ class TracedStatement
* @param string $sql
* @param array $params
* @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)
{
@ -44,12 +39,22 @@ class TracedStatement
$this->preparedId = $preparedId;
}
/**
* @param null $startTime
* @param null $startMemory
*/
public function start($startTime = null, $startMemory = null)
{
$this->startTime = $startTime ?: microtime(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)
{
$this->endTime = $endTime ?: microtime(true);
@ -158,11 +163,17 @@ class TracedStatement
return $this->preparedId !== null;
}
/**
* @return mixed
*/
public function getStartTime()
{
return $this->startTime;
}
/**
* @return mixed
*/
public function getEndTime()
{
return $this->endTime;
@ -178,11 +189,17 @@ class TracedStatement
return $this->duration;
}
/**
* @return mixed
*/
public function getStartMemory()
{
return $this->startMemory;
}
/**
* @return mixed
*/
public function getEndMemory()
{
return $this->endMemory;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,8 @@ interface HttpDriverInterface
/**
* Sets HTTP headers
*
* @param string $headers
* @param array $headers
* @return
*/
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 $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
*/
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 $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)
{
@ -815,7 +819,8 @@ class JavascriptRenderer
*
* 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
*/
public function render($initialize = true, $renderStackedData = true)
@ -945,6 +950,7 @@ class JavascriptRenderer
*
* @param string $requestId
* @param array $data
* @param null $suffix
* @return string
*/
protected function getAddDatasetCode($requestId, $data, $suffix = null)

View File

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

View File

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

View File

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