| Server IP : 172.67.75.225 / Your IP : 216.73.216.185 Web Server : nginx/1.27.1 System : Linux us-1 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64 User : vinodai ( 3134) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v1396/themastermynd/public_html/wp-content/plugins/mailpoet/lib/Doctrine/WPDB/ |
Upload File : |
<?php declare(strict_types = 1);
namespace MailPoet\Doctrine\WPDB;
if (!defined('ABSPATH')) exit;
use MailPoetVendor\Doctrine\DBAL\Driver\Result as ResultInterface;
/**
* WPDB fetches all results from the underlying database driver,
* so we need to implement the result methods on in-memory data.
*/
class Result implements ResultInterface {
/** @var array[] */
private array $result = [];
private int $rowCount;
private int $cursor = 0;
public function __construct(
array $result,
int $rowCount
) {
foreach ($result as $row) {
$this->result[] = (array)$row;
}
$this->rowCount = $rowCount;
}
public function fetchNumeric() {
$row = $this->result[$this->cursor++] ?? null;
return $row === null ? false : array_values($row);
}
public function fetchAssociative() {
return $this->result[$this->cursor++] ?? false;
}
public function fetchOne() {
$row = $this->result[$this->cursor++] ?? null;
return $row === null ? false : reset($row);
}
public function fetchAllNumeric(): array {
$result = [];
foreach ($this->result as $row) {
$result[] = array_values($row);
}
return $result;
}
public function fetchAllAssociative(): array {
return array_values($this->result);
}
public function fetchFirstColumn(): array {
$result = [];
foreach ($this->result as $row) {
$result[] = reset($row);
}
return $result;
}
public function rowCount(): int {
return $this->rowCount;
}
public function columnCount(): int {
return count($this->result[0] ?? []);
}
public function free(): void {
$this->cursor = 0;
}
}