PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.8.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.8.2
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 / ConfigDataCollector.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
ConfigDataCollector.php
225 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\HttpFoundation\Request;
14 use Matomo\Dependencies\Symfony\Component\HttpFoundation\Response;
15 use Matomo\Dependencies\Symfony\Component\HttpKernel\Kernel;
16 use Matomo\Dependencies\Symfony\Component\HttpKernel\KernelInterface;
17 use Matomo\Dependencies\Symfony\Component\VarDumper\Caster\ClassStub;
18 /**
19 * @author Fabien Potencier <fabien@symfony.com>
20 *
21 * @final
22 */
23 class ConfigDataCollector extends DataCollector implements LateDataCollectorInterface
24 {
25 /**
26 * @var KernelInterface
27 */
28 private $kernel;
29 /**
30 * Sets the Kernel associated with this Request.
31 */
32 public function setKernel(?KernelInterface $kernel = null)
33 {
34 $this->kernel = $kernel;
35 }
36 /**
37 * {@inheritdoc}
38 */
39 public function collect(Request $request, Response $response, ?\Throwable $exception = null)
40 {
41 $eom = \DateTime::createFromFormat('d/m/Y', '01/' . Kernel::END_OF_MAINTENANCE);
42 $eol = \DateTime::createFromFormat('d/m/Y', '01/' . Kernel::END_OF_LIFE);
43 $this->data = ['token' => $response->headers->get('X-Debug-Token'), 'symfony_version' => Kernel::VERSION, 'symfony_minor_version' => sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION), 'symfony_lts' => 4 === Kernel::MINOR_VERSION, 'symfony_state' => $this->determineSymfonyState(), 'symfony_eom' => $eom->format('F Y'), 'symfony_eol' => $eol->format('F Y'), 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => \PHP_VERSION, 'php_architecture' => \PHP_INT_SIZE * 8, 'php_intl_locale' => class_exists(\Locale::class, \false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', 'php_timezone' => date_default_timezone_get(), 'xdebug_enabled' => \extension_loaded('xdebug'), 'apcu_enabled' => \extension_loaded('apcu') && filter_var(\ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN), 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN), 'bundles' => [], 'sapi_name' => \PHP_SAPI];
44 if (isset($this->kernel)) {
45 foreach ($this->kernel->getBundles() as $name => $bundle) {
46 $this->data['bundles'][$name] = new ClassStub(\get_class($bundle));
47 }
48 }
49 if (preg_match('~^(\\d+(?:\\.\\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) {
50 $this->data['php_version'] = $matches[1];
51 $this->data['php_version_extra'] = $matches[2];
52 }
53 }
54 /**
55 * {@inheritdoc}
56 */
57 public function reset()
58 {
59 $this->data = [];
60 }
61 public function lateCollect()
62 {
63 $this->data = $this->cloneVar($this->data);
64 }
65 /**
66 * Gets the token.
67 */
68 public function getToken() : ?string
69 {
70 return $this->data['token'];
71 }
72 /**
73 * Gets the Symfony version.
74 */
75 public function getSymfonyVersion() : string
76 {
77 return $this->data['symfony_version'];
78 }
79 /**
80 * Returns the state of the current Symfony release.
81 *
82 * @return string One of: unknown, dev, stable, eom, eol
83 */
84 public function getSymfonyState() : string
85 {
86 return $this->data['symfony_state'];
87 }
88 /**
89 * Returns the minor Symfony version used (without patch numbers of extra
90 * suffix like "RC", "beta", etc.).
91 */
92 public function getSymfonyMinorVersion() : string
93 {
94 return $this->data['symfony_minor_version'];
95 }
96 /**
97 * Returns if the current Symfony version is a Long-Term Support one.
98 */
99 public function isSymfonyLts() : bool
100 {
101 return $this->data['symfony_lts'];
102 }
103 /**
104 * Returns the human readable date when this Symfony version ends its
105 * maintenance period.
106 */
107 public function getSymfonyEom() : string
108 {
109 return $this->data['symfony_eom'];
110 }
111 /**
112 * Returns the human readable date when this Symfony version reaches its
113 * "end of life" and won't receive bugs or security fixes.
114 */
115 public function getSymfonyEol() : string
116 {
117 return $this->data['symfony_eol'];
118 }
119 /**
120 * Gets the PHP version.
121 */
122 public function getPhpVersion() : string
123 {
124 return $this->data['php_version'];
125 }
126 /**
127 * Gets the PHP version extra part.
128 */
129 public function getPhpVersionExtra() : ?string
130 {
131 return $this->data['php_version_extra'] ?? null;
132 }
133 /**
134 * @return int The PHP architecture as number of bits (e.g. 32 or 64)
135 */
136 public function getPhpArchitecture() : int
137 {
138 return $this->data['php_architecture'];
139 }
140 public function getPhpIntlLocale() : string
141 {
142 return $this->data['php_intl_locale'];
143 }
144 public function getPhpTimezone() : string
145 {
146 return $this->data['php_timezone'];
147 }
148 /**
149 * Gets the environment.
150 */
151 public function getEnv() : string
152 {
153 return $this->data['env'];
154 }
155 /**
156 * Returns true if the debug is enabled.
157 *
158 * @return bool|string true if debug is enabled, false otherwise or a string if no kernel was set
159 */
160 public function isDebug()
161 {
162 return $this->data['debug'];
163 }
164 /**
165 * Returns true if the XDebug is enabled.
166 */
167 public function hasXDebug() : bool
168 {
169 return $this->data['xdebug_enabled'];
170 }
171 /**
172 * Returns true if APCu is enabled.
173 */
174 public function hasApcu() : bool
175 {
176 return $this->data['apcu_enabled'];
177 }
178 /**
179 * Returns true if Zend OPcache is enabled.
180 */
181 public function hasZendOpcache() : bool
182 {
183 return $this->data['zend_opcache_enabled'];
184 }
185 public function getBundles()
186 {
187 return $this->data['bundles'];
188 }
189 /**
190 * Gets the PHP SAPI name.
191 */
192 public function getSapiName() : string
193 {
194 return $this->data['sapi_name'];
195 }
196 /**
197 * {@inheritdoc}
198 */
199 public function getName() : string
200 {
201 return 'config';
202 }
203 /**
204 * Tries to retrieve information about the current Symfony version.
205 *
206 * @return string One of: dev, stable, eom, eol
207 */
208 private function determineSymfonyState() : string
209 {
210 $now = new \DateTime();
211 $eom = \DateTime::createFromFormat('d/m/Y', '01/' . Kernel::END_OF_MAINTENANCE)->modify('last day of this month');
212 $eol = \DateTime::createFromFormat('d/m/Y', '01/' . Kernel::END_OF_LIFE)->modify('last day of this month');
213 if ($now > $eol) {
214 $versionState = 'eol';
215 } elseif ($now > $eom) {
216 $versionState = 'eom';
217 } elseif ('' !== Kernel::EXTRA_VERSION) {
218 $versionState = 'dev';
219 } else {
220 $versionState = 'stable';
221 }
222 return $versionState;
223 }
224 }
225