/** * @param string $table * @param \Closure $closure * @return bool */ public function table($table, \Closure $closure) { Validator::type('string')->assert($table); Validator::regex('/^[A-Za-z_]+$/')->assert($table); /** @var Schema $schema */ $schema = new $this->schemaClassName(); $closure($schema); $writer = new SchemaWriter($table, $schema); return $writer->write($this->overwrite); }
/** * @param Integer $increment * @return WorkerCfg */ public function setIncrement($increment) { Validator::type('int')->between(1, 65535, true)->check($increment); $this->increment = $increment; return $this; }
private function assertName($name) { Validator::notEmpty()->assert($name); Validator::type('string')->assert($name); Validator::regex('/^[A-Za-z_]+$/')->assert($name); }