89 if ( $priority < self::MIN_PRIORITY || $priority > self::MAX_PRIORITY ) {
90 throw new \InvalidArgumentException(
'Invalid priority' );
93 if ( isset( $data[
'copyFrom'] ) ) {
94 $from = $data[
'copyFrom'];
96 throw new \InvalidArgumentException(
'Invalid copyFrom' );
99 'provider' => $from->provider,
101 'userInfo' => $from->userInfo,
102 'persisted' => $from->persisted,
103 'remembered' => $from->remembered,
104 'forceHTTPS' => $from->forceHTTPS,
105 'metadata' => $from->providerMetadata,
106 'idIsSafe' => $from->idIsSafe,
107 'forceUse' => $from->forceUse,
116 'persisted' =>
false,
117 'remembered' =>
true,
118 'forceHTTPS' =>
false,
128 throw new \InvalidArgumentException(
'Invalid session ID' );
131 if ( $data[
'userInfo'] !==
null && !$data[
'userInfo'] instanceof
UserInfo ) {
132 throw new \InvalidArgumentException(
'Invalid userInfo' );
135 if ( !$data[
'provider'] && $data[
'id'] ===
null ) {
136 throw new \InvalidArgumentException(
137 'Must supply an ID when no provider is given'
141 if ( $data[
'metadata'] !==
null && !is_array( $data[
'metadata'] ) ) {
142 throw new \InvalidArgumentException(
'Invalid metadata' );
145 $this->provider = $data[
'provider'];
146 if ( $data[
'id'] !==
null ) {
147 $this->
id = $data[
'id'];
148 $this->idIsSafe = $data[
'idIsSafe'];
151 $this->
id = $this->provider->
getManager()->generateSessionId();
152 $this->idIsSafe =
true;
156 $this->userInfo = $data[
'userInfo'];
157 $this->persisted = (bool)$data[
'persisted'];
158 if ( $data[
'provider'] !==
null ) {
159 if ( $this->userInfo !==
null && !$this->userInfo->isAnon() && $this->userInfo->isVerified() ) {
160 $this->remembered = (bool)$data[
'remembered'];
162 $this->providerMetadata = $data[
'metadata'];
164 $this->
forceHTTPS = (bool)$data[
'forceHTTPS'];