PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.2.0
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.2.0
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 / symfony / polyfill-php80 / Php80.php
matomo / app / vendor / symfony / polyfill-php80 Last commit date
Resources 2 years ago LICENSE 2 years ago Php80.php 1 year ago PhpToken.php 1 year ago README.md 2 years ago bootstrap.php 2 years ago
Php80.php
108 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 Symfony\Polyfill\Php80;
12
13 /**
14 * @author Ion Bazan <ion.bazan@gmail.com>
15 * @author Nico Oelgart <nicoswd@gmail.com>
16 * @author Nicolas Grekas <p@tchwork.com>
17 *
18 * @internal
19 */
20 final class Php80
21 {
22 public static function fdiv(float $dividend, float $divisor) : float
23 {
24 return @($dividend / $divisor);
25 }
26 public static function get_debug_type($value) : string
27 {
28 switch (\true) {
29 case null === $value:
30 return 'null';
31 case \is_bool($value):
32 return 'bool';
33 case \is_string($value):
34 return 'string';
35 case \is_array($value):
36 return 'array';
37 case \is_int($value):
38 return 'int';
39 case \is_float($value):
40 return 'float';
41 case \is_object($value):
42 break;
43 case $value instanceof \__PHP_Incomplete_Class:
44 return '__PHP_Incomplete_Class';
45 default:
46 if (null === ($type = @get_resource_type($value))) {
47 return 'unknown';
48 }
49 if ('Unknown' === $type) {
50 $type = 'closed';
51 }
52 return "resource ({$type})";
53 }
54 $class = \get_class($value);
55 if (\false === strpos($class, '@')) {
56 return $class;
57 }
58 return ((get_parent_class($class) ?: key(class_implements($class))) ?: 'class') . '@anonymous';
59 }
60 public static function get_resource_id($res) : int
61 {
62 if (!\is_resource($res) && null === @get_resource_type($res)) {
63 throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
64 }
65 return (int) $res;
66 }
67 public static function preg_last_error_msg() : string
68 {
69 switch (preg_last_error()) {
70 case \PREG_INTERNAL_ERROR:
71 return 'Internal error';
72 case \PREG_BAD_UTF8_ERROR:
73 return 'Malformed UTF-8 characters, possibly incorrectly encoded';
74 case \PREG_BAD_UTF8_OFFSET_ERROR:
75 return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
76 case \PREG_BACKTRACK_LIMIT_ERROR:
77 return 'Backtrack limit exhausted';
78 case \PREG_RECURSION_LIMIT_ERROR:
79 return 'Recursion limit exhausted';
80 case \PREG_JIT_STACKLIMIT_ERROR:
81 return 'JIT stack limit exhausted';
82 case \PREG_NO_ERROR:
83 return 'No error';
84 default:
85 return 'Unknown error';
86 }
87 }
88 public static function str_contains(string $haystack, string $needle) : bool
89 {
90 return '' === $needle || \false !== strpos($haystack, $needle);
91 }
92 public static function str_starts_with(string $haystack, string $needle) : bool
93 {
94 return 0 === strncmp($haystack, $needle, \strlen($needle));
95 }
96 public static function str_ends_with(string $haystack, string $needle) : bool
97 {
98 if ('' === $needle || $needle === $haystack) {
99 return \true;
100 }
101 if ('' === $haystack) {
102 return \false;
103 }
104 $needleLength = \strlen($needle);
105 return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
106 }
107 }
108