org\bovigo\vfs\content\StringBasedFileContent::truncate PHP 메소드

truncate() 공개 메소드

Truncates a file to a given length
public truncate ( integer $size ) : boolean
$size integer length to truncate file to
리턴 boolean
    public function truncate($size)
    {
        if ($size > $this->size()) {
            // Pad with null-chars if we're "truncating up"
            $this->content .= str_repeat("", $size - $this->size());
        } else {
            $this->content = substr($this->content, 0, $size);
        }
        return true;
    }