GRAYBYTE WORDPRESS FILE MANAGER2696

Server IP : 192.250.235.76 / Your IP : 45.90.210.12
System : Linux s2968.sgp1.stableserver.net 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
PHP Version : 8.2.29
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF

HOME

/home/tawsifschoice/borkaa.tawsifschoice.com/
1902130114081995

GRAYBYTE WORDPRESS FILE MANAGER7145

Server IP : 198.54.116.172 / Your IP : 216.73.216.172
System : Linux server322.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : mail
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF

HOME

/opt/alt/php53/usr/share/doc/pear/OptionsResolver/Symfony/Component/OptionsResolver/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/alt/php53/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

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
January 01 1970 00:00:00
root / root
0
LICENSE
1.04 KB
December 18 2019 11:20:42
root / root
0644
README.md
3.094 KB
December 18 2019 11:20:42
root / root
0644
composer.json
0.785 KB
December 18 2019 11:20:42
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF