Ejemplo n.º 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();
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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(),
     );
 }
Ejemplo n.º 4
0
 public function testKeys()
 {
     $path = new Path(array('bar', 3, 'troll', 3));
     $this->assertCount(4, $path->keys());
     $this->assertCount(0, $path->keys('foo'));
     $this->assertSame(array(0), $path->keys('bar'));
     $this->assertCount(2, $path->keys('3'));
     $this->assertSame(array(1, 3), $path->keys('3'));
 }
Ejemplo n.º 5
0
 public function testPrepend()
 {
     $path = new Path('/toto/toto/shoky/master');
     $path->prepend('foo', 'toto', 1);
     $this->assertSame('/toto/foo/toto/shoky/master', $path->getUriComponent());
 }