Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439 Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
76 lines
1.3 KiB
PHP
76 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Doctrine\DBAL\Driver;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class FetchUtils
|
|
{
|
|
/**
|
|
* @return mixed|false
|
|
*
|
|
* @throws Exception
|
|
*/
|
|
public static function fetchOne(Result $result)
|
|
{
|
|
$row = $result->fetchNumeric();
|
|
|
|
if ($row === false) {
|
|
return false;
|
|
}
|
|
|
|
return $row[0];
|
|
}
|
|
|
|
/**
|
|
* @return array<int,array<int,mixed>>
|
|
*
|
|
* @throws Exception
|
|
*/
|
|
public static function fetchAllNumeric(Result $result): array
|
|
{
|
|
$rows = [];
|
|
|
|
while (($row = $result->fetchNumeric()) !== false) {
|
|
$rows[] = $row;
|
|
}
|
|
|
|
return $rows;
|
|
}
|
|
|
|
/**
|
|
* @return array<int,array<string,mixed>>
|
|
*
|
|
* @throws Exception
|
|
*/
|
|
public static function fetchAllAssociative(Result $result): array
|
|
{
|
|
$rows = [];
|
|
|
|
while (($row = $result->fetchAssociative()) !== false) {
|
|
$rows[] = $row;
|
|
}
|
|
|
|
return $rows;
|
|
}
|
|
|
|
/**
|
|
* @return array<int,mixed>
|
|
*
|
|
* @throws Exception
|
|
*/
|
|
public static function fetchFirstColumn(Result $result): array
|
|
{
|
|
$rows = [];
|
|
|
|
while (($row = $result->fetchOne()) !== false) {
|
|
$rows[] = $row;
|
|
}
|
|
|
|
return $rows;
|
|
}
|
|
}
|