PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 4.1.13
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v4.1.13
4.1.20 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 All 174 releases
searchpro / BerqWP / vendor-prefixed / vendor / symfony / polyfill-php80 / Php80.php

Php80.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 4.1.13, at BerqWP/vendor-prefixed/vendor/symfony/polyfill-php80/Php80.php

108 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
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 BerqWP_Deps\Symfony\Polyfill\Php80;
12
13 /**
14 * @author Ion Bazan <[email protected]>
15 * @author Nico Oelgart <[email protected]>
16 * @author Nicolas Grekas <[email protected]>
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