Skip to content

Commit

Permalink
feat(util.path): add expand()
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Aug 24, 2018
1 parent 4ab7e03 commit 9af6f4e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Util/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,19 @@ public function loadClasses(array $inPaths, array $namespaces, string $ext = 'ph
return \preg_grep('~^' . \preg_quote($namespaces) . '~', $allClasses);
}

protected function expand(string $path, string $from = ''): string
{
if ($path[0] === '~') {
return \str_replace('~', \getenv('HOME'), $path);
}

if (\strlen($from) > 0 && !$this->isAbsolute($path)) {
return $this->join($from, $path);
}

return $path;
}

protected function initPhintPath()
{
if (null !== $this->phintPath) {
Expand Down

0 comments on commit 9af6f4e

Please sign in to comment.