88 if ( $priority < self::MIN_PRIORITY || $priority > self::MAX_PRIORITY ) {
89 throw new \InvalidArgumentException(
'Invalid priority' );
92 if ( isset( $data[
'copyFrom'] ) ) {
93 $from = $data[
'copyFrom'];
95 throw new \InvalidArgumentException(
'Invalid copyFrom' );
98 'provider' => $from->provider,
100 'userInfo' => $from->userInfo,
101 'persisted' => $from->persisted,
102 'remembered' => $from->remembered,
103 'forceHTTPS' => $from->forceHTTPS,
104 'metadata' => $from->providerMetadata,
105 'idIsSafe' => $from->idIsSafe,
106 'forceUse' => $from->forceUse,
115 'persisted' =>
false,
116 'remembered' =>
true,
117 'forceHTTPS' =>
false,
127 throw new \InvalidArgumentException(
'Invalid session ID' );
130 if ( $data[
'userInfo'] !==
null && !$data[
'userInfo'] instanceof
UserInfo ) {
131 throw new \InvalidArgumentException(
'Invalid userInfo' );
134 if ( !$data[
'provider'] && $data[
'id'] ===
null ) {
135 throw new \InvalidArgumentException(
136 'Must supply an ID when no provider is given'
140 if ( $data[
'metadata'] !==
null && !is_array( $data[
'metadata'] ) ) {
141 throw new \InvalidArgumentException(
'Invalid metadata' );
144 $this->provider = $data[
'provider'];
145 if ( $data[
'id'] !==
null ) {
146 $this->
id = $data[
'id'];
147 $this->idIsSafe = $data[
'idIsSafe'];
150 $this->
id = $this->provider->
getManager()->generateSessionId();
151 $this->idIsSafe =
true;
155 $this->userInfo = $data[
'userInfo'];
156 $this->persisted = (bool)$data[
'persisted'];
157 if ( $data[
'provider'] !==
null ) {
158 if ( $this->userInfo !==
null && !$this->userInfo->isAnon() && $this->userInfo->isVerified() ) {
159 $this->remembered = (bool)$data[
'remembered'];
161 $this->providerMetadata = $data[
'metadata'];
163 $this->
forceHTTPS = (bool)$data[
'forceHTTPS'];
275 ( $this->userInfo ?:
'<null>' ) . $this->
getId();
285 return $a->getPriority() - $b->getPriority();