PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / trunk
Matomo Analytics – Powerful, Privacy-First Insights for WordPress vtrunk
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / vendor / prefixed / symfony / http-kernel / DataCollector / DataCollector.php
matomo / app / vendor / prefixed / symfony / http-kernel / DataCollector Last commit date
AjaxDataCollector.php 2 years ago ConfigDataCollector.php 1 year ago DataCollector.php 2 years ago DataCollectorInterface.php 2 years ago DumpDataCollector.php 1 year ago EventDataCollector.php 2 years ago ExceptionDataCollector.php 2 years ago LateDataCollectorInterface.php 2 years ago LoggerDataCollector.php 1 year ago MemoryDataCollector.php 1 year ago RequestDataCollector.php 1 year ago RouterDataCollector.php 1 year ago TimeDataCollector.php 1 year ago
DataCollector.php
109 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 namespace Matomo\Dependencies\Symfony\Component\HttpKernel\DataCollector;
12
13 use Matomo\Dependencies\Symfony\Component\VarDumper\Caster\CutStub;
14 use Matomo\Dependencies\Symfony\Component\VarDumper\Caster\ReflectionCaster;
15 use Matomo\Dependencies\Symfony\Component\VarDumper\Cloner\ClonerInterface;
16 use Matomo\Dependencies\Symfony\Component\VarDumper\Cloner\Data;
17 use Matomo\Dependencies\Symfony\Component\VarDumper\Cloner\Stub;
18 use Matomo\Dependencies\Symfony\Component\VarDumper\Cloner\VarCloner;
19 /**
20 * DataCollector.
21 *
22 * Children of this class must store the collected data in the data property.
23 *
24 * @author Fabien Potencier <fabien@symfony.com>
25 * @author Bernhard Schussek <bschussek@symfony.com>
26 */
27 abstract class DataCollector implements DataCollectorInterface
28 {
29 /**
30 * @var array|Data
31 */
32 protected $data = [];
33 /**
34 * @var ClonerInterface
35 */
36 private $cloner;
37 /**
38 * Converts the variable into a serializable Data instance.
39 *
40 * This array can be displayed in the template using
41 * the VarDumper component.
42 *
43 * @param mixed $var
44 *
45 * @return Data
46 */
47 protected function cloneVar($var)
48 {
49 if ($var instanceof Data) {
50 return $var;
51 }
52 if (null === $this->cloner) {
53 $this->cloner = new VarCloner();
54 $this->cloner->setMaxItems(-1);
55 $this->cloner->addCasters($this->getCasters());
56 }
57 return $this->cloner->cloneVar($var);
58 }
59 /**
60 * @return callable[] The casters to add to the cloner
61 */
62 protected function getCasters()
63 {
64 $casters = ['*' => function ($v, array $a, Stub $s, $isNested) {
65 if (!$v instanceof Stub) {
66 $b = $a;
67 foreach ($a as $k => $v) {
68 if (!\is_object($v) || $v instanceof \DateTimeInterface || $v instanceof Stub) {
69 continue;
70 }
71 try {
72 $a[$k] = $s = new CutStub($v);
73 if ($b[$k] === $s) {
74 // we've hit a non-typed reference
75 $a[$k] = $v;
76 }
77 } catch (\TypeError $e) {
78 // we've hit a typed reference
79 }
80 }
81 }
82 return $a;
83 }] + ReflectionCaster::UNSET_CLOSURE_FILE_INFO;
84 return $casters;
85 }
86 /**
87 * @return array
88 */
89 public function __sleep()
90 {
91 return ['data'];
92 }
93 public function __wakeup()
94 {
95 }
96 /**
97 * @internal to prevent implementing \Serializable
98 */
99 protected final function serialize()
100 {
101 }
102 /**
103 * @internal to prevent implementing \Serializable
104 */
105 protected final function unserialize($data)
106 {
107 }
108 }
109