Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #61 from Elao/fix/collector-name
Browse files Browse the repository at this point in the history
Change the collector name
  • Loading branch information
benji07 committed Jan 30, 2015
2 parents 1ce4ba3 + 83eed41 commit 8090ced
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 38 deletions.
2 changes: 1 addition & 1 deletion DataCollector/AsseticDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ public function getDisplayInWdt()
*/
public function getName()
{
return 'assetic';
return 'elao_assetic';
}
}
2 changes: 1 addition & 1 deletion DataCollector/ContainerDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function getDisplayInWdt()
*/
public function getName()
{
return 'container';
return 'elao_container';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion DataCollector/RoutingDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,6 @@ public function getDisplayInWdt()
*/
public function getName()
{
return 'routing';
return 'elao_routing';
}
}
49 changes: 24 additions & 25 deletions DataCollector/TwigDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function collect(Request $request, Response $response, \Exception $except
foreach ($extension->getFilters() as $filterName => $filter) {
if ($filter instanceof \Twig_FilterInterface) {
$call = $filter->compile();
if(is_array($call) && is_callable($call)) {
if (is_array($call) && is_callable($call)) {
$call = 'Method '.$call[1].' of an object '.get_class($call[0]);
}
} else {
Expand Down Expand Up @@ -100,14 +100,15 @@ public function collect(Request $request, Response $response, \Exception $except
);
}
}

$globals = array();
foreach($this->getTwig()->getGlobals() as $globalName => $global) {
$globals[] = array(
'name' => $globalName,
'value' => $this->getVarDump($global),
);
}

$globals = array();

foreach ($this->getTwig()->getGlobals() as $globalName => $global) {
$globals[] = array(
'name' => $globalName,
'value' => $this->getVarDump($global),
);
}

$this->data['globals'] = $globals;
$this->data['extensions'] = $extensions;
Expand Down Expand Up @@ -270,12 +271,12 @@ public function getDisplayInWdt()
*/
public function getName()
{
return 'twig';
return 'elao_twig';
}

/**
* Returns var_dump like of a variable but avoiding flood dumping
*
*
* @return string Formated var_dump
*/
protected function getVarDump($var)
Expand All @@ -287,21 +288,19 @@ protected function getVarDump($var)
case 'double':
case 'NULL':
case 'ressource':
return print_r($var, 1);
break;
return print_r($var, 1);
case 'string':
return (250 < strlen($var)) ? substr($var, 0, 250).'...' : $var;
break;
return (250 < strlen($var)) ? substr($var, 0, 250).'...' : $var;
case 'object':
return 'Object instance of ' . get_class($var);
break;
return 'Object instance of ' . get_class($var);
case 'array':
$formated_array = array();
foreach ($var as $key => $value) {
$formated_array[$key] = $this->getVarDump($value);
}
return print_r($formated_array, 1);
break;
}
$formated_array = array();

foreach ($var as $key => $value) {
$formated_array[$key] = $this->getVarDump($value);
}

return print_r($formated_array, 1);
}
}
}
8 changes: 4 additions & 4 deletions DependencyInjection/WebProfilerExtraExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

/**
* ExtraProfilerExtension is an extension to add debug information to the web profiler:
* assetic: Information about assetics assets
* routing: Information about loaded routes
* container: Information about the container configuration & sevices
* twig: Information about Twig
* assetic: Information about assetics assets
* routing: Information about loaded routes
* container: Information about the container configuration & sevices
* twig: Information about Twig
*
* @author Vincent Bouzeran <vincent.bouzeran@elao.com>
* @author Grégoire Pineau <lyrixx@lyrixx.info>
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/assetic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<service id="web_profiler_extra.data_collector.assetic" class="%web_profiler_extra.data_collector.assetic.class%" public="false">
<argument type="service" id="service_container" />
<argument>%web_profiler_extra.data_collector.assetic.display_in_wdt%</argument>
<tag name="data_collector" template="WebProfilerExtraBundle:Collector:assetic" id="assetic" />
<tag name="data_collector" template="WebProfilerExtraBundle:Collector:assetic" id="elao_assetic" />
</service>
</services>
</container>
2 changes: 1 addition & 1 deletion Resources/config/container.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<service id="web_profiler_extra.data_collector.container" class="%web_profiler_extra.data_collector.container.class%" public="false">
<argument type="service" id="kernel" />
<argument>%web_profiler_extra.data_collector.container.display_in_wdt%</argument>
<tag name="data_collector" template="WebProfilerExtraBundle:Collector:container" id="container" />
<tag name="data_collector" template="WebProfilerExtraBundle:Collector:container" id="elao_container" />
</service>
</services>
</container>
2 changes: 1 addition & 1 deletion Resources/config/routing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<service id="web_profiler_extra.data_collector.routing" class="%web_profiler_extra.data_collector.routing.class%" public="false">
<argument type="service" id="router" />
<argument>%web_profiler_extra.data_collector.routing.display_in_wdt%</argument>
<tag name="data_collector" template="WebProfilerExtraBundle:Collector:routing" id="routing" />
<tag name="data_collector" template="WebProfilerExtraBundle:Collector:routing" id="elao_routing" />
</service>
</services>
</container>
2 changes: 1 addition & 1 deletion Resources/config/twig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<service id="web_profiler_extra.data_collector.twig" class="%web_profiler_extra.data_collector.twig.class%" public="false">
<argument type="service" id="service_container" />
<argument>%web_profiler_extra.data_collector.twig.display_in_wdt%</argument>
<tag name="data_collector" template="WebProfilerExtraBundle:Collector:twig" id="twig" />
<tag name="data_collector" template="WebProfilerExtraBundle:Collector:twig" id="elao_twig" />
</service>
</services>
</container>
4 changes: 2 additions & 2 deletions Resources/meta/LICENCE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012 Elao - http://www.elao.com
Copyright (c) 2015 Elao - http://www.elao.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.

0 comments on commit 8090ced

Please sign in to comment.