fixed curlies folding, part three, handled remaining special cases manually
This commit is contained in:
parent
9ed3d0468e
commit
33a7d9a0a4
@ -68,13 +68,12 @@ abstract class FileLoader implements LoaderInterface
|
|||||||
|
|
||||||
static protected function isAbsolutePath($file)
|
static protected function isAbsolutePath($file)
|
||||||
{
|
{
|
||||||
if ($file[0] == '/' || $file[0] == '\\' ||
|
if ($file[0] == '/' || $file[0] == '\\'
|
||||||
(strlen($file) > 3 && ctype_alpha($file[0]) &&
|
|| (strlen($file) > 3 && ctype_alpha($file[0])
|
||||||
$file[1] == ':' &&
|
&& $file[1] == ':'
|
||||||
($file[2] == '\\' || $file[2] == '/')
|
&& ($file[2] == '\\' || $file[2] == '/')
|
||||||
)
|
)
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +73,9 @@ class PhpMatcherDumper extends MatcherDumper
|
|||||||
$conditions = implode(' && ', $conditions);
|
$conditions = implode(' && ', $conditions);
|
||||||
|
|
||||||
$code[] = sprintf(<<<EOF
|
$code[] = sprintf(<<<EOF
|
||||||
if ($conditions)
|
if ($conditions) {
|
||||||
return array_merge(\$this->mergeDefaults(\$matches, %s), array('_route' => '%s'));
|
return array_merge(\$this->mergeDefaults(\$matches, %s), array('_route' => '%s'));
|
||||||
|
}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
, str_replace("\n", '', var_export($compiledRoute->getDefaults(), true)), $name);
|
, str_replace("\n", '', var_export($compiledRoute->getDefaults(), true)), $name);
|
||||||
|
@ -96,13 +96,12 @@ class FilesystemLoader extends Loader
|
|||||||
*/
|
*/
|
||||||
static protected function isAbsolutePath($file)
|
static protected function isAbsolutePath($file)
|
||||||
{
|
{
|
||||||
if ($file[0] == '/' || $file[0] == '\\' ||
|
if ($file[0] == '/' || $file[0] == '\\'
|
||||||
(strlen($file) > 3 && ctype_alpha($file[0]) &&
|
|| (strlen($file) > 3 && ctype_alpha($file[0])
|
||||||
$file[1] == ':' &&
|
&& $file[1] == ':'
|
||||||
($file[2] == '\\' || $file[2] == '/')
|
&& ($file[2] == '\\' || $file[2] == '/')
|
||||||
)
|
)
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,11 +120,9 @@ class Inline
|
|||||||
{
|
{
|
||||||
// array
|
// array
|
||||||
$keys = array_keys($value);
|
$keys = array_keys($value);
|
||||||
if (
|
if ((1 == count($keys) && '0' == $keys[0])
|
||||||
(1 == count($keys) && '0' == $keys[0])
|
|| (count($keys) > 1 && array_reduce($keys, function ($v, $w) { return (integer) $v + $w; }, 0) == count($keys) * (count($keys) - 1) / 2)
|
||||||
||
|
) {
|
||||||
(count($keys) > 1 && array_reduce($keys, function ($v, $w) { return (integer) $v + $w; }, 0) == count($keys) * (count($keys) - 1) / 2))
|
|
||||||
{
|
|
||||||
$output = array();
|
$output = array();
|
||||||
foreach ($value as $val) {
|
foreach ($value as $val) {
|
||||||
$output[] = self::dump($val);
|
$output[] = self::dump($val);
|
||||||
|
@ -82,8 +82,8 @@ class Parser
|
|||||||
} else {
|
} else {
|
||||||
if (isset($values['leadspaces'])
|
if (isset($values['leadspaces'])
|
||||||
&& ' ' == $values['leadspaces']
|
&& ' ' == $values['leadspaces']
|
||||||
&& preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{].*?) *\:(\s+(?P<value>.+?))?\s*$#', $values['value'], $matches))
|
&& preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{].*?) *\:(\s+(?P<value>.+?))?\s*$#', $values['value'], $matches)
|
||||||
{
|
) {
|
||||||
// this is a compact notation element, add to next block and parse
|
// this is a compact notation element, add to next block and parse
|
||||||
$c = $this->getRealCurrentLineNb();
|
$c = $this->getRealCurrentLineNb();
|
||||||
$parser = new Parser($c);
|
$parser = new Parser($c);
|
||||||
|
@ -47,16 +47,11 @@ class WebDebugToolbar
|
|||||||
|
|
||||||
$request = $this->container->getRequestService();
|
$request = $this->container->getRequestService();
|
||||||
|
|
||||||
if (
|
if ('3' === substr($response->getStatusCode(), 0, 1)
|
||||||
'3' === substr($response->getStatusCode(), 0, 1)
|
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
|
||||||
||
|
|| 'html' !== $request->getRequestFormat()
|
||||||
($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
|
|| $request->isXmlHttpRequest()
|
||||||
||
|
) {
|
||||||
'html' !== $request->getRequestFormat()
|
|
||||||
||
|
|
||||||
$request->isXmlHttpRequest()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,9 @@ class ExceptionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$currentContent = '';
|
$currentContent = '';
|
||||||
while (false !== $content = ob_get_clean()) { $currentContent .= $content; }
|
while (false !== $content = ob_get_clean()) {
|
||||||
|
$currentContent .= $content;
|
||||||
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
require $template;
|
require $template;
|
||||||
|
@ -91,8 +91,7 @@ class ControllerLoader
|
|||||||
$logs[] = sprintf('Failed finding controller "%s:%s" from namespace "%s" (%s)', $bundle, $controller, $namespace, $try);
|
$logs[] = sprintf('Failed finding controller "%s:%s" from namespace "%s" (%s)', $bundle, $controller, $namespace, $try);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!in_array($namespace.'\\'.$bundle.'\\Bundle', array_map(function ($bundle) { return get_class($bundle); }, $this->container->getKernelService()->getBundles())))
|
if (!in_array($namespace.'\\'.$bundle.'\\Bundle', array_map(function ($bundle) { return get_class($bundle); }, $this->container->getKernelService()->getBundles()))) {
|
||||||
{
|
|
||||||
throw new \LogicException(sprintf('To use the "%s" controller, you first need to enable the Bundle "%s" in your Kernel class.', $try, $namespace.'\\'.$bundle));
|
throw new \LogicException(sprintf('To use the "%s" controller, you first need to enable the Bundle "%s" in your Kernel class.', $try, $namespace.'\\'.$bundle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user