for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of cloak.
*
* (c) Noritaka Horio <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace cloak\value;
use Eloquent\Pathogen\Factory\PathFactory;
use Eloquent\Pathogen\RelativePath;
* Class Path
* @package cloak\value
final class Path
{
* @var \Eloquent\Pathogen\PathInterface
private $rootPath;
* @param string $path
public function __construct($path)
$this->rootPath = PathFactory::instance()->create($path);
}
public function join($path)
$relativePath = RelativePath::fromString($path);
$resultPath = $this->rootPath->join($relativePath);
$newRootPath = $resultPath->normalize()->string();
return Path::fromString($newRootPath);
* @return string
public function stringify()
return $this->rootPath->normalize()->string();
public function __toString()
return $this->stringify();
* @return Path
public static function fromString($path)
return new self($path);