PHP 8.3.31
Preview: ResourceCaster.php Size: 2.92 KB
/home/getspomw/royalsquad.us/vendor/symfony/var-dumper/Caster/ResourceCaster.php

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;

/**
 * Casts common resource types to array representation.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 *
 * @final
 */
class ResourceCaster
{
    public static function castCurl(\CurlHandle $h, array $a, Stub $stub, bool $isNested): array
    {
        return curl_getinfo($h);
    }

    public static function castDba($dba, array $a, Stub $stub, bool $isNested): array
    {
        $list = dba_list();
        $a['file'] = $list[(int) $dba];

        return $a;
    }

    public static function castProcess($process, array $a, Stub $stub, bool $isNested): array
    {
        return proc_get_status($process);
    }

    public static function castStream($stream, array $a, Stub $stub, bool $isNested): array
    {
        $a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
        if ($a['uri'] ?? false) {
            $a['uri'] = new LinkStub($a['uri']);
        }

        return $a;
    }

    public static function castStreamContext($stream, array $a, Stub $stub, bool $isNested): array
    {
        return @stream_context_get_params($stream) ?: $a;
    }

    public static function castGd($gd, array $a, Stub $stub, bool $isNested): array
    {
        $a['size'] = imagesx($gd).'x'.imagesy($gd);
        $a['trueColor'] = imageistruecolor($gd);

        return $a;
    }

    public static function castOpensslX509($h, array $a, Stub $stub, bool $isNested): array
    {
        $stub->cut = -1;
        $info = openssl_x509_parse($h, false);

        $pin = openssl_pkey_get_public($h);
        $pin = openssl_pkey_get_details($pin)['key'];
        $pin = \array_slice(explode("\n", $pin), 1, -2);
        $pin = base64_decode(implode('', $pin));
        $pin = base64_encode(hash('sha256', $pin, true));

        $a += [
            'subject' => new EnumStub(array_intersect_key($info['subject'], ['organizationName' => true, 'commonName' => true])),
            'issuer' => new EnumStub(array_intersect_key($info['issuer'], ['organizationName' => true, 'commonName' => true])),
            'expiry' => new ConstStub(date(\DateTimeInterface::ISO8601, $info['validTo_time_t']), $info['validTo_time_t']),
            'fingerprint' => new EnumStub([
                'md5' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'md5')), 2, ':', true)),
                'sha1' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha1')), 2, ':', true)),
                'sha256' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha256')), 2, ':', true)),
                'pin-sha256' => new ConstStub($pin),
            ]),
        ];

        return $a;
    }
}

Directory Contents

Dirs: 0 × Files: 42

Name Size Perms Modified Actions
6.57 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
2.23 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
6.79 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
3.73 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
740 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
702 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
1.89 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
4.80 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
1.65 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
10.65 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
1.55 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
625 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
596 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
13.40 KB lrw-r--r-- 2026-04-26 10:19:19
Edit Download
16.06 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
5.53 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
1.04 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
659 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
749 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
949 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
637 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
8.76 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
3.29 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
2.24 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
691 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
3.49 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
5.38 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
728 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
4.62 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
5.35 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
14.79 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
2.92 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
554 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
7.83 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
2.33 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
3.51 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
759 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
615 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
668 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
548 B lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
3.31 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download
2.49 KB lrw-rw-rw- 2025-09-17 06:53:24
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).