Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5989491
ArrayResult.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ArrayResult.php
View Options
<?php
namespace
Doctrine\DBAL\Cache
;
use
Doctrine\DBAL\Driver\FetchUtils
;
use
Doctrine\DBAL\Driver\Result
;
use
function
array_values
;
use
function
count
;
use
function
reset
;
/** @internal The class is internal to the caching layer implementation. */
final
class
ArrayResult
implements
Result
{
/** @var list<array<string, mixed>> */
private
array
$data
;
private
int
$columnCount
=
0
;
private
int
$num
=
0
;
/** @param list<array<string, mixed>> $data */
public
function
__construct
(
array
$data
)
{
$this
->
data
=
$data
;
if
(
count
(
$data
)
===
0
)
{
return
;
}
$this
->
columnCount
=
count
(
$data
[
0
]);
}
/**
* {@inheritDoc}
*/
public
function
fetchNumeric
()
{
$row
=
$this
->
fetch
();
if
(
$row
===
false
)
{
return
false
;
}
return
array_values
(
$row
);
}
/**
* {@inheritDoc}
*/
public
function
fetchAssociative
()
{
return
$this
->
fetch
();
}
/**
* {@inheritDoc}
*/
public
function
fetchOne
()
{
$row
=
$this
->
fetch
();
if
(
$row
===
false
)
{
return
false
;
}
return
reset
(
$row
);
}
/**
* {@inheritDoc}
*/
public
function
fetchAllNumeric
():
array
{
return
FetchUtils
::
fetchAllNumeric
(
$this
);
}
/**
* {@inheritDoc}
*/
public
function
fetchAllAssociative
():
array
{
return
FetchUtils
::
fetchAllAssociative
(
$this
);
}
/**
* {@inheritDoc}
*/
public
function
fetchFirstColumn
():
array
{
return
FetchUtils
::
fetchFirstColumn
(
$this
);
}
public
function
rowCount
():
int
{
return
count
(
$this
->
data
);
}
public
function
columnCount
():
int
{
return
$this
->
columnCount
;
}
public
function
free
():
void
{
$this
->
data
=
[];
}
/** @return array<string, mixed>|false */
private
function
fetch
()
{
if
(!
isset
(
$this
->
data
[
$this
->
num
]))
{
return
false
;
}
return
$this
->
data
[
$this
->
num
++];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Oct 4, 01:09 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5c/86/aa2e97c23030638e1ae3b3dd8fbd
Default Alt Text
ArrayResult.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment