Пример #1
0
 /**
  * Возвращает объект шаблонизатора
  *
  * @return bool|object
  */
 protected function getTplType()
 {
     if (!isset($this->TplConfig['abc_template']) || true === $this->TplConfig['abc_template']) {
         $tplName = 'Template';
     } elseif (false === $this->TplConfig['abc_template']) {
         $tplName = 'TplNative';
     } else {
         AbcError::badFunctionCall(ABC_INVALID_DEBUG_SETTING);
     }
     return $tplName;
 }
Пример #2
0
 /**
  * Строит сервис.
  * 
  * @param bool $global
  *
  * @return void
  */
 protected function buildService($global = false)
 {
     $abc = $this->abc;
     $component = '\\ABC\\Abc\\Components\\' . $this->serviceId . '\\' . $this->serviceId;
     $typeService = $global ? 'setAsShared' : 'set';
     $this->container->{$typeService}($this->serviceId, function () use($component, $abc) {
         if (class_exists($component)) {
             return new $component($abc);
         } else {
             AbcError::badFunctionCall('<strong>' . $this->serviceId . '</strong>' . ABC_NOT_FOUND_SERVICE);
         }
     });
 }
Пример #3
0
 /**
  * Обертка для query()
  *
  * @param string $sql
  *
  * @return void
  */
 public function query($sql)
 {
     try {
         $result = parent::query($sql);
     } catch (\PDOException $e) {
         $this->error = $e->getMessage();
         $result = false;
     }
     if (!empty($this->debugger)) {
         $this->debugger->trace = debug_backtrace();
         $this->debugger->db = $this;
         $this->debugger->component = 'PDO';
         $this->debugger->run($sql, $result);
     } elseif (empty($this->debugger) && $this->test) {
         AbcError::badFunctionCall('Component PDO: ' . ABC_NO_SQL_DEBUGGER);
     }
     if (!$result) {
         throw $e;
     }
     return $result;
 }
 /**
  * Возвращает массив маршрутов 
  *
  * @return array
  */
 public function getRouteRule()
 {
     if (!isset($this->config['route_rules'])) {
         return [];
     }
     if (is_array($this->config['route_rules'])) {
         return $this->config['route_rules'];
     }
     if (is_file($this->config['route_rules'])) {
         return $this->parseConfigRoutes($this->config['route_rules']);
     }
     AbcError::badFunctionCall(ABC_UNKNOWN_ROUTES);
 }