Ejemplo n.º 1
0
 /**
  * @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;
 }
Ejemplo n.º 2
0
 /**
  * @return	boolean
  */
 protected function save()
 {
     $contents = ['meta' => $this->meta, 'records' => $this->records];
     return $this->source->putContents(json_encode($contents, JSON_PRETTY_PRINT));
 }
Ejemplo n.º 3
0
 /**
  * @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);
 }