MediaWiki
1.34.0
ConfirmLinkAuthenticationRequest.php
Go to the documentation of this file.
1
<?php
22
namespace
MediaWiki\Auth
;
23
24
class
ConfirmLinkAuthenticationRequest
extends
AuthenticationRequest
{
26
protected
$linkRequests
;
27
29
public
$confirmedLinkIDs
= [];
30
35
public
function
__construct
( array
$linkRequests
) {
36
if
( !
$linkRequests
) {
37
throw
new \InvalidArgumentException(
'$linkRequests must not be empty'
);
38
}
39
$this->linkRequests =
$linkRequests
;
40
}
41
42
public
function
getFieldInfo
() {
43
$options = [];
44
foreach
( $this->linkRequests as $req ) {
45
$description = $req->describeCredentials();
46
$options[$req->getUniqueId()] =
wfMessage
(
47
'authprovider-confirmlink-option'
,
48
$description[
'provider'
]->text(), $description[
'account'
]->text()
49
);
50
}
51
return
[
52
'confirmedLinkIDs'
=> [
53
'type'
=>
'multiselect'
,
54
'options'
=> $options,
55
'label'
=>
wfMessage
(
'authprovider-confirmlink-request-label'
),
56
'help'
=>
wfMessage
(
'authprovider-confirmlink-request-help'
),
57
'optional'
=>
true
,
58
]
59
];
60
}
61
62
public
function
getUniqueId
() {
63
return
parent::getUniqueId() .
':'
. implode(
'|'
, array_map(
function
( $req ) {
64
return
$req->getUniqueId();
65
},
$this->linkRequests
) );
66
}
67
73
public
static
function
__set_state
( $data ) {
74
$ret =
new
static
( $data[
'linkRequests'
] );
75
foreach
( $data as $k => $v ) {
76
$ret->$k = $v;
77
}
78
return
$ret;
79
}
80
}
MediaWiki\Auth\ConfirmLinkAuthenticationRequest\__construct
__construct(array $linkRequests)
Definition:
ConfirmLinkAuthenticationRequest.php:35
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition:
GlobalFunctions.php:1264
MediaWiki\Auth\ConfirmLinkAuthenticationRequest\getFieldInfo
getFieldInfo()
Fetch input field info.
Definition:
ConfirmLinkAuthenticationRequest.php:42
MediaWiki\Auth\ConfirmLinkAuthenticationRequest\__set_state
static __set_state( $data)
Implementing this mainly for use from the unit tests.
Definition:
ConfirmLinkAuthenticationRequest.php:73
MediaWiki\Auth\ConfirmLinkAuthenticationRequest\$linkRequests
AuthenticationRequest[] $linkRequests
Definition:
ConfirmLinkAuthenticationRequest.php:26
MediaWiki\Auth\ConfirmLinkAuthenticationRequest\$confirmedLinkIDs
string[] $confirmedLinkIDs
List of unique IDs of the confirmed accounts.
Definition:
ConfirmLinkAuthenticationRequest.php:29
MediaWiki\Auth\ConfirmLinkAuthenticationRequest\getUniqueId
getUniqueId()
Supply a unique key for deduplication.
Definition:
ConfirmLinkAuthenticationRequest.php:62
MediaWiki\Auth
Definition:
AbstractAuthenticationProvider.php:22
MediaWiki\Auth\ConfirmLinkAuthenticationRequest
Definition:
ConfirmLinkAuthenticationRequest.php:24
MediaWiki\Auth\AuthenticationRequest
This is a value object for authentication requests.
Definition:
AuthenticationRequest.php:37
includes
auth
ConfirmLinkAuthenticationRequest.php
Generated on Thu Dec 19 2019 14:54:07 for MediaWiki by
1.8.16