Ejemplo n.º 1
0
 public function testSameValueAs()
 {
     $scheme = new Scheme();
     $scheme1 = new Scheme('https');
     $this->assertFalse($scheme->sameValueAs($scheme1));
     $scheme1->set(null);
     $this->assertTrue($scheme->sameValueAs($scheme1));
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getBaseUrl()
 {
     $scheme = $this->scheme->getUriComponent();
     $auth = $this->getAuthority();
     if ('' != $auth && '' == $scheme) {
         $scheme = '//';
     }
     return $scheme . $auth;
 }
Ejemplo n.º 3
0
 /**
  * @expectedException RuntimeException
  */
 public function testAccess()
 {
     $scheme = new Scheme();
     $this->assertNull($scheme->get());
     $scheme->set('HTTP');
     $this->assertSame('http', $scheme->get());
     $scheme->set('ftp');
     $this->assertSame('ftp://', $scheme->getUriComponent());
     $scheme->set('svn');
 }
Ejemplo n.º 4
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.º 5
0
 /**
  * {@inheritdoc}
  */
 public function getBaseUrl()
 {
     $scheme = $this->scheme->getUriComponent();
     $user = $this->user->getUriComponent();
     $pass = $this->pass->getUriComponent();
     $host = $this->host->getUriComponent();
     $port = $this->port->getUriComponent();
     $user .= $pass;
     if ('' != $user) {
         $user .= '@';
     }
     if ('' != $host && '' == $scheme) {
         $scheme = '//';
     }
     return $scheme . $user . $host . $port;
 }