Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F8104237
SearchResultTrait.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SearchResultTrait.php
View Options
<?php
/**
* Trait for SearchResult subclasses to share non-obvious behaviors or methods
* that rarely specialized
*/
trait
SearchResultTrait
{
/**
* A function returning a set of extension data.
* @var Closure|null
*/
protected
$extensionData
;
/**
* Get the extension data as:
* augmentor name => data
* @return array[]
*/
public
function
getExtensionData
()
{
if
(
$this
->
extensionData
)
{
return
call_user_func
(
$this
->
extensionData
);
}
else
{
return
[];
}
}
/**
* Set extension data for this result.
* The data is:
* augmentor name => data
* @param Closure|array $extensionData Takes no arguments, returns
* either array of extension data or null.
*/
public
function
setExtensionData
(
$extensionData
)
{
if
(
$extensionData
instanceof
Closure
)
{
$this
->
extensionData
=
$extensionData
;
}
elseif
(
is_array
(
$extensionData
)
)
{
wfDeprecated
(
__METHOD__
.
' with array argument'
,
'1.32'
);
$this
->
extensionData
=
static
function
()
use
(
$extensionData
)
{
return
$extensionData
;
};
}
else
{
$type
=
get_debug_type
(
$extensionData
);
throw
new
InvalidArgumentException
(
__METHOD__
.
" must be called with Closure|array, but received $type"
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Dec 8, 02:30 (1 d, 21 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c4/4b/ed65b835a4f3b2a60405858c2b49
Default Alt Text
SearchResultTrait.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment