Esempio n. 1
0
 public function testPath()
 {
     $path = new Path('/test/query.php');
     $path->prepend('master');
     $this->assertSame('master/test/query.php', $path->get());
     $path->remove('test');
     $this->assertSame('master/query.php', $path->get());
     $path->remove('toto');
     $this->assertSame('master/query.php', $path->get());
     $path->remove('');
     $path->append('sullivent', 'master');
     $this->assertSame('master/sullivent/query.php', $path->get());
     $path->set(null);
     $path->append('/shop/checkout/');
     $this->assertSame('shop/checkout/', $path->get());
     $path->set(array('shop', 'rev iew', ''));
     $this->assertSame('shop/rev%20iew/', $path->get());
     $path->append(new ArrayIterator(array('sullivent', 'wacowski', '')));
     $this->assertSame('shop/rev%20iew//sullivent/wacowski/', $path->get());
     $path->prepend('master');
     $path->prepend('master');
     $this->assertSame('master/master/shop/rev%20iew//sullivent/wacowski/', (string) $path);
     $path->append('slave', 'sullivent');
     $path->append('slave', 'sullivent');
     $path->remove('');
     $this->assertSame('master/master/shop/rev%20iew/sullivent/slave/slave/wacowski/', (string) $path);
 }
Esempio n. 2
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(),
     );
 }