public function saveFileContent($content) { if (!file_exists(dirname($this->path))) { mkdir(dirname($this->path), 0777, true); } elseif (is_dir($this->path)) { throw new InvalidPathException("You can only write content to file"); } return file_put_contents($this->path, $content); }