FilesystemDecorator
trait FilesystemDecorator
Decorates the underlying filesystem by wrapping all calls to it with tracing.
Parameters such as paths, directories or options are attached to the span as data, parameters that contain file contents are omitted due to potential problems with payload size or sensitive data.
Properties
| protected Filesystem | $filesystem | ||
| protected array | $defaultData | ||
| protected bool | $recordSpans | ||
| protected bool | $recordBreadcrumbs |
Methods
Execute the method on the underlying filesystem and wrap it with tracing and log a breadcrumb.
Get the full path to the file that exists at the given relative path.
Determine if a file or directory exists.
Determine if a file exists.
Determine if a directory exists.
Get the contents of a file.
Get a resource to read the file.
Get a resource to read part of the file.
Write the contents of a file.
Store the uploaded file on the disk.
Store the uploaded file on the disk with a given name.
Write a new file using a stream.
Get the visibility for the given path.
Set the visibility for the given path.
Prepend to a file.
Append to a file.
Delete the file at a given path.
Copy a file to a new location.
Move a file to a new location.
Copy a file to another disk.
Move a file to another disk.
Trace a transfer while preserving the wrapped disk's identity check.
Get the file size of a given file.
Get the file's last modification time.
Get an array of all files in a directory.
Get all of the files from the given directory recursively.
Get all of the directories within a given directory.
Get all of the directories recursively.
Create a directory.
Recursively delete a directory.
Get the wrapped filesystem.
Invalidate the wrapped filesystem's pool when supported.
Get the description and data for one or more paths.
Dynamically proxy calls to the wrapped filesystem.
Details
at line 46
protected mixed
withSentry(string $method, array $args, string|null $description, array $data)
Execute the method on the underlying filesystem and wrap it with tracing and log a breadcrumb.
at line 80
string
path(string $path)
Get the full path to the file that exists at the given relative path.
at line 88
bool
exists(string $path)
Determine if a file or directory exists.
at line 96
bool
fileExists(string $path)
Determine if a file exists.
at line 104
bool
directoryExists(string $path)
Determine if a directory exists.
at line 112
string|null
get(string $path)
Get the contents of a file.
at line 122
mixed
readStream(string $path)
Get a resource to read the file.
at line 132
mixed
readStreamRange(string $path, int|null $start, int|null $end)
Get a resource to read part of the file.
at line 142
bool|string
put(string $path, mixed $contents, mixed $options = [])
Write the contents of a file.
at line 152
false|string
putFile(string|File|UploadedFile $path, array|string|File|UploadedFile|null $file = null, mixed $options = [])
Store the uploaded file on the disk.
at line 165
false|string
putFileAs(string|File|UploadedFile $path, array|string|File|UploadedFile|null $file, array|string|null $name = null, mixed $options = [])
Store the uploaded file on the disk with a given name.
at line 181
bool
writeStream(string $path, mixed $resource, array $options = [])
Write a new file using a stream.
at line 189
string
getVisibility(string $path)
Get the visibility for the given path.
at line 197
bool
setVisibility(string $path, string $visibility)
Set the visibility for the given path.
at line 205
bool
prepend(string $path, string $data, string $separator = PHP_EOL)
Prepend to a file.
at line 215
bool
append(string $path, string $data, string $separator = PHP_EOL)
Append to a file.
at line 225
bool
delete(array|string $paths)
Delete the file at a given path.
at line 235
bool
copy(string $from, string $to)
Copy a file to a new location.
at line 243
bool
move(string $from, string $to)
Move a file to a new location.
at line 251
bool
copyToDisk(Filesystem|string|UnitEnum $disk, string $from, string|null $to = null)
Copy a file to another disk.
at line 259
bool
moveToDisk(Filesystem|string|UnitEnum $disk, string $from, string|null $to = null)
Move a file to another disk.
at line 267
protected bool
transferToDisk(string $method, Filesystem|string|UnitEnum $disk, string $from, string|null $to)
Trace a transfer while preserving the wrapped disk's identity check.
at line 289
int
size(string $path)
Get the file size of a given file.
at line 297
int
lastModified(string $path)
Get the file's last modification time.
at line 305
array
files(string|null $directory = null, bool $recursive = false)
Get an array of all files in a directory.
at line 313
array
allFiles(string|null $directory = null)
Get all of the files from the given directory recursively.
at line 321
array
directories(string|null $directory = null, bool $recursive = false)
Get all of the directories within a given directory.
at line 329
array
allDirectories(string|null $directory = null)
Get all of the directories recursively.
at line 337
bool
makeDirectory(string $path)
Create a directory.
at line 345
bool
deleteDirectory(string $directory)
Recursively delete a directory.
at line 353
Filesystem
getFilesystem()
Get the wrapped filesystem.
at line 361
bool
invalidatePool()
Invalidate the wrapped filesystem's pool when supported.
at line 372
protected array
getDescriptionAndDataForPathOrPaths(array|string $pathOrPaths)
Get the description and data for one or more paths.
at line 388
mixed
__call(string $name, array $arguments)
Dynamically proxy calls to the wrapped filesystem.