浏览代码

removed defaults to TemplateNameParserInterface::parse() method as it was not used anywhere (everything is explicit now)

Fabien Potencier 14 年之前
父节点
当前提交
b4acae5b73

+ 6 - 13
src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php

@@ -38,12 +38,11 @@ class TemplateNameParser extends BaseTemplateNameParser
     /**
      * Parses a template to a template name and an array of options.
      *
-     * @param string $name     A template name
-     * @param array  $defaults An array of default options
+     * @param string $name A template name
      *
      * @return array An array composed of the template name and an array of options
      */
-    public function parse($name, array $defaults = array())
+    public function parse($name)
     {
         $parts = explode(':', $name);
         if (3 !== count($parts)) {
@@ -71,16 +70,10 @@ class TemplateNameParser extends BaseTemplateNameParser
             }
         }
 
-        $options = array_replace(
-            array(
-                'format' => '',
-            ),
-            $defaults,
-            array(
-                // bundle is used as part of the template path, so we need /
-                'bundle'     => str_replace('\\', '/', $bundle),
-                'controller' => $parts[1],
-            )
+        $options = array(
+            // bundle is used as part of the template path, so we need /
+            'bundle'     => str_replace('\\', '/', $bundle),
+            'controller' => $parts[1],
         );
 
         $elements = explode('.', $parts[2]);

+ 3 - 17
src/Symfony/Component/Templating/TemplateNameParser.php

@@ -18,29 +18,15 @@ namespace Symfony\Component\Templating;
  */
 class TemplateNameParser implements TemplateNameParserInterface
 {
-    protected $defaultOptions = array();
-
     /**
      * Parses a template to a template name and an array of options.
      *
-     * @param string $name     A template name
-     * @param array  $defaults An array of default options
+     * @param string $name A template name
      *
      * @return array An array composed of the template name and an array of options
      */
-    public function parse($name, array $defaults = array())
-    {
-        return array($name, array_merge($this->defaultOptions, $defaults));
-    }
-
-    /**
-     * Sets a default option.
-     *
-     * @param string $name  The option name
-     * @param mixed  $value The option value
-     */
-    public function setDefaultOption($name, $value)
+    public function parse($name)
     {
-        $this->defaultOptions[$name] = $value;
+        return array($name, array());
     }
 }

+ 2 - 3
src/Symfony/Component/Templating/TemplateNameParserInterface.php

@@ -21,10 +21,9 @@ interface TemplateNameParserInterface
     /**
      * Parses a template to a template name and an array of options.
      *
-     * @param string $name     A template name
-     * @param array  $defaults An array of default options
+     * @param string $name A template name
      *
      * @return array An array composed of the template name and an array of options
      */
-    function parse($name, array $defaults = array());
+    function parse($name);
 }