app/Debug/DebugBarLogs.php
Avoid using static access to class '\DebugBar\DataCollector\DataCollector' in method 'getDataFormatter'. Open
Open
$this->dataFormater = DataCollector::getDefaultDataFormatter();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Class implements undeclared interface \DebugBar\DataCollector\MessagesAggregateInterface
Open
Open
class DebugBarLogs implements DataCollectorInterface, MessagesAggregateInterface, Renderable
- Exclude checks
Parameter $messagesAggregate
has undeclared type \DebugBar\DataCollector\MessagesAggregateInterface
Open
Open
public function aggregate(MessagesAggregateInterface $messagesAggregate)
- Exclude checks
Call to method formatVar
from undeclared class \DebugBar\DataFormatter\DataFormatterInterface
Open
Open
$traces = $this->getDataFormatter()->formatVar($traces);
- Exclude checks
Class implements undeclared interface \DebugBar\DataCollector\Renderable
Open
Open
class DebugBarLogs implements DataCollectorInterface, MessagesAggregateInterface, Renderable
- Exclude checks
Class implements undeclared interface \DebugBar\DataCollector\DataCollectorInterface
Open
Open
class DebugBarLogs implements DataCollectorInterface, MessagesAggregateInterface, Renderable
- Exclude checks
Parameter $formater
has undeclared type \DebugBar\DataFormatter\DataFormatterInterface
Open
Open
public function setDataFormatter(DataFormatterInterface $formater)
- Exclude checks
Call to method getDefaultDataFormatter
from undeclared class \DebugBar\DataCollector\DataCollector
Open
Open
$this->dataFormater = DataCollector::getDefaultDataFormatter();
- Exclude checks
Return type of getDataFormatter()
is undeclared type \DebugBar\DataFormatter\DataFormatterInterface
Open
Open
public function getDataFormatter()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->dataFormater = $formater;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->dataFormater = DataCollector::getDefaultDataFormatter();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function setDataFormatter(DataFormatterInterface $formater)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->dataFormater;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param string $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $messages = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param DataFormatterInterface $formater
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $aggregates = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $dataFormater;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (null === $this->dataFormater) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return DataFormatterInterface
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getDataFormatter()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function __construct($name = 'logs')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Sets the data formater instance used by this collector.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->name = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param mixed $message
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param mixed $traces
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Deletes all messages.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->messages = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (!\is_string($traces)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'map' => "$widgetName.messages",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'default' => 'null',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function aggregate(MessagesAggregateInterface $messagesAggregate)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'messages' => $messagesCollect,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->aggregates[] = $messagesAggregate;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'label' => $label,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'count' => \count($messagesCollect),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
"$widgetName" => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* A message can be anything from an object to a string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->messages[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Aggregates messages from other collectors.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->messages;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param string $label
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getName()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$widgetName = $this->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'default' => '[]',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param MessagesAggregateInterface $messagesAggregate
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getMessages()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$messagesCollect = $this->getMessages();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'trace' => $traces,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'icon' => 'list-alt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
"$widgetName:badge" => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function addMessage($message, $label = 'info', $traces = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'message' => $message,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getWidgets()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Adds a message.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'map' => "$widgetName.count",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$traces = $this->getDataFormatter()->formatVar($traces);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function clear()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function collect()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'widget' => 'PhpDebugBar.Widgets.DebugLogsWidget',
- Exclude checks