Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Path and Filename #38

Merged
merged 27 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a22be5d
remove: Empty line
joshbruce Jan 3, 2024
5a98fa3
add: Authors as defined meta property
joshbruce Jan 3, 2024
3212dbb
delete: Authors specified method
joshbruce Jan 20, 2024
b883b53
update: Dependencies
joshbruce Jan 20, 2024
db8ebd1
add: File System PathFromRoot
joshbruce Jan 20, 2024
6c9237b
update: Path from root can accept UriInterface, and uses dir separator
joshbruce Jan 20, 2024
fcc1d3b
add: Test for path from root accepting UriInterface
joshbruce Jan 20, 2024
69910b7
add: PrivateDir may use PathFromRoot
joshbruce Jan 20, 2024
2a7f878
refactor: PrivateDir PathFromRoot pattern
joshbruce Jan 20, 2024
be797fb
add: PathFromRoot to PublicDir
joshbruce Jan 20, 2024
ace249c
fix: Breaking changes
joshbruce Jan 20, 2024
e0d1f17
rename: PathFromRoot to Path
joshbruce Jan 20, 2024
667569f
add: Root can be set using Path
joshbruce Jan 20, 2024
3dcd6e3
add: PrivateFile can accept Path
joshbruce Jan 20, 2024
e8ccd1a
add: PublicFile can accept Path
joshbruce Jan 20, 2024
3267e54
add: PublicContentFile can accept Path
joshbruce Jan 20, 2024
c5ab18d
add: PublicMetaFile can accept Path
joshbruce Jan 20, 2024
f0480ef
add: Note re possible deprecation
joshbruce Jan 20, 2024
023386c
add: Path can return parts
joshbruce Jan 20, 2024
2358071
add: ObjectsFromJson can use Path
joshbruce Jan 20, 2024
3ff9554
add: PlainText can use Path
joshbruce Jan 20, 2024
5d3e200
refactor: Extract method
joshbruce Jan 20, 2024
f1f5e11
remove: Comments
joshbruce Jan 20, 2024
760d904
add: Filename to PrivateFile
joshbruce Jan 20, 2024
be7c790
add: Filename to PublicFile
joshbruce Jan 20, 2024
418811e
update: Filename to use directory separator
joshbruce Jan 20, 2024
4f5d09d
fix: Style and Stan
joshbruce Jan 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 59 additions & 57 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions src/FileSystem/Directories/PrivateDirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,30 @@
use Eightfold\Amos\Php\Interfaces\Findable;
use Eightfold\Amos\Php\Interfaces\Stringable;

use Eightfold\Amos\FileSystem\Path;

use Eightfold\Amos\FileSystem\Directories\Root;

final class PrivateDirectory implements Findable, Stringable
{
private readonly SplFileInfo $fileInfo;

public static function inRoot(Root $root, string $at = ''): self
{
if (str_starts_with($at, '/') === false) {
$at = '/' . $at;
public static function inRoot(
Root $root,
string|Path $at = ''
): self {
if (is_string($at)) {
$at = Path::fromString($at);
}
return new self($root, $at);
}

// TODO: mark as final
private function __construct(
private readonly Root $root, // @phpstan-ignore-line
private readonly string $at = '' // @phpstan-ignore-line
private readonly Path $at // @phpstan-ignore-line
) {
$this->fileInfo = new SplFileInfo($root . $at);
$this->fileInfo = new SplFileInfo($root . $at->toString());
}

public function notFound(): bool
Expand Down
Loading
Loading