403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.21
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/splitstream/current/vendor/league/csv/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/splitstream/current/vendor/league/csv/src/RdbmsResult.php
<?php

/**
 * League.Csv (https://csv.thephpleague.com)
 *
 * (c) Ignace Nyamagana Butera <nyamsprod@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace League\Csv;

use Generator;
use mysqli_result;
use PDO;
use PDOStatement;
use PgSql\Result;
use RuntimeException;
use SQLite3Result;

use function array_column;
use function array_map;
use function pg_fetch_assoc;
use function pg_field_name;
use function pg_num_fields;
use function range;

use const SQLITE3_ASSOC;

final class RdbmsResult
{
    /**
     * @throws RuntimeException If no column names information is found.
     *
     * @return list<string>
     */
    public static function columnNames(PDOStatement|Result|mysqli_result|SQLite3Result $result): array
    {
        return match (true) {
            $result instanceof PDOStatement => array_map(fn (int $index): string => $result->getColumnMeta($index)['name'] ?? throw new RuntimeException('Unable to get metadata for column '.$index), range(0, $result->columnCount() - 1)),
            $result instanceof mysqli_result => array_column($result->fetch_fields(), 'name'),
            $result instanceof Result => array_map(fn (int $index) => pg_field_name($result, $index), range(0, pg_num_fields($result) - 1)),
            $result instanceof SQLite3Result => array_map($result->columnName(...), range(0, $result->numColumns() - 1)),
        };
    }

    /**
     * @return Generator<int, array<array-key, mixed>>
     */
    public static function rows(PDOStatement|Result|mysqli_result|SQLite3Result $result): Generator
    {
        if ($result instanceof PDOStatement) {
            while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
                yield $row; /* @phpstan-ignore-line */
            }

            return;
        }

        if ($result instanceof Result) {
            while ($row = pg_fetch_assoc($result)) {
                yield $row;
            }

            return;
        }

        if ($result instanceof mysqli_result) {
            while ($row = $result->fetch_assoc()) {
                yield $row;
            }

            return;
        }

        while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
            yield $row;
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit