示例#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();
 }
示例#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;
 }
示例#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();
     }
 }