Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5987650
FakeResultWrapper.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
FakeResultWrapper.php
View Options
<?php
namespace
Wikimedia\Rdbms
;
use
RuntimeException
;
use
stdClass
;
/**
* Overloads the relevant methods of the real ResultWrapper so it
* doesn't go anywhere near an actual database.
*/
class
FakeResultWrapper
extends
ResultWrapper
{
/** @var stdClass[]|array[]|null */
protected
$result
;
/**
* @param stdClass[]|array[]|FakeResultWrapper $result
*/
public
function
__construct
(
$result
)
{
if
(
$result
instanceof
self
)
{
$this
->
result
=
$result
->
result
;
}
else
{
$this
->
result
=
$result
;
}
}
protected
function
doNumRows
()
{
return
count
(
$this
->
result
);
}
protected
function
doFetchObject
()
{
$value
=
$this
->
result
[
$this
->
currentPos
]
??
false
;
return
is_array
(
$value
)
?
(
object
)
$value
:
$value
;
}
protected
function
doFetchRow
()
{
$row
=
$this
->
doFetchObject
();
return
is_object
(
$row
)
?
get_object_vars
(
$row
)
:
$row
;
}
protected
function
doSeek
(
$pos
)
{
}
protected
function
doFree
()
{
$this
->
result
=
null
;
}
protected
function
doGetFieldNames
()
{
// @phan-suppress-previous-line PhanPluginNeverReturnMethod
throw
new
RuntimeException
(
__METHOD__
.
' is unimplemented'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Oct 4, 00:31 (2 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
42/29/3aa9158869dec4061c57d69e4e2a
Default Alt Text
FakeResultWrapper.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment