Ejemplo n.º 1
0
 /**
  * 初始化信息
  * @param array $data
  */
 public function __construct(array $data = [])
 {
     parent::__construct($data);
     foreach (static::$config as $name => $realName) {
         $this->set($name, isset($_SERVER[$realName]) ? trim($_SERVER[$realName]) : null);
     }
     $this->init();
 }
Ejemplo n.º 2
0
 /**
  * __construct
  * @param mixed $data
  * @param string $format
  * @param string $name
  */
 public function __construct($data = [], $format = 'php', $name = 'box1')
 {
     // Optionally load supplied data.
     if (is_array($data) || is_object($data)) {
         $this->bindData($this->data, $data);
     } elseif ($data && is_string($data)) {
         $this->load($data, $format);
     }
     parent::__construct();
     $this->name = $name;
 }
Ejemplo n.º 3
0
 /**
  * don't allow set attribute
  * @param array $options
  * @throws InvalidConfigException
  */
 public function __construct($options = [])
 {
     parent::__construct();
     ObjectHelper::loadAttrs($this, $options);
     if ($this->identityClass === null) {
         throw new InvalidConfigException('User::identityClass must be set.');
     }
     // if have already login
     if (session(self::$saveKey)) {
         $this->refreshIdentity();
     }
 }