Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip whitespace (or other characters) from the end of a string
Alias chop
<?php rtrim(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 createDirectory(string $path, Config $config): void

    {

        $config = $config->withDefaults(['visibility' => $this->visibility->defaultForDirectories()]);

        $this->upload(rtrim($path, '/') . '/', '', $config);

    }



    public function setVisibility(string $path, string $visibility): void
<?php         }



        if ('/' === substr($path, -1)) {

            return new DirectoryAttributes(rtrim($path, '/'));

        }



        $mimeType = null;
<?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 createDirectory(string $path, Config $config): void

    {

        $config = $config->withDefaults(['visibility' => $this->visibility->defaultForDirectories()]);

        $this->upload(rtrim($path, '/') . '/', '', $config);

    }



    public function setVisibility(string $path, string $visibility): void
<?php         }



        if (substr($path, -1) === '/') {

            return new DirectoryAttributes(rtrim($path, '/'));

        }



        $mimetype = $metadata['ContentType'] ?? null;
<?php         }



        [$date, $time, $size, $name] = $parts;

        $path = $base === '' ? $name : rtrim($base, '/') . '/' . $name;



        if ($size === '<DIR>') {

            return new DirectoryAttributes($path);
<?php         [$permissions, /* $number */, /* $owner */, /* $group */, $size, $month, $day, $timeOrYear, $name] = $parts;

        $isDirectory = $this->listingItemIsDirectory($permissions);

        $permissions = $this->normalizePermissions($permissions);

        $path = $base === '' ? $name : rtrim($base, '/') . '/' . $name;

        $lastModified = $this->connectionOptions->timestampsOnUnixListingsEnabled()

            ? $this->normalizeUnixTimestamp($month, $day, $timeOrYear)

            : null;
<?php     private function ftpRawlist(string $options, string $path): array

    {

        $path = rtrim($path, '/') . '/';

        $connection = $this->connection();



        if ($this->isPureFtpdServer()) {
<?php         $connection = $this->connection();



        $dirPath = '';

        $parts = explode('/', rtrim($dirname, '/'));

        $mode = $visibility ? $this->visibilityConverter->forDirectory($visibility) : false;



        foreach ($parts as $part) {
<?php     public function createDirectory(string $path, Config $config): void

    {

        $prefixedPath = rtrim($this->prefixer->prefixPath($path), '/') . '/';

        $this->bucket->upload('', ['name' => $prefixedPath]);

    }
<?php         $lastModified = strtotime($info['updated']);



        if (substr($path, -1, 1) === '/') {

            return new DirectoryAttributes(rtrim($path, '/'), null, $lastModified);

        }



        $fileSize = intval($info['size']);
<?php         $prefixes = $options = [];



        if ( ! empty($prefixedPath)) {

            $options = ['prefix' => sprintf('%s/', rtrim($prefixedPath, '/'))];

        }



        if ($deep === false) {
<?php     public function deleteDirectory(string $prefix): void

    {

        $prefix = $this->preparePath($prefix);

        $prefix = rtrim($prefix, '/') . '/';



        foreach (array_keys($this->files) as $path) {

            if (strpos($path, $prefix) === 0) {
<?php     public function createDirectory(string $path, Config $config): void

    {

        $filePath = rtrim($path, '/') . '/' . self::DUMMY_FILE_FOR_FORCED_LISTING_IN_FLYSYSTEM_TEST;

        $this->write($filePath, '', $config);

    }