public function options() { if (null === $this->options) { $this->options = new \stdClass(); $this->setUpOptions($this->options); /** * @var string $name * @var Option $option */ foreach ((array) $this->options as $name => $option) { if ($option->isArgument) { $this->arguments[] = $option; continue; } if ($option->shortName) { $this->optionsByShortName[$option->shortName] = $option; } if (empty($option->name)) { $option->name = Utils::fromCamelCase($name, '-'); } $this->optionsByName[$option->name] = $option; } } return $this->options; }
public function __construct(Request $request) { $this->request = $request; $this->unnamedMapper = function ($name) { return Utils::fromCamelCase($name, '-'); }; $this->namedMapper = function ($name) { return Utils::fromCamelCase($name, '_'); }; }
public function __set($name, $column) { if (is_int($column)) { $column = new Column($column); //$this->_arrayOfColumnData[$name] = $column; } // another column reference if (!empty($column->table) && $column->table->schemaName != $this->table->schemaName) { $refColumn = $column; $column = clone $column; $column->propertyName = $name; $column->schemaName = Utils::fromCamelCase($name); $column->table = $this->table; //$this->_arrayOfColumnData[$name] = $column; $foreignKey = new ForeignKey(array($column), array($refColumn)); $column->foreignKey = $foreignKey; //$this->table->addForeignKey($foreignKey); $column->setFlag(Column::AUTO_ID, false); } else { $column->propertyName = $name; $column->schemaName = Utils::fromCamelCase($name); $column->table = $this->table; } if ($column->flags & Column::AUTO_ID) { $this->table->autoIdColumn = $column; if (!$this->table->primaryKey) { $this->table->setPrimaryKey($column); } } if ($column->isUnique) { $index = new Index($column); $index->setType(Index::TYPE_UNIQUE); $this->table->addIndex($index); } elseif ($column->isIndexed) { $index = new Index($column); $index->setType(Index::TYPE_KEY); $this->table->addIndex($index); } $this->table->database()->getUtility()->checkColumn($column); $this->_arrayOfColumnData[$name] = $column; }
public function route($path) { if (!Utils::starts($path, $this->pathPrefix)) { return false; } $path = trim(substr($path, strlen($this->pathPrefix)), '/'); switch (true) { case '' === $path: $this->auth(); return true; case 'con' === $path: $this->queryAction(); return true; case 'con/result' === $path: $this->resultAction(); return true; case isset($_GET['logout']): $this->logoutAction(); return true; } return false; }
/** * Method should return table definition of entity * @return Table */ public static function table($alias = null) { $className = get_called_class(); $tableKey = $className . ($alias ? ':' . $alias : ''); $table =& self::$tables[$tableKey]; if (null !== $table) { return $table; } /* if (isset(self::$settingColumns[$tableKey])) { throw new Exception('Already setting columns'); } $columns = new \stdClass(); self::$settingColumns[$tableKey] = $columns; unset(self::$settingColumns[$tableKey]); */ $schemaName = Utils::fromCamelCase(str_replace('\\', '', $className)); $table = new Table(null, self::getDatabase($className), $schemaName); $table->entityClassName = $className; $table->alias = $alias; static::setUpColumns($table->columns); static::setUpTable($table, $table->columns); return $table; }
public static function getPublicName($name) { return Utils::fromCamelCase($name, '_'); }
/** * @return object * @throws Service\Exception */ public function getDriver() { if (null === $this->driver) { if ($this->settings && $this->settings->driverClassName) { $driverClass = $this->settings->driverClassName; } else { $scheme = $this->settings->scheme; $scheme = explode('.', $scheme, 2); if (2 === count($scheme)) { $driverClass = '\\' . Utils::toCamelCase($scheme[0], '-') . '\\' . get_called_class() . '\\Driver\\' . Utils::toCamelCase($scheme[1], '-'); } else { $driverClass = get_called_class() . '\\Driver\\' . Utils::toCamelCase($scheme[0], '-'); } } if (!class_exists($driverClass)) { throw new Service\Exception($driverClass . ' (' . $this->settings->scheme . ') not found', Service\Exception::NO_DRIVER); } $this->driver = new $driverClass($this->settings); } /* if ($this->driver instanceof Migration_Required) { Migration_Manager::getInstance()->perform($this->driver->getMigration()); } */ return $this->driver; }
public function getPublicName() { return Utils::fromCamelCase($this->name, '_'); }
public function contain($needle, $ignoreCase = false) { return Utils::strPos($this->string, $needle, 0, false, $ignoreCase) !== false; }
break; case 'startSession': $result = Api::startSession($json); break; } $result = array('result' => $result); header('Content-Type: application/json'); echo json_encode($result); exit; } else { switch (true) { case '/' === $path || Utils::starts($path, '/?'): Ui::index(); break; case Utils::starts($path, '/suite'): Ui::suite(); break; case Utils::starts($path, '/session'): Ui::session(); break; /** @noinspection PhpMissingBreakStatementInspection */ /** @noinspection PhpMissingBreakStatementInspection */ case Utils::starts($path, '/dev'): if (Dev::create('/dev')->setAuth(Auth::getInstance('dev'))->route($path)) { break; } default: Ui::notFound(); break; } }