Storage/src/StreamWrapper.php
private function urlStatDirectory()
    {
        $stats = [];
        // 1. try to look up the directory as a file
        try {
            $this->object = $this->bucket->object($this->file);
            $info = $this->object->info();

            // equivalent to 40777 and 40444 in octal
            $stats['mode'] = $this->bucket->isWritable()
                ? self::DIRECTORY_WRITABLE_MODE
                : self::DIRECTORY_READABLE_MODE;
            $this->statsFromFileInfo($info, $stats);

            return $this->makeStatArray($stats);
        } catch (NotFoundException $e) {
        } catch (ServiceException $e) {
            return false;
        }

        // 2. try list files in that directory
        try {
            $objects = $this->bucket->objects([
                'prefix' => $this->file,
            ]);

            if (!$objects->current()) {
                // can't list objects or doesn't exist
                return false;
            }
        } catch (ServiceException $e) {
            return false;
        }

        // equivalent to 40777 and 40444 in octal
        $mode = $this->bucket->isWritable()
            ? self::DIRECTORY_WRITABLE_MODE
            : self::DIRECTORY_READABLE_MODE;
        return $this->makeStatArray([
            'mode'    => $mode
        ]);
    }
private function urlStatDirectory()
    {
        $stats = [];
        // 1. try to look up the directory as a file
        try {
            $this->object = $this->bucket->object($this->file);
            $info = $this->object->info();

            // equivalent to 40777 and 40444 in octal
            $stats['mode'] = $this->bucket->isWritable()
                ? self::DIRECTORY_WRITABLE_MODE
                : self::DIRECTORY_READABLE_MODE;
            $this->statsFromFileInfo($info, $stats);

            return $this->makeStatArray($stats);
        } catch (NotFoundException $e) {
        } catch (ServiceException $e) {
            return false;
        }

        // 2. try list files in that directory
        try {
            $objects = $this->bucket->objects([
                'prefix' => $this->file,
            ]);

            if (!$objects->current()) {
                // can't list objects or doesn't exist
                return false;
            }
        } catch (ServiceException $e) {
            return false;
        }

        // equivalent to 40777 and 40444 in octal
        $mode = $this->bucket->isWritable()
            ? self::DIRECTORY_WRITABLE_MODE
            : self::DIRECTORY_READABLE_MODE;
        return $this->makeStatArray([
            'mode'    => $mode
        ]);
    }
private function urlStatDirectory ( ) { $ stats = [ ] ; // 1. try to look up the directory as a file try { $ this -> object = $ this -> bucket -> object ( $ this -> file ) ; $ info = $ this -> object -> info ( ) ; // equivalent to 40777 and 40444 in octal $ stats [ 'mode' ] = $ this -> bucket -> isWritable ( ) ? self :: DIRECTORY_WRITABLE_MODE : self :: DIRECTORY_READABLE_MODE ; $ this -> statsFromFileInfo ( $ info , $ stats ) ; return $ this -> makeStatArray ( $ stats ) ; } catch ( NotFoundException $ e ) { } catch ( ServiceException $ e ) { return false ; } // 2. try list files in that directory try { $ objects = $ this -> bucket -> objects ( [ 'prefix' => $ this -> file , ] ) ; if ( ! $ objects -> current ( ) ) { // can't list objects or doesn't exist return false ; } } catch ( ServiceException $ e ) { return false ; } // equivalent to 40777 and 40444 in octal $ mode = $ this -> bucket -> isWritable ( ) ? self :: DIRECTORY_WRITABLE_MODE : self :: DIRECTORY_READABLE_MODE ; return $ this -> makeStatArray ( [ 'mode' => $ mode ] ) ; }
Calculate the `url_stat` response for a directory

@return array|bool
Calculate the url_stat response for a directory