function testMergeInObject()
 {
     $encoding = new SimpleGetEncoding(array('a' => 'A1', 'b' => 'B'));
     $encoding->merge(new SimpleEncoding(array('a' => 'A2')));
     $this->assertIdentical($encoding->getValue('a'), array('A1', 'A2'));
     $this->assertIdentical($encoding->getValue('b'), 'B');
 }
Example #2
0
 /**
  *    Breaks the request down into an object.
  *    @param string $raw           Raw request.
  *    @return SimpleFormEncoding    Parsed data.
  *    @access private
  */
 function _parseRequest($raw)
 {
     $this->_raw = $raw;
     $request = new SimpleGetEncoding();
     foreach (split("&", $raw) as $pair) {
         if (preg_match('/(.*?)=(.*)/', $pair, $matches)) {
             $request->add($matches[1], urldecode($matches[2]));
         } elseif ($pair) {
             $request->add($pair, '');
         }
     }
     return $request;
 }
Example #3
0
 /**
  *    Breaks the request down into an object.
  *    @param string $raw           Raw request.
  *    @return SimpleFormEncoding    Parsed data.
  *    @access private
  */
 protected function parseRequest($raw)
 {
     $this->raw = $raw;
     $request = new SimpleGetEncoding();
     foreach (explode("&", $raw) as $pair) {
         if (preg_match('/(.*?)=(.*)/', $pair, $matches)) {
             $request->add(urldecode($matches[1]), urldecode($matches[2]));
         } elseif ($pair) {
             $request->add(urldecode($pair), '');
         }
     }
     return $request;
 }
 /**
  *    Starts empty.
  *    @param array $query       Hash of parameters.
  *                              Multiple values are
  *                              as lists on a single key.
  *    @access public
  */
 function __construct($query = false)
 {
     parent::__construct($query);
 }