path = $path; } function dirExists($mode = 0777, $recursive = true ){ if(!is_dir($this->path)){ mkdir($this->path, $mode, $recursive); } return $this; } function realPath(){ return new FileSystem(realpath($this->path)); } function file($name){ $newpath = $this->path . "/". $name; return new FileObject(basename($newpath), new FileSystem(dirname($newpath))); } function getPath(){ return $this->path; } } use WriteiniFile\WriteiniFile; class FileObject{ protected $fileName; protected $context; function __construct($fileName, FileSystem $fs = null){ $this->fileName = $fileName; if(!$fs){ $fs = new FileSystem(getcwd()); } $this->context = $fs; } function getPath(){ return $this->context->dirExists()->realpath()->getPath() . "/".$this->fileName; } function content($content){ $full_path = $this->getPath(); file_put_contents($full_path, $content); return $this; } function writeIniConfig($config){ $f = new WriteiniFile($this->getPath()); $f->create($config); $f->write(); return $this; } }