/**
  * Initialize
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     ini_set('display_errors', Base::ENV_DEV == Base::getEnv() || Base::ENV_TEST == Base::getEnv() ? 'on' : 'off');
     if (Base::getEnv() == Base::ENV_DEV) {
         error_reporting(E_ALL);
     } else {
         if (Base::getEnv() == Base::ENV_TEST) {
             error_reporting(E_ALL ^ E_NOTICE);
         }
     }
     if (ConfigHandler::has('timezone')) {
         date_default_timezone_set(ConfigHandler::get('timezone'));
     } else {
         date_default_timezone_set(@date_default_timezone_get());
     }
 }
 /**
  *
  */
 protected function _init()
 {
     define('TASK_DIR', APP_PATH . '/');
     ini_set('display_errors', ConfigHandler::get('debug') ? 'on' : 'off');
     //Error reporting
     if (Base::getEnv() == Base::ENV_DEV) {
         error_reporting(E_ALL);
     } else {
         if (Base::getEnv() == Base::ENV_TEST) {
             error_reporting(E_ALL ^ E_NOTICE);
         }
     }
     //set timezone
     if (ConfigHandler::has('timezone')) {
         date_default_timezone_set(ConfigHandler::get('timezone'));
     } else {
         date_default_timezone_set(@date_default_timezone_get());
     }
     if (true === $this->isCli()) {
         $argv = $_SERVER['argv'];
         $seek = 1;
         if (null == $this->_task) {
             $this->_task = $argv[$seek];
             ++$seek;
         }
         if (null == $this->_act && isset($argv[$seek])) {
             $this->_act = $argv[$seek];
             ++$seek;
         } else {
             $this->_act = 'default';
         }
         if (isset($argv[$seek])) {
             $this->_originalParams = array_slice($argv, $seek);
             $this->_params = $this->_process($this->_originalParams);
         }
     } else {
         //run on browser (only for test)
         if (null !== ($task = Factory::getRequest()->get('task'))) {
             $this->_task = $task;
         }
         if (null !== ($act = Factory::getRequest()->get('act'))) {
             $this->_act = $act;
         }
     }
 }
 protected function _init()
 {
     ini_set('display_errors', Base::ENV_DEV == Base::getEnv() || Base::ENV_TEST == Base::getEnv() ? 'on' : 'off');
     //Error reporting
     if (Base::getEnv() == Base::ENV_DEV) {
         error_reporting(E_ALL);
     } else {
         if (Base::getEnv() == Base::ENV_TEST) {
             error_reporting(E_ALL ^ E_NOTICE);
         }
     }
     //set timezone
     if (ConfigHandler::has('timezone')) {
         date_default_timezone_set(ConfigHandler::get('timezone'));
     } else {
         date_default_timezone_set(@date_default_timezone_get());
     }
     $this->_requestMethod = strtoupper($_SERVER['REQUEST_METHOD']);
     if (!in_array($this->_requestMethod, self::$RESTfulREQUEST)) {
         throw new ApiException('Application: Request method unsupported!', null, 400);
     }
 }