replaced some var_export() with json_encode() for better readability

This commit is contained in:
Fabien Potencier 2011-01-26 15:55:28 +01:00
parent 5d963f5460
commit fb889a2eee
5 changed files with 6 additions and 6 deletions

View File

@ -41,7 +41,7 @@ class DbalLogger extends DebugStack
parent::startQuery($sql, $params, $types);
if (null !== $this->logger) {
$this->log($sql.' ('.str_replace("\n", '', var_export($params, true)).')');
$this->log($sql.' ('.json_encode($params, true).')');
}
}

View File

@ -86,7 +86,7 @@ class RequestListener
// add attributes based on the path info (routing)
if (false !== $parameters = $this->router->match($request->getPathInfo())) {
if (null !== $this->logger) {
$this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], str_replace("\n", '', var_export($parameters, true))));
$this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], str_replace("\n", '', json_encode($parameters, true))));
}
$request->attributes->add($parameters);

View File

@ -44,7 +44,7 @@ class CachedTemplateLocator implements TemplateLocatorInterface
$key = md5(serialize($template));
if (!isset($this->templates[$key])) {
throw new \InvalidArgumentException(sprintf('Unable to find template "%s".', var_export($template, true)));
throw new \InvalidArgumentException(sprintf('Unable to find template "%s".', json_encode($template, true)));
}
return $this->templates[$key];

View File

@ -57,7 +57,7 @@ class TemplateLocator implements TemplateLocatorInterface
return $this->cache[$key] = $file;
}
throw new \InvalidArgumentException(sprintf('Unable to find template "%s" in "%s".', var_export($template, true), $this->path));
throw new \InvalidArgumentException(sprintf('Unable to find template "%s" in "%s".', json_encode($template, true), $this->path));
}
$resource = $template['bundle'].'/Resources/views/'.$template['controller'].'/'.$template['name'].'.'.$template['format'].'.'.$template['engine'];
@ -65,7 +65,7 @@ class TemplateLocator implements TemplateLocatorInterface
try {
return $this->kernel->locateResource('@'.$resource, $this->path);
} catch (\Exception $e) {
throw new \InvalidArgumentException(sprintf('Unable to find template "%s".', var_export($template, true), $this->path), 0, $e);
throw new \InvalidArgumentException(sprintf('Unable to find template "%s".', json_encode($template, true), $this->path), 0, $e);
}
}
}

View File

@ -85,7 +85,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess
// render
if (false === $content = $this->evaluate($template, $parameters)) {
throw new \RuntimeException(sprintf('The template "%s" cannot be rendered.', var_export($template, true)));
throw new \RuntimeException(sprintf('The template "%s" cannot be rendered.', json_encode($template)));
}
// decorator