Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip whitespace (or other characters) from the beginning of a string
<?php ltrim(string $string, string $characters = " \n\r\t\v\x00"): string
<?php public function deleteDirectory(string $path): void
{
$prefix = $this->prefixer->prefixPath($path);
$prefix = ltrim(rtrim($prefix, '/') . '/', '/');
$objects = [];
$params = ['Bucket' => $this->bucket, 'Prefix' => $prefix];
<?php public function deleteDirectory(string $path): void
{
$prefix = $this->prefixer->prefixPath($path);
$prefix = ltrim(rtrim($prefix, '/') . '/', '/');
$this->client->deleteMatchingObjects($this->bucket, $prefix);
}
<?php public function listContents(string $path, bool $deep): iterable
{
$path = ltrim($path, '/');
$path = $path === '' ? $path : trim($path, '/') . '/';
if ($deep && $this->connectionOptions->recurseManually()) {
<?php }
if ($deep === true || strpos($subPath, '/') === false) {
yield new FileAttributes(ltrim($path, '/'), $file->fileSize(), $file->visibility(), $file->lastModified(), $file->mimeType());
}
}
}
<?php private function preparePath(string $path): string
{
return '/' . ltrim($path, '/');
}
public function deleteEverything(): void
<?php public function prefixPath(string $path): string
{
return $this->prefix . ltrim($path, '\\/');
}
public function stripPrefix(string $path): string
<?php $filename = (string) $filename;
$path = $this->prefixer->stripPrefix($location . ltrim($filename, '/'));
$attributes = $this->convertListingToAttributes($path, $attributes);
yield $attributes;
<?php if ($attributes['type'] === NET_SFTP_TYPE_DIRECTORY) {
return new DirectoryAttributes(
ltrim($path, '/'),
$this->visibilityConverter->inverseForDirectory($permissions),
$lastModified
);
<?php $filename = (string) $filename;
$path = $this->prefixer->stripPrefix($location . ltrim($filename, '/'));
$attributes = $this->convertListingToAttributes($path, $attributes);
yield $attributes;
<?php if ($attributes['type'] === NET_SFTP_TYPE_DIRECTORY) {
return new DirectoryAttributes(
ltrim($path, '/'),
$this->visibilityConverter->inverseForDirectory($permissions),
$lastModified
);