103 if ( $priority < self::MIN_PRIORITY || $priority > self::MAX_PRIORITY ) {
104 throw new \InvalidArgumentException(
'Invalid priority' );
107 if ( isset( $data[
'copyFrom'] ) ) {
108 $from = $data[
'copyFrom'];
110 throw new \InvalidArgumentException(
'Invalid copyFrom' );
113 'provider' => $from->provider,
115 'userInfo' => $from->userInfo,
116 'persisted' => $from->persisted,
117 'remembered' => $from->remembered,
118 'forceHTTPS' => $from->forceHTTPS,
119 'metadata' => $from->providerMetadata,
120 'idIsSafe' => $from->idIsSafe,
121 'forceUse' => $from->forceUse,
130 'persisted' =>
false,
131 'remembered' =>
true,
132 'forceHTTPS' =>
false,
142 throw new \InvalidArgumentException(
'Invalid session ID' );
145 if ( $data[
'userInfo'] !==
null && !$data[
'userInfo'] instanceof
UserInfo ) {
146 throw new \InvalidArgumentException(
'Invalid userInfo' );
149 if ( !$data[
'provider'] && $data[
'id'] ===
null ) {
150 throw new \InvalidArgumentException(
151 'Must supply an ID when no provider is given'
155 if ( $data[
'metadata'] !==
null && !is_array( $data[
'metadata'] ) ) {
156 throw new \InvalidArgumentException(
'Invalid metadata' );
159 $this->provider = $data[
'provider'];
160 if ( $data[
'id'] !==
null ) {
161 $this->
id = $data[
'id'];
162 $this->idIsSafe = $data[
'idIsSafe'];
165 $this->
id = $this->provider->
getManager()->generateSessionId();
166 $this->idIsSafe =
true;
170 $this->userInfo = $data[
'userInfo'];
171 $this->persisted = (bool)$data[
'persisted'];
172 if ( $data[
'provider'] !==
null ) {
173 if ( $this->userInfo !==
null && !$this->userInfo->isAnon() && $this->userInfo->isVerified() ) {
174 $this->remembered = (bool)$data[
'remembered'];
176 $this->providerMetadata = $data[
'metadata'];
178 $this->
forceHTTPS = (bool)$data[
'forceHTTPS'];