Beispiel #1
0
 /**
  * Parses the string $url and sets the class properties.
  *
  * @param string $url A string URL to parse
  */
 private function parseUrl($url = null)
 {
     $urlArray = parse_url($url);
     $this->properties['host'] = isset($urlArray['host']) ? $urlArray['host'] : null;
     $this->properties['user'] = isset($urlArray['user']) ? $urlArray['user'] : null;
     $this->properties['pass'] = isset($urlArray['pass']) ? $urlArray['pass'] : null;
     $this->properties['port'] = isset($urlArray['port']) ? $urlArray['port'] : null;
     $this->properties['scheme'] = isset($urlArray['scheme']) ? $urlArray['scheme'] : null;
     $this->properties['fragment'] = isset($urlArray['fragment']) ? $urlArray['fragment'] : null;
     $this->properties['path'] = isset($urlArray['path']) ? explode('/', trim($urlArray['path'], '/')) : array();
     $this->properties['basedir'] = array();
     $this->properties['script'] = array();
     $this->properties['params'] = array();
     $this->properties['uparams'] = array();
     if (isset($urlArray['query'])) {
         $this->properties['query'] = ezcUrlTools::parseQueryString($urlArray['query']);
     } else {
         $this->properties['query'] = array();
     }
 }
Beispiel #2
0
 /**
  * @dataProvider getQueriesParseQueryString
  */
 public function testParseQueryString($query0, $query1, $query2)
 {
     $params = ezcUrlTools::parseQueryString($query0);
     $this->assertEquals($query1, $params, "Failed parsing '{$query0}'");
     $this->assertEquals($query2, urldecode(http_build_query($params)), "Failed building back the query '{$query0}' to '{$query2}'");
 }