Skip to content

Commit

Permalink
[Add] Environment data collector
Browse files Browse the repository at this point in the history
  • Loading branch information
biplobice committed Oct 16, 2018
1 parent 28306c8 commit b4650ff
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/Concrete5Debugbar/DataCollector/EnvironmentDataCollector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
namespace Concrete5Debugbar\DataCollector;

use DebugBar\DataCollector\DataCollector;
use DebugBar\DataCollector\Renderable;

class EnvironmentDataCollector extends DataCollector implements Renderable
{
public function collect()
{
$data['variables'] = $this->getDataFormatter()->formatVar(get_defined_vars());
$data['server'] = $this->getDataFormatter()->formatVar($_SERVER);
$data['classes'] = $this->getDataFormatter()->formatVar(get_declared_classes());
$data['functions'] = $this->getDataFormatter()->formatVar(get_defined_functions());
$data['constants'] = $this->getDataFormatter()->formatVar(get_defined_constants());

return $data;
}

public function getName()
{
return 'environment';
}

public function getWidgets()
{
return [
"environment" => [
"icon" => "file-archive-o",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "environment",
"default" => "{}",
],
];
}
}
2 changes: 2 additions & 0 deletions src/Concrete5Debugbar/Debugbar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Concrete5Debugbar;

use Concrete5Debugbar\DataCollector\EnvironmentDataCollector;
use Concrete5Debugbar\DataCollector\LogDataCollector;
use Concrete5Debugbar\DataCollector\RequestDataCollector;
use Concrete5Debugbar\DataCollector\SessionDataCollector;
Expand Down Expand Up @@ -28,6 +29,7 @@ public function __construct()
\Core::make('Concrete\Core\Database\DatabaseManager')->getConfiguration()->setSQLLogger($doctrineDebugStack);
$this->addCollector(new DoctrineCollector($doctrineDebugStack));
$this->addCollector(new LogDataCollector());
$this->addCollector(new EnvironmentDataCollector());
// TODO: AuthenticationCollector: Show currently login user, session, etc.
// TODO: ControllerCollector: Show info of the controller of current request
// TODO: EventsCollector: Show all events on current request
Expand Down

0 comments on commit b4650ff

Please sign in to comment.