[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <[email protected]> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\VarDumper\Caster; 13 14 use Symfony\Component\VarDumper\Cloner\Stub; 15 16 /** 17 * Casts common resource types to array representation. 18 * 19 * @author Nicolas Grekas <[email protected]> 20 * 21 * @final 22 */ 23 class ResourceCaster 24 { 25 /** 26 * @param \CurlHandle|resource $h 27 */ 28 public static function castCurl($h, array $a, Stub $stub, bool $isNested): array 29 { 30 return curl_getinfo($h); 31 } 32 33 public static function castDba($dba, array $a, Stub $stub, bool $isNested) 34 { 35 $list = dba_list(); 36 $a['file'] = $list[(int) $dba]; 37 38 return $a; 39 } 40 41 public static function castProcess($process, array $a, Stub $stub, bool $isNested) 42 { 43 return proc_get_status($process); 44 } 45 46 public static function castStream($stream, array $a, Stub $stub, bool $isNested) 47 { 48 $a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested); 49 if ($a['uri'] ?? false) { 50 $a['uri'] = new LinkStub($a['uri']); 51 } 52 53 return $a; 54 } 55 56 public static function castStreamContext($stream, array $a, Stub $stub, bool $isNested) 57 { 58 return @stream_context_get_params($stream) ?: $a; 59 } 60 61 public static function castGd($gd, array $a, Stub $stub, bool $isNested) 62 { 63 $a['size'] = imagesx($gd).'x'.imagesy($gd); 64 $a['trueColor'] = imageistruecolor($gd); 65 66 return $a; 67 } 68 69 public static function castMysqlLink($h, array $a, Stub $stub, bool $isNested) 70 { 71 $a['host'] = mysql_get_host_info($h); 72 $a['protocol'] = mysql_get_proto_info($h); 73 $a['server'] = mysql_get_server_info($h); 74 75 return $a; 76 } 77 78 public static function castOpensslX509($h, array $a, Stub $stub, bool $isNested) 79 { 80 $stub->cut = -1; 81 $info = openssl_x509_parse($h, false); 82 83 $pin = openssl_pkey_get_public($h); 84 $pin = openssl_pkey_get_details($pin)['key']; 85 $pin = \array_slice(explode("\n", $pin), 1, -2); 86 $pin = base64_decode(implode('', $pin)); 87 $pin = base64_encode(hash('sha256', $pin, true)); 88 89 $a += [ 90 'subject' => new EnumStub(array_intersect_key($info['subject'], ['organizationName' => true, 'commonName' => true])), 91 'issuer' => new EnumStub(array_intersect_key($info['issuer'], ['organizationName' => true, 'commonName' => true])), 92 'expiry' => new ConstStub(date(\DateTime::ISO8601, $info['validTo_time_t']), $info['validTo_time_t']), 93 'fingerprint' => new EnumStub([ 94 'md5' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'md5')), 2, ':', true)), 95 'sha1' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha1')), 2, ':', true)), 96 'sha256' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha256')), 2, ':', true)), 97 'pin-sha256' => new ConstStub($pin), 98 ]), 99 ]; 100 101 return $a; 102 } 103 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |