PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.6
Kubio AI Page Builder v2.8.6
2.9.0 2.8.6 2.8.5 2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / vendor / symfony / var-dumper / Caster / PdoCaster.php
kubio / vendor / symfony / var-dumper / Caster Last commit date
AmqpCaster.php 1 year ago ArgsStub.php 1 year ago Caster.php 1 year ago ClassStub.php 1 year ago ConstStub.php 4 years ago CutArrayStub.php 4 years ago CutStub.php 4 years ago DOMCaster.php 1 year ago DateCaster.php 1 year ago DoctrineCaster.php 1 year ago DsCaster.php 1 year ago DsPairStub.php 4 years ago EnumStub.php 4 years ago ExceptionCaster.php 1 year ago FiberCaster.php 1 year ago FrameStub.php 4 years ago GmpCaster.php 1 year ago ImagineCaster.php 4 years ago ImgStub.php 1 year ago IntlCaster.php 1 year ago LinkStub.php 1 year ago MemcachedCaster.php 1 year ago MysqliCaster.php 1 year ago PdoCaster.php 1 year ago PgSqlCaster.php 1 year ago ProxyManagerCaster.php 1 year ago RdKafkaCaster.php 1 year ago RedisCaster.php 1 year ago ReflectionCaster.php 1 year ago ResourceCaster.php 1 year ago SplCaster.php 1 year ago StubCaster.php 1 year ago SymfonyCaster.php 1 year ago TraceStub.php 1 year ago UuidCaster.php 4 years ago XmlReaderCaster.php 1 year ago XmlResourceCaster.php 1 year ago
PdoCaster.php
123 lines
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
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 PDO related classes to array representation.
18 *
19 * @author Nicolas Grekas <p@tchwork.com>
20 *
21 * @final
22 */
23 class PdoCaster
24 {
25 private const PDO_ATTRIBUTES = [
26 'CASE' => [
27 \PDO::CASE_LOWER => 'LOWER',
28 \PDO::CASE_NATURAL => 'NATURAL',
29 \PDO::CASE_UPPER => 'UPPER',
30 ],
31 'ERRMODE' => [
32 \PDO::ERRMODE_SILENT => 'SILENT',
33 \PDO::ERRMODE_WARNING => 'WARNING',
34 \PDO::ERRMODE_EXCEPTION => 'EXCEPTION',
35 ],
36 'TIMEOUT',
37 'PREFETCH',
38 'AUTOCOMMIT',
39 'PERSISTENT',
40 'DRIVER_NAME',
41 'SERVER_INFO',
42 'ORACLE_NULLS' => [
43 \PDO::NULL_NATURAL => 'NATURAL',
44 \PDO::NULL_EMPTY_STRING => 'EMPTY_STRING',
45 \PDO::NULL_TO_STRING => 'TO_STRING',
46 ],
47 'CLIENT_VERSION',
48 'SERVER_VERSION',
49 'STATEMENT_CLASS',
50 'EMULATE_PREPARES',
51 'CONNECTION_STATUS',
52 'STRINGIFY_FETCHES',
53 'DEFAULT_FETCH_MODE' => [
54 \PDO::FETCH_ASSOC => 'ASSOC',
55 \PDO::FETCH_BOTH => 'BOTH',
56 \PDO::FETCH_LAZY => 'LAZY',
57 \PDO::FETCH_NUM => 'NUM',
58 \PDO::FETCH_OBJ => 'OBJ',
59 ],
60 ];
61
62 public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested)
63 {
64 $attr = [];
65 $errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
66 $c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
67
68 foreach (self::PDO_ATTRIBUTES as $k => $v) {
69 if (!isset($k[0])) {
70 $k = $v;
71 $v = [];
72 }
73
74 try {
75 $attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(\constant('PDO::ATTR_'.$k));
76 if ($v && isset($v[$attr[$k]])) {
77 $attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]);
78 }
79 } catch (\Exception $e) {
80 }
81 }
82 if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {
83 if ($attr[$k][1]) {
84 $attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]);
85 }
86 $attr[$k][0] = new ClassStub($attr[$k][0]);
87 }
88
89 $prefix = Caster::PREFIX_VIRTUAL;
90 $a += [
91 $prefix.'inTransaction' => method_exists($c, 'inTransaction'),
92 $prefix.'errorInfo' => $c->errorInfo(),
93 $prefix.'attributes' => new EnumStub($attr),
94 ];
95
96 if ($a[$prefix.'inTransaction']) {
97 $a[$prefix.'inTransaction'] = $c->inTransaction();
98 } else {
99 unset($a[$prefix.'inTransaction']);
100 }
101
102 if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
103 unset($a[$prefix.'errorInfo']);
104 }
105
106 $c->setAttribute(\PDO::ATTR_ERRMODE, $errmode);
107
108 return $a;
109 }
110
111 public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, bool $isNested)
112 {
113 $prefix = Caster::PREFIX_VIRTUAL;
114 $a[$prefix.'errorInfo'] = $c->errorInfo();
115
116 if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
117 unset($a[$prefix.'errorInfo']);
118 }
119
120 return $a;
121 }
122 }
123