Source of file PhpInfoCollector.php
Size: 0,853 Bytes - Last Modified: 2021-12-23T10:00:22+00:00
/var/www/docs.ssmods.com/process/src/code/Collector/PhpInfoCollector.php
123456789101112131415161718192021222324252627282930 | <?php namespace LeKoala\DebugBar\Collector; /** * Extends the default PhpInfoCollector to trim long PHP version numbers */ class PhpInfoCollector extends \DebugBar\DataCollector\PhpInfoCollector { public function collect() { $metrics = parent::collect(); $metrics['version'] = $this->trimVersion($metrics['version']); return $metrics; } /** * Given a PHP_VERSION constant value, trim any "extra" meta information from the end, returning the major, minor * and patch release of the version. Will fall back to returning the input if the matching fails. * * @param string $version * @return string */ protected function trimVersion($version) { preg_match('/^\d+\.\d+\.\d+/', $version, $matches); return !empty($matches[0]) ? $matches[0] : $version; } } |