98 if ( $priority < self::MIN_PRIORITY || $priority > self::MAX_PRIORITY ) {
99 throw new \InvalidArgumentException(
'Invalid priority' );
102 if ( isset( $data[
'copyFrom'] ) ) {
103 $from = $data[
'copyFrom'];
105 throw new \InvalidArgumentException(
'Invalid copyFrom' );
108 'provider' => $from->provider,
110 'userInfo' => $from->userInfo,
111 'persisted' => $from->persisted,
112 'remembered' => $from->remembered,
113 'forceHTTPS' => $from->forceHTTPS,
114 'metadata' => $from->providerMetadata,
115 'idIsSafe' => $from->idIsSafe,
116 'forceUse' => $from->forceUse,
125 'persisted' =>
false,
126 'remembered' =>
true,
127 'forceHTTPS' =>
false,
137 throw new \InvalidArgumentException(
'Invalid session ID' );
140 if ( $data[
'userInfo'] !==
null && !$data[
'userInfo'] instanceof
UserInfo ) {
141 throw new \InvalidArgumentException(
'Invalid userInfo' );
144 if ( !$data[
'provider'] && $data[
'id'] ===
null ) {
145 throw new \InvalidArgumentException(
146 'Must supply an ID when no provider is given'
150 if ( $data[
'metadata'] !==
null && !is_array( $data[
'metadata'] ) ) {
151 throw new \InvalidArgumentException(
'Invalid metadata' );
154 $this->provider = $data[
'provider'];
155 if ( $data[
'id'] !==
null ) {
156 $this->
id = $data[
'id'];
157 $this->idIsSafe = $data[
'idIsSafe'];
161 $this->
id = $this->provider->
getManager()->generateSessionId();
162 $this->idIsSafe =
true;
166 $this->userInfo = $data[
'userInfo'];
167 $this->persisted = (bool)$data[
'persisted'];
168 if ( $data[
'provider'] !==
null ) {
169 if ( $this->userInfo !==
null && !$this->userInfo->isAnon() && $this->userInfo->isVerified() ) {
170 $this->remembered = (bool)$data[
'remembered'];
172 $this->providerMetadata = $data[
'metadata'];
174 $this->
forceHTTPS = (bool)$data[
'forceHTTPS'];