PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / symfony / options-resolver / Debug / OptionsResolverIntrospector.php
ameliabooking / vendor / symfony / options-resolver / Debug Last commit date
OptionsResolverIntrospector.php 6 years ago
OptionsResolverIntrospector.php
103 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
12 namespace Symfony\Component\OptionsResolver\Debug;
13
14 use Symfony\Component\OptionsResolver\Exception\NoConfigurationException;
15 use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException;
16 use Symfony\Component\OptionsResolver\OptionsResolver;
17
18 /**
19 * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
20 *
21 * @final
22 */
23 class OptionsResolverIntrospector
24 {
25 private $get;
26
27 public function __construct(OptionsResolver $optionsResolver)
28 {
29 $this->get = \Closure::bind(function ($property, $option, $message) {
30 /** @var OptionsResolver $this */
31 if (!$this->isDefined($option)) {
32 throw new UndefinedOptionsException(sprintf('The option "%s" does not exist.', $option));
33 }
34
35 if (!\array_key_exists($option, $this->{$property})) {
36 throw new NoConfigurationException($message);
37 }
38
39 return $this->{$property}[$option];
40 }, $optionsResolver, $optionsResolver);
41 }
42
43 /**
44 * @param string $option
45 *
46 * @return mixed
47 *
48 * @throws NoConfigurationException on no configured value
49 */
50 public function getDefault($option)
51 {
52 return \call_user_func($this->get, 'defaults', $option, sprintf('No default value was set for the "%s" option.', $option));
53 }
54
55 /**
56 * @param string $option
57 *
58 * @return \Closure[]
59 *
60 * @throws NoConfigurationException on no configured closures
61 */
62 public function getLazyClosures($option)
63 {
64 return \call_user_func($this->get, 'lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option));
65 }
66
67 /**
68 * @param string $option
69 *
70 * @return string[]
71 *
72 * @throws NoConfigurationException on no configured types
73 */
74 public function getAllowedTypes($option)
75 {
76 return \call_user_func($this->get, 'allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option));
77 }
78
79 /**
80 * @param string $option
81 *
82 * @return mixed[]
83 *
84 * @throws NoConfigurationException on no configured values
85 */
86 public function getAllowedValues($option)
87 {
88 return \call_user_func($this->get, 'allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option));
89 }
90
91 /**
92 * @param string $option
93 *
94 * @return \Closure
95 *
96 * @throws NoConfigurationException on no configured normalizer
97 */
98 public function getNormalizer($option)
99 {
100 return \call_user_func($this->get, 'normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option));
101 }
102 }
103