예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function getRelativeUrl(UrlInterface $ref_url = null)
 {
     if (is_null($ref_url)) {
         return $this->path->getUriComponent() . $this->query->getUriComponent() . $this->fragment->getUriComponent();
     } elseif ($this->getBaseUrl() != $ref_url->getBaseUrl()) {
         return $this->__toString();
     }
     return $this->path->getRelativePath($ref_url->getPath()) . $this->query->getUriComponent() . $this->fragment->getUriComponent();
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function getRelativeUrl()
 {
     $path = $this->path->getUriComponent();
     $query = $this->query->getUriComponent();
     $fragment = $this->fragment->getUriComponent();
     if ('' == $path) {
         $path = '/' . $path;
     }
     return $path . $query . $fragment;
 }
예제 #3
0
 /**
  * Retuns a array representation like parse_url
  * But includes all components
  *
  * @return array
  */
 public function toArray()
 {
     return array(
         'scheme' => $this->scheme->get(),
         'user' => $this->user->get(),
         'pass' => $this->pass->get(),
         'host' => $this->host->get(),
         'port' => $this->port->get(),
         'path' => $this->path->get(),
         'query' => $this->query->get(),
         'fragment' => $this->fragment->get(),
     );
 }
예제 #4
0
 public function testKeys()
 {
     $query = new Query(array('foo' => 'bar', 'baz' => 'troll', 'lol' => 3, 'toto' => 'troll'));
     $this->assertCount(0, $query->keys('foo'));
     $this->assertSame(array('foo'), $query->keys('bar'));
     $this->assertCount(0, $query->keys('3'));
     $this->assertSame(array('lol'), $query->keys(3));
     $this->assertSame(array('baz', 'toto'), $query->keys('troll'));
 }