示例#1
0
 public function testTrailingSlash()
 {
     $p = new Path('stairway/to/hell');
     $this->assertFalse($p->hasTrailingSeparator());
     $p->addTrailingSeparator();
     $this->assertTrue($p->hasTrailingSeparator());
     $p->removeTrailingSeparator();
     $this->assertFalse($p->hasTrailingSeparator());
 }
示例#2
0
文件: Path.php 项目: phootwork/file
 /**
  * Makes the path relative to another given path
  * 
  * @param Path $base
  * @return Path the new relative path
  */
 public function makeRelativeTo(Path $base)
 {
     $pathname = clone $this->pathname;
     return new Path($pathname->replace($base->removeTrailingSeparator()->getPathname(), ''));
 }