コード例 #1
0
ファイル: Driver.php プロジェクト: znframework/znframework
 public function __construct(string $driver = NULL)
 {
     parent::__construct();
     if (!defined('static::driver')) {
         throw new UndefinedConstException('[const driver] is required to use the [Driver Ability]!');
     }
     nullCoalesce($driver, $this->config['driver'] ?? NULL);
     $this->selectedDriverName = $driver;
     Support::driver(static::driver['options'], $driver);
     if (!isset(static::driver['namespace'])) {
         $this->driver = uselib($driver);
     } else {
         $this->driver = uselib(suffix(static::driver['namespace'], '\\') . $driver . 'Driver');
     }
     if (isset(static::driver['construct'])) {
         $construct = static::driver['construct'];
         $this->{$construct}();
     }
 }
コード例 #2
0
 public function limit($start = NULL, int $limit = 0) : InternalDB
 {
     nullCoalesce($start, (int) URI::segment(-1));
     if (!empty($limit)) {
         $comma = ' , ';
     } else {
         $comma = '';
     }
     $this->pagination['start'] = (int) $start;
     $this->pagination['limit'] = $limit;
     $this->limit = ' LIMIT ' . $start . (!empty($limit) ? $comma . $limit . ' ' : '');
     return $this;
 }
コード例 #3
0
 public function mailTo(string $mail, string $value = NULL, array $attributes = []) : string
 {
     if (!isEmail($mail)) {
         throw new InvalidArgumentException('Error', 'emailParameter', '1.($mail)');
     }
     $attributes['href'] = 'mailto:' . $mail;
     nullCoalesce($value, $mail);
     return $this->_multiElement('a', $value, $attributes);
 }
コード例 #4
0
 public function drop(string $name = NULL) : bool
 {
     nullCoalesce($name, 'USER()');
     $query = $this->user->drop($name);
     return $this->_runQuery($query);
 }