Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
Unix paths now create unix paths for results. Closes #25
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Jul 29, 2013
1 parent b5b48f1 commit c5a6816
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
10 changes: 2 additions & 8 deletions src/Eloquent/Pathogen/AbstractPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -964,16 +964,10 @@ protected function createPath(
$hasTrailingSeparator = null
) {
if ($isAbsolute) {
return new AbsolutePath(
$atoms,
$hasTrailingSeparator
);
return new AbsolutePath($atoms, $hasTrailingSeparator);
}

return new RelativePath(
$atoms,
$hasTrailingSeparator
);
return new RelativePath($atoms, $hasTrailingSeparator);
}

/**
Expand Down
18 changes: 18 additions & 0 deletions src/Eloquent/Pathogen/Unix/AbsoluteUnixPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,22 @@
class AbsoluteUnixPath extends AbstractAbsoluteFileSystemPath implements
AbsoluteUnixPathInterface
{
/**
* @param mixed<string> $atoms
* @param boolean $isAbsolute
* @param boolean|null $hasTrailingSeparator
*
* @return PathInterface
*/
protected function createPath(
$atoms,
$isAbsolute,
$hasTrailingSeparator = null
) {
if ($isAbsolute) {
return new static($atoms, $hasTrailingSeparator);
}

return new RelativeUnixPath($atoms, $hasTrailingSeparator);
}
}
14 changes: 14 additions & 0 deletions src/Eloquent/Pathogen/Unix/RelativeUnixPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,18 @@
class RelativeUnixPath extends AbstractRelativeFileSystemPath implements
RelativeUnixPathInterface
{
/**
* @param mixed<string> $atoms
* @param boolean $isAbsolute
* @param boolean|null $hasTrailingSeparator
*
* @return PathInterface
*/
protected function createPath(
$atoms,
$isAbsolute,
$hasTrailingSeparator = null
) {
return new static($atoms, $hasTrailingSeparator);
}
}
6 changes: 1 addition & 5 deletions src/Eloquent/Pathogen/Windows/AbsoluteWindowsPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,7 @@ protected function createPathWithDrive(
$drive,
$hasTrailingSeparator = null
) {
return new static(
$atoms,
$drive,
$hasTrailingSeparator
);
return new static($atoms, $drive, $hasTrailingSeparator);
}

private $drive;
Expand Down

0 comments on commit c5a6816

Please sign in to comment.