function dump($routes) { $out = new ezcConsoleOutput(); /* $out->formats->headline->color = 'red'; $out->formats->headline->style = array( 'bold' ); $out->formats->sum->color = 'blue'; $out->formats->sum->style = array( 'negative' ); */ $table = new ezcConsoleTable($out, 120); $table[0][0]->content = 'Path'; $table[0][1]->content = 'Pattern'; $table[0][2]->content = 'Handler'; $table[0][3]->content = 'Requirement'; foreach ($routes->routes as $i => $route) { // create new row $row = $table[$i + 1]; $path = $route['path']; // $pattern = str_replace(array("\n","\t"," "),'', $route['compiled'] ); $pattern = $route['compiled']; $handler = \Roller\ClosureSerializer::serialize($route['callback']); $requirement = @$route['requirement'] ?: array(); $row[0]->content = $path; $row[1]->content = $pattern; $row[2]->content = $handler; $row[3]->content = var_export($requirement, true); } $table->outputTable(); }
function dumpVar($data, $level = 0) { if (is_array($data)) { $level++; $str = "array( \n"; foreach ($data as $k => $v) { if (is_integer($k)) { $str .= str_repeat(static::space, $level) . $this->dumpVar($v, $level + 1) . ",\n"; } else { $str .= str_repeat(static::space, $level) . "'{$k}' => " . $this->dumpVar($v, $level + 1) . ",\n"; } } $str .= str_repeat(static::space, $level > 0 ? $level - 1 : 0) . ")"; return $str; } elseif (is_callable($data) && is_object($data)) { return \Roller\ClosureSerializer::serialize($data); } return var_export($data, true); }