✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ premium290.web-hosting.com ​🇻​♯➤ 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2025

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 63.250.38.37 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.224
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /opt/alt/php55/usr/share/doc/pear/OptionsResolver/Symfony/Component/OptionsResolver//README.md
OptionsResolver Component
=========================

OptionsResolver helps at configuring objects with option arrays.

It supports default values on different levels of your class hierarchy,
option constraints (required vs. optional, allowed values) and lazy options
whose default value depends on the value of another option.

The following example demonstrates a Person class with two required options
"firstName" and "lastName" and two optional options "age" and "gender", where
the default value of "gender" is derived from the passed first name, if
possible, and may only be one of "male" and "female".

    use Symfony\Component\OptionsResolver\OptionsResolver;
    use Symfony\Component\OptionsResolver\OptionsResolverInterface;
    use Symfony\Component\OptionsResolver\Options;

    class Person
    {
        protected $options;

        public function __construct(array $options = array())
        {
            $resolver = new OptionsResolver();
            $this->setDefaultOptions($resolver);

            $this->options = $resolver->resolve($options);
        }

        protected function setDefaultOptions(OptionsResolverInterface $resolver)
        {
            $resolver->setRequired(array(
                'firstName',
                'lastName',
            ));

            $resolver->setDefaults(array(
                'age' => null,
                'gender' => function (Options $options) {
                    if (self::isKnownMaleName($options['firstName'])) {
                        return 'male';
                    }

                    return 'female';
                },
            ));

            $resolver->setAllowedValues(array(
                'gender' => array('male', 'female'),
            ));
        }
    }

We can now easily instantiate a Person object:

    // 'gender' is implicitly set to 'female'
    $person = new Person(array(
        'firstName' => 'Jane',
        'lastName' => 'Doe',
    ));

We can also override the default values of the optional options:

    $person = new Person(array(
        'firstName' => 'Abdullah',
        'lastName' => 'Mogashi',
        'gender' => 'male',
        'age' => 30,
    ));

Options can be added or changed in subclasses by overriding the `setDefaultOptions`
method:

    use Symfony\Component\OptionsResolver\OptionsResolver;
    use Symfony\Component\OptionsResolver\Options;

    class Employee extends Person
    {
        protected function setDefaultOptions(OptionsResolverInterface $resolver)
        {
            parent::setDefaultOptions($resolver);

            $resolver->setRequired(array(
                'birthDate',
            ));

            $resolver->setDefaults(array(
                // $previousValue contains the default value configured in the
                // parent class
                'age' => function (Options $options, $previousValue) {
                    return self::calculateAge($options['birthDate']);
                }
            ));
        }
    }



Resources
---------

You can run the unit tests with the following command:

    $ cd path/to/Symfony/Component/OptionsResolver/
    $ composer.phar install
    $ phpunit


Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
1 Jan 1970 12.00 AM
root / root
0
LICENSE
1.04 KB
18 Dec 2019 11.24 AM
root / root
0644
README.md
3.094 KB
18 Dec 2019 11.24 AM
root / root
0644
composer.json
0.785 KB
18 Dec 2019 11.24 AM
root / root
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF