org\bovigo\vfs\vfsStreamWrapper::stream_truncate PHP Метод

stream_truncate() публичный Метод

truncates a file to a given length
С версии: 1.1.0
public stream_truncate ( integer $size ) : boolean
$size integer length to truncate file to
Результат boolean
    public function stream_truncate($size)
    {
        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);
    }