97 if ( $priority < self::MIN_PRIORITY || $priority > self::MAX_PRIORITY ) {
98 throw new \InvalidArgumentException(
'Invalid priority' );
101 if ( isset( $data[
'copyFrom'] ) ) {
102 $from = $data[
'copyFrom'];
104 throw new \InvalidArgumentException(
'Invalid copyFrom' );
107 'provider' => $from->provider,
109 'userInfo' => $from->userInfo,
110 'persisted' => $from->persisted,
111 'remembered' => $from->remembered,
112 'forceHTTPS' => $from->forceHTTPS,
113 'metadata' => $from->providerMetadata,
114 'idIsSafe' => $from->idIsSafe,
115 'forceUse' => $from->forceUse,
124 'persisted' =>
false,
125 'remembered' =>
true,
126 'forceHTTPS' =>
false,
136 throw new \InvalidArgumentException(
'Invalid session ID' );
139 if ( $data[
'userInfo'] !==
null && !$data[
'userInfo'] instanceof
UserInfo ) {
140 throw new \InvalidArgumentException(
'Invalid userInfo' );
143 if ( !$data[
'provider'] && $data[
'id'] ===
null ) {
144 throw new \InvalidArgumentException(
145 'Must supply an ID when no provider is given'
149 if ( $data[
'metadata'] !==
null && !is_array( $data[
'metadata'] ) ) {
150 throw new \InvalidArgumentException(
'Invalid metadata' );
153 $this->provider = $data[
'provider'];
154 if ( $data[
'id'] !==
null ) {
155 $this->
id = $data[
'id'];
156 $this->idIsSafe = $data[
'idIsSafe'];
160 $this->
id = $this->provider->
getManager()->generateSessionId();
161 $this->idIsSafe =
true;
165 $this->userInfo = $data[
'userInfo'];
166 $this->persisted = (bool)$data[
'persisted'];
167 if ( $data[
'provider'] !==
null ) {
168 if ( $this->userInfo !==
null && !$this->userInfo->isAnon() && $this->userInfo->isVerified() ) {
169 $this->remembered = (bool)$data[
'remembered'];
171 $this->providerMetadata = $data[
'metadata'];
173 $this->
forceHTTPS = (bool)$data[
'forceHTTPS'];
285 ( $this->userInfo ?:
'<null>' ) . $this->
getId();
295 return $a->getPriority() <=> $b->getPriority();