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 / prefixed / symfony / http-foundation / InputBag.php
matomo / app / vendor / prefixed / symfony / http-foundation Last commit date
Exception 2 years ago File 1 year ago RateLimiter 2 years ago Session 1 year ago Test 1 year ago AcceptHeader.php 1 year ago AcceptHeaderItem.php 2 years ago BinaryFileResponse.php 1 year ago Cookie.php 1 year ago ExpressionRequestMatcher.php 2 years ago FileBag.php 1 year ago HeaderBag.php 1 year ago HeaderUtils.php 1 year ago InputBag.php 2 years ago IpUtils.php 1 year ago JsonResponse.php 1 year ago LICENSE 2 years ago ParameterBag.php 1 year ago README.md 2 years ago RedirectResponse.php 2 years ago Request.php 1 year ago RequestMatcher.php 1 year ago RequestMatcherInterface.php 2 years ago RequestStack.php 2 years ago Response.php 1 year ago ResponseHeaderBag.php 1 year ago ServerBag.php 1 year ago StreamedResponse.php 1 year ago UrlHelper.php 2 years ago
InputBag.php
98 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\HttpFoundation;
12
13 use Matomo\Dependencies\Symfony\Component\HttpFoundation\Exception\BadRequestException;
14 /**
15 * InputBag is a container for user input values such as $_GET, $_POST, $_REQUEST, and $_COOKIE.
16 *
17 * @author Saif Eddin Gmati <azjezz@protonmail.com>
18 */
19 final class InputBag extends ParameterBag
20 {
21 /**
22 * Returns a scalar input value by name.
23 *
24 * @param string|int|float|bool|null $default The default value if the input key does not exist
25 *
26 * @return string|int|float|bool|null
27 */
28 public function get(string $key, $default = null)
29 {
30 if (null !== $default && !\is_scalar($default) && !(\is_object($default) && method_exists($default, '__toString'))) {
31 trigger_deprecation('symfony/http-foundation', '5.1', 'Passing a non-scalar value as 2nd argument to "%s()" is deprecated, pass a scalar or null instead.', __METHOD__);
32 }
33 $value = parent::get($key, $this);
34 if (null !== $value && $this !== $value && !\is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
35 trigger_deprecation('symfony/http-foundation', '5.1', 'Retrieving a non-scalar value from "%s()" is deprecated, and will throw a "%s" exception in Symfony 6.0, use "%s::all($key)" instead.', __METHOD__, BadRequestException::class, __CLASS__);
36 }
37 return $this === $value ? $default : $value;
38 }
39 /**
40 * {@inheritdoc}
41 */
42 public function all(?string $key = null) : array
43 {
44 return parent::all($key);
45 }
46 /**
47 * Replaces the current input values by a new set.
48 */
49 public function replace(array $inputs = [])
50 {
51 $this->parameters = [];
52 $this->add($inputs);
53 }
54 /**
55 * Adds input values.
56 */
57 public function add(array $inputs = [])
58 {
59 foreach ($inputs as $input => $value) {
60 $this->set($input, $value);
61 }
62 }
63 /**
64 * Sets an input by name.
65 *
66 * @param string|int|float|bool|array|null $value
67 */
68 public function set(string $key, $value)
69 {
70 if (null !== $value && !\is_scalar($value) && !\is_array($value) && !method_exists($value, '__toString')) {
71 trigger_deprecation('symfony/http-foundation', '5.1', 'Passing "%s" as a 2nd Argument to "%s()" is deprecated, pass a scalar, array, or null instead.', get_debug_type($value), __METHOD__);
72 }
73 $this->parameters[$key] = $value;
74 }
75 /**
76 * {@inheritdoc}
77 */
78 public function filter(string $key, $default = null, int $filter = \FILTER_DEFAULT, $options = [])
79 {
80 $value = $this->has($key) ? $this->all()[$key] : $default;
81 // Always turn $options into an array - this allows filter_var option shortcuts.
82 if (!\is_array($options) && $options) {
83 $options = ['flags' => $options];
84 }
85 if (\is_array($value) && !(($options['flags'] ?? 0) & (\FILTER_REQUIRE_ARRAY | \FILTER_FORCE_ARRAY))) {
86 trigger_deprecation('symfony/http-foundation', '5.1', 'Filtering an array value with "%s()" without passing the FILTER_REQUIRE_ARRAY or FILTER_FORCE_ARRAY flag is deprecated', __METHOD__);
87 if (!isset($options['flags'])) {
88 $options['flags'] = \FILTER_REQUIRE_ARRAY;
89 }
90 }
91 if (\FILTER_CALLBACK & $filter && !($options['options'] ?? null) instanceof \Closure) {
92 trigger_deprecation('symfony/http-foundation', '5.2', 'Not passing a Closure together with FILTER_CALLBACK to "%s()" is deprecated. Wrap your filter in a closure instead.', __METHOD__);
93 // throw new \InvalidArgumentException(sprintf('A Closure must be passed to "%s()" when FILTER_CALLBACK is used, "%s" given.', __METHOD__, get_debug_type($options['options'] ?? null)));
94 }
95 return filter_var($value, $filter, $options);
96 }
97 }
98