Переглянути джерело

[RequestHandler] added a way to delete a parameter from a RequestBag instance

Fabien Potencier 15 роки тому
батько
коміт
3074f12727
1 змінених файлів з 11 додано та 1 видалено
  1. 11 1
      src/Symfony/Components/RequestHandler/RequestBag.php

+ 11 - 1
src/Symfony/Components/RequestHandler/RequestBag.php

@@ -24,7 +24,7 @@ class RequestBag
 
   public function __construct($input)
   {
-    $this->input = $input;
+    $this->replace($input);
   }
 
   /**
@@ -69,6 +69,16 @@ class RequestBag
     return array_key_exists($key, $this->input);
   }
 
+  /**
+   * Deletes a parameter.
+   *
+   * @param string $key The key
+   */
+  public function delete($key)
+  {
+    unset($this->input[$key]);
+  }
+
   /**
    * Returns the alphabetic characters of the parameter value.
    *