/** * @param Huxtable\Core\FileInfo $file * @return self For chaining */ public function returnFileContents(FileInfo $sourceFile) { $this->sourceFile = $sourceFile; $closure = function () { return $this->sourceFile->getContents(); }; $this->closure = $closure->bindTo($this); return $this; }
/** * @return boolean */ protected function save() { $contents = ['meta' => $this->meta, 'records' => $this->records]; return $this->source->putContents(json_encode($contents, JSON_PRETTY_PRINT)); }
/** * @param string $name Table name (ex., 'users') * @return Huxtable\Core\Database\Table */ public function table($name) { $tableFile = $this->source->child("{$name}.json"); return new Database\Table($tableFile); }