PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.25
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.25
1.10.25 1.10.24 1.10.23 1.10.22 1.10.21 1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 All 169 releases
woocommerce-pos / vendor_prefixed / sentry / sentry / src / Util / PHPVersion.php

PHPVersion.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.25, at vendor_prefixed/sentry/sentry/src/Util/PHPVersion.php

34 lines 902 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare (strict_types=1);
4 namespace WCPOS\Vendor\Sentry\Util;
5
6 /**
7 * This class is an helper utility to parse the version of PHP and convert it
8 * to a normalized form.
9 *
10 * @internal
11 */
12 final class PHPVersion
13 {
14 private const VERSION_PARSING_REGEX = '/^(?<base>\\d\\.\\d\\.\\d{1,2})(?<extra>-(beta|rc)-?(\\d+)?(-dev)?)?/i';
15 /**
16 * Parses the given string representing a PHP version and returns it in a
17 * normalized form.
18 *
19 * @param string $version The string to parse
20 */
21 public static function parseVersion(string $version = \PHP_VERSION) : string
22 {
23 $matches = [];
24 if (!\preg_match(self::VERSION_PARSING_REGEX, $version, $matches)) {
25 return $version;
26 }
27 $version = $matches['base'];
28 if (isset($matches['extra'])) {
29 $version .= $matches['extra'];
30 }
31 return $version;
32 }
33 }
34