コード例 #1
0
ファイル: Abstract.php プロジェクト: tapiau/muyo
 public function init()
 {
     // Parent
     $fullClassName = get_class($this);
     $fullClassName = explode("\\", $fullClassName);
     $this->_table = strtolower($fullClassName[count($fullClassName) - 1]);
     parent::init();
     //
     $this->app = \IFR\Main\App::get();
     // PDO
     $config = getConfig(CONF_PATH . '/application.xml', getCurrentEnv());
     $config = $config->db->toArray();
     $this->_db = $this->app->getMysqlDb($config);
     // Build table
     $this->_db->exec("DROP TABLE IF EXISTS {$this->_table};");
     $filePath = sprintf('./resources/sql/%s.sql', $this->_table);
     assertTrue(file_exists($filePath), "SQL file '{$filePath}' does not exist");
     $this->_db->exec(file_get_contents($filePath));
     // Build settings
     $columns = array_merge(self::$DEFAULT_COLUMNS, $this->getColumnsDefinition());
     foreach ($columns as $name => $column) {
         $this->setColumns($name)->schemaColumnSet($name, $column);
     }
 }
コード例 #2
0
ファイル: debug.php プロジェクト: tapiau/muyo
 /**
  * @param callable|null $handler that takes ($script, $line, $message) and returns bool accordingly if it handled or not
  * @return callable|null
  */
 function debug_handler_assertion($handler = null)
 {
     $env = getCurrentEnv();
     if (null == $handler) {
         $handler = debug_handler_assertion_default_dg();
     }
     assert_options(ASSERT_ACTIVE, true);
     assert_options(ASSERT_WARNING, false);
     assert_options(ASSERT_BAIL, false);
     assert_options(ASSERT_QUIET_EVAL, $env === 'production');
     return assert_options(ASSERT_CALLBACK, $handler);
 }
コード例 #3
0
ファイル: App.php プロジェクト: tapiau/muyo
 public static function isProd()
 {
     return ENV_PRODUCTION == getCurrentEnv();
 }