update 1.0.8.0
Commits for version update
This commit is contained in:
@@ -55,10 +55,10 @@ class AuthCollector extends DataCollector implements Renderable
|
||||
{
|
||||
// Defaults
|
||||
if (is_null($user)) {
|
||||
return array(
|
||||
return [
|
||||
'name' => 'Guest',
|
||||
'user' => array('guest' => true),
|
||||
);
|
||||
'user' => ['guest' => true],
|
||||
];
|
||||
}
|
||||
|
||||
// The default auth identifer is the ID number, which isn't all that
|
||||
@@ -75,10 +75,10 @@ class AuthCollector extends DataCollector implements Renderable
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
'name' => $identifier,
|
||||
'user' => $user instanceof Arrayable ? $user->toArray() : $user,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,21 +94,21 @@ class AuthCollector extends DataCollector implements Renderable
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
$widgets = array(
|
||||
'auth' => array(
|
||||
$widgets = [
|
||||
'auth' => [
|
||||
'icon' => 'lock',
|
||||
'widget' => 'PhpDebugBar.Widgets.VariableListWidget',
|
||||
'map' => 'auth.user',
|
||||
'default' => '{}'
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
if ($this->showName) {
|
||||
$widgets['auth.name'] = array(
|
||||
$widgets['auth.name'] = [
|
||||
'icon' => 'user',
|
||||
'tooltip' => 'Auth status',
|
||||
'map' => 'auth.name',
|
||||
'default' => '',
|
||||
);
|
||||
];
|
||||
}
|
||||
return $widgets;
|
||||
}
|
||||
|
@@ -69,12 +69,12 @@ class EventCollector extends TimeDataCollector
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$this->events = $events;
|
||||
$events->listen('*', array($this, 'onWildcardEvent'));
|
||||
$events->listen('*', [$this, 'onWildcardEvent']);
|
||||
}
|
||||
|
||||
protected function prepareParams($params)
|
||||
{
|
||||
$data = array();
|
||||
$data = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if (is_object($value) && Str::is('Illuminate\*\Events\*', get_class($value))) {
|
||||
$value = $this->prepareParams(get_object_vars($value));
|
||||
@@ -100,17 +100,17 @@ class EventCollector extends TimeDataCollector
|
||||
|
||||
public function getWidgets()
|
||||
{
|
||||
return array(
|
||||
"events" => array(
|
||||
return [
|
||||
"events" => [
|
||||
"icon" => "tasks",
|
||||
"widget" => "PhpDebugBar.Widgets.TimelineWidget",
|
||||
"map" => "event",
|
||||
"default" => "{}",
|
||||
),
|
||||
'events:badge' => array(
|
||||
],
|
||||
'events:badge' => [
|
||||
'map' => 'event.nb_measures',
|
||||
'default' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -29,8 +29,8 @@ class FilesCollector extends DataCollector implements Renderable
|
||||
$files = $this->getIncludedFiles();
|
||||
$compiled = $this->getCompiledFiles();
|
||||
|
||||
$included = array();
|
||||
$alreadyCompiled = array();
|
||||
$included = [];
|
||||
$alreadyCompiled = [];
|
||||
foreach ($files as $file) {
|
||||
// Skip the files from Debugbar, they are only loaded for Debugging and confuse the output.
|
||||
// Of course some files are stil always loaded (ServiceProvider, Facade etc)
|
||||
@@ -41,27 +41,27 @@ class FilesCollector extends DataCollector implements Renderable
|
||||
) {
|
||||
continue;
|
||||
} elseif (!in_array($file, $compiled)) {
|
||||
$included[] = array(
|
||||
$included[] = [
|
||||
'message' => "'" . $this->stripBasePath($file) . "',",
|
||||
// Use PHP syntax so we can copy-paste to compile config file.
|
||||
'is_string' => true,
|
||||
);
|
||||
];
|
||||
} else {
|
||||
$alreadyCompiled[] = array(
|
||||
$alreadyCompiled[] = [
|
||||
'message' => "* '" . $this->stripBasePath($file) . "',",
|
||||
// Mark with *, so know they are compiled anyways.
|
||||
'is_string' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// First the included files, then those that are going to be compiled.
|
||||
$messages = array_merge($included, $alreadyCompiled);
|
||||
|
||||
return array(
|
||||
return [
|
||||
'messages' => $messages,
|
||||
'count' => count($included),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ class FilesCollector extends DataCollector implements Renderable
|
||||
return array_merge($core, $app['config']['compile']);
|
||||
}
|
||||
}
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,18 +111,18 @@ class FilesCollector extends DataCollector implements Renderable
|
||||
public function getWidgets()
|
||||
{
|
||||
$name = $this->getName();
|
||||
return array(
|
||||
"$name" => array(
|
||||
return [
|
||||
"$name" => [
|
||||
"icon" => "files-o",
|
||||
"widget" => "PhpDebugBar.Widgets.MessagesWidget",
|
||||
"map" => "$name.messages",
|
||||
"default" => "{}"
|
||||
),
|
||||
"$name:badge" => array(
|
||||
],
|
||||
"$name:badge" => [
|
||||
"map" => "$name.count",
|
||||
"default" => "null"
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -46,14 +46,14 @@ class IlluminateRouteCollector extends DataCollector implements Renderable
|
||||
protected function getRouteInformation($route)
|
||||
{
|
||||
if (!is_a($route, 'Illuminate\Routing\Route')) {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
$uri = head($route->methods()) . ' ' . $route->uri();
|
||||
$action = $route->getAction();
|
||||
|
||||
$result = array(
|
||||
$result = [
|
||||
'uri' => $uri ?: '-',
|
||||
);
|
||||
];
|
||||
|
||||
$result = array_merge($result, $action);
|
||||
|
||||
@@ -109,21 +109,21 @@ class IlluminateRouteCollector extends DataCollector implements Renderable
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
$widgets = array(
|
||||
"route" => array(
|
||||
$widgets = [
|
||||
"route" => [
|
||||
"icon" => "share",
|
||||
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
|
||||
"map" => "route",
|
||||
"default" => "{}"
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
if (Config::get('debugbar.options.route.label', true)) {
|
||||
$widgets['currentroute'] = array(
|
||||
$widgets['currentroute'] = [
|
||||
"icon" => "share",
|
||||
"tooltip" => "Route",
|
||||
"map" => "route.uri",
|
||||
"default" => ""
|
||||
);
|
||||
];
|
||||
}
|
||||
return $widgets;
|
||||
}
|
||||
|
@@ -27,11 +27,11 @@ class LaravelCollector extends DataCollector implements Renderable
|
||||
// Fallback if not injected
|
||||
$app = $this->app ?: app();
|
||||
|
||||
return array(
|
||||
return [
|
||||
"version" => $app::VERSION,
|
||||
"environment" => $app->environment(),
|
||||
"locale" => $app->getLocale(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,25 +47,25 @@ class LaravelCollector extends DataCollector implements Renderable
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
return array(
|
||||
"version" => array(
|
||||
return [
|
||||
"version" => [
|
||||
"icon" => "github",
|
||||
"tooltip" => "Version",
|
||||
"map" => "laravel.version",
|
||||
"default" => ""
|
||||
),
|
||||
"environment" => array(
|
||||
],
|
||||
"environment" => [
|
||||
"icon" => "desktop",
|
||||
"tooltip" => "Environment",
|
||||
"map" => "laravel.environment",
|
||||
"default" => ""
|
||||
),
|
||||
"locale" => array(
|
||||
],
|
||||
"locale" => [
|
||||
"icon" => "flag",
|
||||
"tooltip" => "Current locale",
|
||||
"map" => "laravel.locale",
|
||||
"default" => "",
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ class LogsCollector extends MessagesCollector
|
||||
$linecounter = $lines;
|
||||
$pos = -2;
|
||||
$beginning = false;
|
||||
$text = array();
|
||||
$text = [];
|
||||
while ($linecounter > 0) {
|
||||
$t = " ";
|
||||
while ($t != "\n") {
|
||||
@@ -111,12 +111,12 @@ class LogsCollector extends MessagesCollector
|
||||
preg_match_all($pattern, $file, $headings);
|
||||
$log_data = preg_split($pattern, $file);
|
||||
|
||||
$log = array();
|
||||
$log = [];
|
||||
foreach ($headings as $h) {
|
||||
for ($i = 0, $j = count($h); $i < $j; $i++) {
|
||||
foreach ($log_levels as $ll) {
|
||||
if (strpos(strtolower($h[$i]), strtolower('.' . $ll))) {
|
||||
$log[] = array('level' => $ll, 'header' => $h[$i], 'stack' => $log_data[$i]);
|
||||
$log[] = ['level' => $ll, 'header' => $h[$i], 'stack' => $log_data[$i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -53,22 +53,22 @@ class MultiAuthCollector extends AuthCollector
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
$widgets = array(
|
||||
"auth" => array(
|
||||
$widgets = [
|
||||
"auth" => [
|
||||
"icon" => "lock",
|
||||
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
|
||||
"map" => "auth.guards",
|
||||
"default" => "{}"
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
|
||||
if ($this->showName) {
|
||||
$widgets['auth.name'] = array(
|
||||
$widgets['auth.name'] = [
|
||||
'icon' => 'user',
|
||||
'tooltip' => 'Auth status',
|
||||
'map' => 'auth.names',
|
||||
'default' => '',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $widgets;
|
||||
|
@@ -11,12 +11,13 @@ use DebugBar\DataCollector\TimeDataCollector;
|
||||
class QueryCollector extends PDOCollector
|
||||
{
|
||||
protected $timeCollector;
|
||||
protected $queries = array();
|
||||
protected $queries = [];
|
||||
protected $renderSqlWithParams = false;
|
||||
protected $findSource = false;
|
||||
protected $explainQuery = false;
|
||||
protected $explainTypes = array('SELECT'); // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
|
||||
protected $explainTypes = ['SELECT']; // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
|
||||
protected $showHints = false;
|
||||
protected $reflection = [];
|
||||
|
||||
/**
|
||||
* @param TimeDataCollector $timeCollector
|
||||
@@ -80,7 +81,7 @@ class QueryCollector extends PDOCollector
|
||||
*/
|
||||
public function addQuery($query, $bindings, $time, $connection)
|
||||
{
|
||||
$explainResults = array();
|
||||
$explainResults = [];
|
||||
$time = $time / 1000;
|
||||
$endTime = microtime(true);
|
||||
$startTime = $endTime - $time;
|
||||
@@ -98,8 +99,9 @@ class QueryCollector extends PDOCollector
|
||||
|
||||
$bindings = $this->checkBindings($bindings);
|
||||
if (!empty($bindings) && $this->renderSqlWithParams) {
|
||||
foreach ($bindings as $binding) {
|
||||
$query = preg_replace('/\?/', $pdo->quote($binding), $query, 1);
|
||||
foreach ($bindings as $key => $binding) {
|
||||
$regex = is_numeric($key) ? '/\?/' : "/:{$key}/";
|
||||
$query = preg_replace($regex, $pdo->quote($binding), $query, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +113,7 @@ class QueryCollector extends PDOCollector
|
||||
}
|
||||
}
|
||||
|
||||
$this->queries[] = array(
|
||||
$this->queries[] = [
|
||||
'query' => $query,
|
||||
'bindings' => $this->escapeBindings($bindings),
|
||||
'time' => $time,
|
||||
@@ -119,7 +121,7 @@ class QueryCollector extends PDOCollector
|
||||
'explain' => $explainResults,
|
||||
'connection' => $connection->getDatabaseName(),
|
||||
'hints' => $this->showHints ? $hints : null,
|
||||
);
|
||||
];
|
||||
|
||||
if ($this->timeCollector !== null) {
|
||||
$this->timeCollector->addMeasure($query, $startTime, $endTime);
|
||||
@@ -171,7 +173,7 @@ class QueryCollector extends PDOCollector
|
||||
*/
|
||||
protected function performQueryAnalysis($query)
|
||||
{
|
||||
$hints = array();
|
||||
$hints = [];
|
||||
if (preg_match('/^\\s*SELECT\\s*`?[a-zA-Z0-9]*`?\\.?\\*/i', $query)) {
|
||||
$hints[] = 'Use <code>SELECT *</code> only if you need all columns from table';
|
||||
}
|
||||
@@ -195,7 +197,7 @@ class QueryCollector extends PDOCollector
|
||||
}
|
||||
return implode("<br />", $hints);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use a backtrace to search for the origin of the query.
|
||||
*/
|
||||
@@ -211,7 +213,13 @@ class QueryCollector extends PDOCollector
|
||||
if (isset($trace['object']) && is_a($trace['object'], 'Twig_Template')) {
|
||||
list($file, $line) = $this->getTwigInfo($trace);
|
||||
} elseif (strpos($trace['file'], storage_path()) !== false) {
|
||||
return 'Template file';
|
||||
$hash = pathinfo($trace['file'], PATHINFO_FILENAME);
|
||||
$line = isset($trace['line']) ? $trace['line'] : '?';
|
||||
|
||||
if ($name = $this->findViewFromHash($hash)) {
|
||||
return 'view::' . $name . ':' . $line;
|
||||
}
|
||||
return 'view::' . $hash . ':' . $line;
|
||||
} else {
|
||||
$file = $trace['file'];
|
||||
$line = isset($trace['line']) ? $trace['line'] : '?';
|
||||
@@ -224,6 +232,32 @@ class QueryCollector extends PDOCollector
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the template name from the hash.
|
||||
*
|
||||
* @param string $hash
|
||||
* @return null|string
|
||||
*/
|
||||
protected function findViewFromHash($hash)
|
||||
{
|
||||
$finder = app('view')->getFinder();
|
||||
|
||||
if (isset($this->reflection['viewfinderViews'])) {
|
||||
$property = $this->reflection['viewfinderViews'];
|
||||
} else {
|
||||
$reflection = new \ReflectionClass($finder);
|
||||
$property = $reflection->getProperty('views');
|
||||
$property->setAccessible(true);
|
||||
$this->reflection['viewfinderViews'] = $property;
|
||||
}
|
||||
|
||||
foreach ($property->getValue($finder) as $name => $path){
|
||||
if (sha1($path) == $hash || md5($path) == $hash) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename/line from a Twig template trace
|
||||
*
|
||||
@@ -237,12 +271,12 @@ class QueryCollector extends PDOCollector
|
||||
if (isset($trace['line'])) {
|
||||
foreach ($trace['object']->getDebugInfo() as $codeLine => $templateLine) {
|
||||
if ($codeLine <= $trace['line']) {
|
||||
return array($file, $templateLine);
|
||||
return [$file, $templateLine];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array($file, -1);
|
||||
return [$file, -1];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,13 +292,13 @@ class QueryCollector extends PDOCollector
|
||||
}
|
||||
return str_replace(base_path(), '', $path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset the queries.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->queries = array();
|
||||
$this->queries = [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,7 +309,7 @@ class QueryCollector extends PDOCollector
|
||||
$totalTime = 0;
|
||||
$queries = $this->queries;
|
||||
|
||||
$statements = array();
|
||||
$statements = [];
|
||||
foreach ($queries as $query) {
|
||||
$totalTime += $query['time'];
|
||||
|
||||
@@ -284,33 +318,33 @@ class QueryCollector extends PDOCollector
|
||||
$bindings['hints'] = $query['hints'];
|
||||
}
|
||||
|
||||
$statements[] = array(
|
||||
$statements[] = [
|
||||
'sql' => $this->formatSql($query['query']),
|
||||
'params' => (object) $bindings,
|
||||
'duration' => $query['time'],
|
||||
'duration_str' => $this->formatDuration($query['time']),
|
||||
'stmt_id' => $query['source'],
|
||||
'connection' => $query['connection'],
|
||||
);
|
||||
];
|
||||
|
||||
//Add the results from the explain as new rows
|
||||
foreach($query['explain'] as $explain){
|
||||
$statements[] = array(
|
||||
$statements[] = [
|
||||
'sql' => ' - EXPLAIN #' . $explain->id . ': `' . $explain->table . '` (' . $explain->select_type . ')',
|
||||
'params' => $explain,
|
||||
'row_count' => $explain->rows,
|
||||
'stmt_id' => $explain->id,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'nb_statements' => count($queries),
|
||||
'nb_failed_statements' => 0,
|
||||
'accumulated_duration' => $totalTime,
|
||||
'accumulated_duration_str' => $this->formatDuration($totalTime),
|
||||
'statements' => $statements
|
||||
);
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -338,17 +372,17 @@ class QueryCollector extends PDOCollector
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
return array(
|
||||
"queries" => array(
|
||||
return [
|
||||
"queries" => [
|
||||
"icon" => "inbox",
|
||||
"widget" => "PhpDebugBar.Widgets.SQLQueriesWidget",
|
||||
"map" => "queries",
|
||||
"default" => "[]"
|
||||
),
|
||||
"queries:badge" => array(
|
||||
],
|
||||
"queries:badge" => [
|
||||
"map" => "queries.nb_statements",
|
||||
"default" => 0
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class SessionCollector extends DataCollector implements DataCollectorInterface,
|
||||
*/
|
||||
public function collect()
|
||||
{
|
||||
$data = array();
|
||||
$data = [];
|
||||
foreach ($this->session->all() as $key => $value) {
|
||||
$data[$key] = is_string($value) ? $value : $this->formatVar($value);
|
||||
}
|
||||
@@ -46,13 +46,13 @@ class SessionCollector extends DataCollector implements DataCollectorInterface,
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
return array(
|
||||
"session" => array(
|
||||
return [
|
||||
"session" => [
|
||||
"icon" => "archive",
|
||||
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
|
||||
"map" => "session",
|
||||
"default" => "{}"
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -48,14 +48,14 @@ class SymfonyRequestCollector extends DataCollector implements DataCollectorInte
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
return array(
|
||||
"request" => array(
|
||||
return [
|
||||
"request" => [
|
||||
"icon" => "tags",
|
||||
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
|
||||
"map" => "request",
|
||||
"default" => "{}"
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ class SymfonyRequestCollector extends DataCollector implements DataCollectorInte
|
||||
$response = $this->response;
|
||||
|
||||
$responseHeaders = $response->headers->all();
|
||||
$cookies = array();
|
||||
$cookies = [];
|
||||
foreach ($response->headers->getCookies() as $cookie) {
|
||||
$cookies[] = $this->getCookieHeader(
|
||||
$cookie->getName(),
|
||||
@@ -85,7 +85,7 @@ class SymfonyRequestCollector extends DataCollector implements DataCollectorInte
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'format' => $request->getRequestFormat(),
|
||||
'content_type' => $response->headers->get('Content-Type') ? $response->headers->get(
|
||||
'Content-Type'
|
||||
@@ -99,10 +99,10 @@ class SymfonyRequestCollector extends DataCollector implements DataCollectorInte
|
||||
'request_cookies' => $request->cookies->all(),
|
||||
'response_headers' => $responseHeaders,
|
||||
'path_info' => $request->getPathInfo(),
|
||||
);
|
||||
];
|
||||
|
||||
if ($this->session) {
|
||||
$sessionAttributes = array();
|
||||
$sessionAttributes = [];
|
||||
foreach ($this->session->all() as $key => $value) {
|
||||
$sessionAttributes[$key] = $value;
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
|
||||
|
||||
class ViewCollector extends TwigCollector
|
||||
{
|
||||
protected $templates = array();
|
||||
protected $templates = [];
|
||||
protected $collect_data;
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ class ViewCollector extends TwigCollector
|
||||
{
|
||||
$this->collect_data = $collectData;
|
||||
$this->name = 'views';
|
||||
$this->templates = array();
|
||||
$this->templates = [];
|
||||
$this->exporter = new ValueExporter();
|
||||
}
|
||||
|
||||
@@ -31,18 +31,18 @@ class ViewCollector extends TwigCollector
|
||||
|
||||
public function getWidgets()
|
||||
{
|
||||
return array(
|
||||
'views' => array(
|
||||
return [
|
||||
'views' => [
|
||||
'icon' => 'leaf',
|
||||
'widget' => 'PhpDebugBar.Widgets.TemplatesWidget',
|
||||
'map' => 'views',
|
||||
'default' => '[]'
|
||||
),
|
||||
'views:badge' => array(
|
||||
],
|
||||
'views:badge' => [
|
||||
'map' => 'views.nb_templates',
|
||||
'default' => 0
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,28 +73,28 @@ class ViewCollector extends TwigCollector
|
||||
if (!$this->collect_data) {
|
||||
$params = array_keys($view->getData());
|
||||
} else {
|
||||
$data = array();
|
||||
$data = [];
|
||||
foreach ($view->getData() as $key => $value) {
|
||||
$data[$key] = $this->exporter->exportValue($value);
|
||||
}
|
||||
$params = $data;
|
||||
}
|
||||
|
||||
$this->templates[] = array(
|
||||
$this->templates[] = [
|
||||
'name' => $path ? sprintf('%s (%s)', $name, $path) : $name,
|
||||
'param_count' => count($params),
|
||||
'params' => $params,
|
||||
'type' => $type,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
public function collect()
|
||||
{
|
||||
$templates = $this->templates;
|
||||
|
||||
return array(
|
||||
return [
|
||||
'nb_templates' => count($templates),
|
||||
'templates' => $templates,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user