Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip whitespace (or other characters) from the beginning and end of a string
<?php trim(string $string, string $characters = " \n\r\t\v\x00"): string
<?php     public function listContents(string $path, bool $deep): iterable

    {

        $prefix = trim($this->prefixer->prefixPath($path), '/');

        $prefix = empty($prefix) ? '' : $prefix . '/';

        $options = ['Bucket' => $this->bucket, 'Prefix' => $prefix];
<?php     public function listContents(string $path, bool $deep): iterable

    {

        $prefix = trim($this->prefixer->prefixPath($path), '/');

        $prefix = empty($prefix) ? '' : $prefix . '/';

        $options = ['Bucket' => $this->bucket, 'Prefix' => $prefix];
<?php     public function listContents(string $path, bool $deep): iterable

    {

        $path = ltrim($path, '/');

        $path = $path === '' ? $path : trim($path, '/') . '/';



        if ($deep && $this->connectionOptions->recurseManually()) {

            yield from $this->listDirectoryContentsRecursive($path);
<?php     private function normalizeWindowsObject(string $item, string $base): StorageAttributes

    {

        $item = preg_replace('#\s+#', ' ', trim($item), 3);

        $parts = explode(' ', $item, 4);



        if (count($parts) !== 4) {
<?php     private function normalizeUnixObject(string $item, string $base): StorageAttributes

    {

        $item = preg_replace('#\s+#', ' ', trim($item), 7);

        $parts = explode(' ', $item, 9);



        if (count($parts) !== 9) {
<?php                         if ( ! in_array($dirPath, $listedDirectories)) {

                            $listedDirectories[] = $dirPath;

                            yield new DirectoryAttributes(trim($prefix . $dirPath, '/'));

                        }

                    }

                }
<?php         $visibility = $config->get(Config::OPTION_DIRECTORY_VISIBILITY);

        $archive = $this->zipArchiveProvider->createZipArchive();

        $prefixedDirname = $this->pathPrefixer->prefixDirectoryPath($dirname);

        $parts = array_filter(explode('/', trim($prefixedDirname, '/')));

        $dirPath = '/';



        foreach ($parts as $part) {