public function stream_truncate(int $size): bool
    {
        if (self::READONLY === $this->mode) {
            return false;
        }

        if ($this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) {
            return false;
        }

        if ($this->content->getType() !== vfsStreamContent::TYPE_FILE) {
            return false;
        }

        if (self::$quota->isLimited() && $this->content->size() < $size) {
            $maxSize = self::$quota->spaceLeft(self::$root->sizeSummarized());
            if (0 === $maxSize) {
                return false;
            }

            if ($size > $maxSize) {
                $size = $maxSize;
            }
        }

        return $this->content->truncate($size);
    }
public function stream_truncate(int $size): bool
    {
        if (self::READONLY === $this->mode) {
            return false;
        }

        if ($this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) {
            return false;
        }

        if ($this->content->getType() !== vfsStreamContent::TYPE_FILE) {
            return false;
        }

        if (self::$quota->isLimited() && $this->content->size() < $size) {
            $maxSize = self::$quota->spaceLeft(self::$root->sizeSummarized());
            if (0 === $maxSize) {
                return false;
            }

            if ($size > $maxSize) {
                $size = $maxSize;
            }
        }

        return $this->content->truncate($size);
    }
public function stream_truncate ( int $ size ) : bool { if ( self :: READONLY === $ this -> mode ) { return false ; } if ( $ this -> content -> isWritable ( vfsStream :: getCurrentUser ( ) , vfsStream :: getCurrentGroup ( ) ) === false ) { return false ; } if ( $ this -> content -> getType ( ) !== vfsStreamContent :: TYPE_FILE ) { return false ; } if ( self :: $ quota -> isLimited ( ) && $ this -> content -> size ( ) < $ size ) { $ maxSize = self :: $ quota -> spaceLeft ( self :: $ root -> sizeSummarized ( ) ) ; if ( 0 === $ maxSize ) { return false ; } if ( $ size > $ maxSize ) { $ size = $ maxSize ; } } return $ this -> content -> truncate ( $ size ) ; }
truncates a file to a given length

@param   int  $size  length to truncate file to
@return  bool
@since   1.1.0
truncates a file to a given length