/** * @param Huxtable\Core\File\File $fileCookies * @return void */ public function __construct(File\File $fileCookies) { if ($fileCookies->exists()) { $this->contents = parse_ini_file($fileCookies, true); } $this->fileCookies = $fileCookies; }
/** * @param Huxtable\Core\File\File $source * @return void */ public function __construct(File\File $source) { if ($source->exists()) { $json = $source->getContents(); $this->data = json_decode($json, true); } $this->source = $source; }
/** * Given an existing file or directory path, return a properly typed instance * * @param string $pathname * @return mixed */ public static final function getTypedInstance($pathname) { $file = new File($pathname); if (!$file->exists()) { return $file; } if (!$file->isDir()) { return $file; } $directory = new Directory($pathname); return $directory; }