Carew\Document::getRootPath PHP Method

getRootPath() public method

public getRootPath ( )
    public function getRootPath()
    {
        $path = ltrim($this->path, '/');
        if (0 === ($nb = substr_count($path, DIRECTORY_SEPARATOR))) {
            return '.';
        }
        return rtrim(str_repeat('../', $nb), '/');
    }

Usage Example

Example #1
0
 /**
  * @dataProvider getGetRootPathTests
  */
 public function testGetRootPath($expected, $path)
 {
     $document = new Document();
     $document->setPath($path);
     $this->assertSame($expected, $document->getRootPath());
 }
All Usage Examples Of Carew\Document::getRootPath