* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use Symfony\Component\Intl\Intl; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class CurrencyType extends AbstractType implements ChoiceLoaderInterface { /** * Currency loaded choice list. * * The choices are lazy loaded and generated from the Intl component. * * {@link \Symfony\Component\Intl\Intl::getCurrencyBundle()}. * * @var ArrayChoiceList */ private $choiceList; /** * {@inheritdoc} */ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'choice_loader' => function (Options $options) { if ($options['choices']) { @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), E_USER_DEPRECATED); return null; } return $this; }, 'choice_translation_domain' => false, )); } /** * {@inheritdoc} */ public function getParent() { return __NAMESPACE__.'\ChoiceType'; } /** * {@inheritdoc} */ public function getBlockPrefix() { return 'currency'; } /** * {@inheritdoc} */ public function loadChoiceList($value = null) { if (null !== $this->choiceList) { return $this->choiceList; } return $this->choiceList = new ArrayChoiceList(array_flip(Intl::getCurrencyBundle()->getCurrencyNames()), $value); } /** * {@inheritdoc} */ public function loadChoicesForValues(array $values, $value = null) { // Optimize $values = array_filter($values); if (empty($values)) { return array(); } // If no callable is set, values are the same as choices if (null === $value) { return $values; } return $this->loadChoiceList($value)->getChoicesForValues($values); } /** * {@inheritdoc} */ public function loadValuesForChoices(array $choices, $value = null) { // Optimize $choices = array_filter($choices); if (empty($choices)) { return array(); } // If no callable is set, choices are the same as values if (null === $value) { return $choices; } return $this->loadChoiceList($value)->getValuesForChoices($choices); } } __halt_compiler();----SIGNATURE:----tq59o525Vd1JM7Jv0VbtdzbMXTTpdHN4OTG8rtNitBGNqTKkVomfvisht1noZW5/nCzui20kVVC1eYUHiRZrE9kz9sRWAPsWe9gRjMrZlOhnHysoxfCTNHNW4hZDAvEb1s4PYCD64c6du64mTKmZ1SOdayvtPmtD2HGEUfLZ6a2C53eY5KWlWWVKmbNxJCPoHwAcmVNX2wo8ebkxrThZcsUzxjaNBjzxlaaGEDGl+43ngqIFBzH637Fy/j2ysjc+v2LwlUIVebB0bm+vonTwXZ/In+UdE2z1RpEHffhMwqwOp2mCYwKoFBZoLzTi4/r0xs6gKYdWIJOSk/SBZkY71MMxgMQS53u1JgUKa3tVXBhDWDzN29nCXxMKcN3Y+HJfo6cyxncZ/ExdkUGaFPAQan52+qHWZIdqHcK5NQ4BegHBdZSr50vLx6mYe9rKK43e6vvrmc/Fd7Ruak175joqOdhSYwJHNj9Hkjvl0kvwlx8rfmizSvBoqfoop7ENeH0NSx7mV7kO7gL30CSXKTsbt88ELAubfgmlhXNJVmETt2aP3aiNZsg4CU/7StAKSIzYIkBvIMFfOJIDbyojOCJtS7LdYwNnS+5He7OwQvO5FVna+W2bbRqX0yPFqHmBkpszv54o8DkAYGo0mmYlJTUvTCsOMjsyHQ20zCJqYzNdHXk=----ATTACHMENT:----NTMxMjY0NTE4MjM5MDQ4OSA4NzI3MzA3NTgyNTI4NTM5IDE0OTY4MTQyOTUxMDM2Nzc=