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; }