public function __construct($phone)
 {
     if (!ctype_digit($phone)) {
         throw new \InvalidArgumentException('Телефон может состоять только из цифр');
     }
     $this->phone = $phone;
     $this->db = DBConnection::getInstance();
 }
Example #2
0
 /**
  * Setup valid database connection.
  */
 protected function setupDatabaseConnection()
 {
     $db = DBConnection::getInstance($this->config);
     $enc = property_exists($this->config, 'dbEncoding') ? $this->config->dbEncoding : 'utf8';
     $tz = property_exists($this->config, 'dbTimezone') ? $this->config->dbTimezone : '00:00';
     $db->query(sprintf('SET NAMES "%s"', $enc));
     $db->query(sprintf('SET time_zone = "%s"', $tz));
 }
 public function __construct(\stdClass $game)
 {
     $this->game = $game;
     $this->db = DBConnection::getInstance();
     $this->quiz = new Quiz($game->quest);
 }