Permalink
Browse files

Added filters method to Report to render all filters and updated html…

… and console strategies to use it
  • Loading branch information...
1 parent b67d957 commit 944fd8f2492134c737d32f99015c90841b704a6a @indiefan indiefan committed with gwoo Mar 6, 2010
@@ -99,10 +99,8 @@ public function run() {
$this->hr();
$this->out($report->render('stats', $report->stats()));
- foreach ($report->results['filters'] as $filter => $data) {
- $filterClass = explode("\\", $filter);
- $filterClass = array_pop($filterClass);
- $this->out($report->render(strtolower($filterClass), array("analysis" => $data)));
+ if ($filterResults = $report->filters("\n")) {
+ $this->out($filterResults);
}
$this->hr();
@@ -213,6 +213,23 @@ public function render($template, $data = array()) {
return ob_get_clean();
});
}
+
+ /**
+ * Loops through and renders each filter that currently has stored results
+ *
+ * @param string $separator Optional separator string to join the templates on
+ * @return string|boolean
+ */
+ public function filters($separator = null) {
+ $output = false;
+ foreach ($this->results['filters'] as $filter => $analysis) {
+ $filterClass = explode("\\", $filter);
+ $filterClass = array_pop($filterClass);
+ $output .= $separator . $this->render(strtolower($filterClass), compact('analysis'));
+ }
+
+ return $output;
+ }
}
?>
@@ -56,11 +56,7 @@ function($class) use ($request) {
<?php
echo $report->render("stats", $report->stats());
- foreach ($report->results['filters'] as $filter => $data) {
- $filterClass = explode("\\", $filter);
- $filterClass = array_pop($filterClass);
- echo $report->render(strtolower($filterClass), array("analysis" => $data));
- }
+ echo $report->filters();
?>
</div>
</article>

0 comments on commit 944fd8f

Please sign in to comment.