Просмотр исходного кода

fixed curlies folding, part three, handled remaining special cases manually

Jordi Boggiano 15 лет назад
Родитель
Сommit
33a7d9a0a4

+ 6 - 7
src/Symfony/Components/Routing/Loader/FileLoader.php

@@ -68,13 +68,12 @@ abstract class FileLoader implements LoaderInterface
 
     static protected function isAbsolutePath($file)
     {
-        if ($file[0] == '/' || $file[0] == '\\' ||
-                (strlen($file) > 3 && ctype_alpha($file[0]) &&
-                 $file[1] == ':' &&
-                 ($file[2] == '\\' || $file[2] == '/')
-                )
-             )
-        {
+        if ($file[0] == '/' || $file[0] == '\\' 
+            || (strlen($file) > 3 && ctype_alpha($file[0]) 
+                && $file[1] == ':' 
+                && ($file[2] == '\\' || $file[2] == '/')
+            )
+        ) {
             return true;
         }
 

+ 2 - 1
src/Symfony/Components/Routing/Matcher/Dumper/PhpMatcherDumper.php

@@ -73,8 +73,9 @@ class PhpMatcherDumper extends MatcherDumper
             $conditions = implode(' && ', $conditions);
 
             $code[] = sprintf(<<<EOF
-        if ($conditions)
+        if ($conditions) {
             return array_merge(\$this->mergeDefaults(\$matches, %s), array('_route' => '%s'));
+        }
 
 EOF
             , str_replace("\n", '', var_export($compiledRoute->getDefaults(), true)), $name);

+ 6 - 7
src/Symfony/Components/Templating/Loader/FilesystemLoader.php

@@ -96,13 +96,12 @@ class FilesystemLoader extends Loader
      */
     static protected function isAbsolutePath($file)
     {
-        if ($file[0] == '/' || $file[0] == '\\' ||
-                (strlen($file) > 3 && ctype_alpha($file[0]) &&
-                 $file[1] == ':' &&
-                 ($file[2] == '\\' || $file[2] == '/')
-                )
-             )
-        {
+        if ($file[0] == '/' || $file[0] == '\\' 
+            || (strlen($file) > 3 && ctype_alpha($file[0]) 
+                && $file[1] == ':' 
+                && ($file[2] == '\\' || $file[2] == '/')
+            )
+        ) {
             return true;
         }
 

+ 3 - 5
src/Symfony/Components/Yaml/Inline.php

@@ -120,11 +120,9 @@ class Inline
     {
         // array
         $keys = array_keys($value);
-        if (
-            (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))
-        {
+        if ((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)
+        ) {
             $output = array();
             foreach ($value as $val) {
                 $output[] = self::dump($val);

+ 2 - 2
src/Symfony/Components/Yaml/Parser.php

@@ -82,8 +82,8 @@ class Parser
                 } else {
                     if (isset($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
                         $c = $this->getRealCurrentLineNb();
                         $parser = new Parser($c);

+ 5 - 10
src/Symfony/Framework/ProfilerBundle/Listener/WebDebugToolbar.php

@@ -47,16 +47,11 @@ class WebDebugToolbar
 
         $request = $this->container->getRequestService();
 
-        if (
-            '3' === substr($response->getStatusCode(), 0, 1)
-            ||
-            ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
-            ||
-            'html' !== $request->getRequestFormat()
-            ||
-            $request->isXmlHttpRequest()
-        )
-        {
+        if ('3' === substr($response->getStatusCode(), 0, 1)
+            || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
+            || 'html' !== $request->getRequestFormat()
+            || $request->isXmlHttpRequest()
+        ) {
             return $response;
         }
 

+ 3 - 1
src/Symfony/Framework/WebBundle/Controller/ExceptionController.php

@@ -67,7 +67,9 @@ class ExceptionController extends Controller
         }
 
         $currentContent = '';
-        while (false !== $content = ob_get_clean()) { $currentContent .= $content; }
+        while (false !== $content = ob_get_clean()) {
+            $currentContent .= $content; 
+        }
 
         ob_start();
         require $template;

+ 1 - 2
src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php

@@ -91,8 +91,7 @@ class ControllerLoader
                     $logs[] = sprintf('Failed finding controller "%s:%s" from namespace "%s" (%s)', $bundle, $controller, $namespace, $try);
                 }
             } 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));
                 }