/** * @param string $countyCode */ public function __construct($countyCode) { if (!is_string($countyCode)) { throw InvalidArgumentException::invalidType('string', 'countryCodeDefinition', $countyCode); } if (!preg_match('~^\\d+$~', $countyCode)) { throw new InvalidCountryCodeFormatException($countyCode); } if (!CountryCodeListing::isValidCountryCode($countyCode)) { throw UnknownCountryCodeException::unknownCountryCode($countyCode); } $this->countryCode = $countyCode; }
public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('country', 'choice', ['label' => 'country code', 'horizontal_label_class' => 'sr-only', 'required' => true, 'choice_list' => CountryCodeListing::asChoiceList(), 'preferred_choices' => ['Surfnet\\StepupBundle\\Value\\PhoneNumber\\CountryCodeListing', 'isPreferredChoice'], 'horizontal_input_wrapper_class' => 'foo'])->add('subscriber', 'text', ['label' => 'subscriberNumber', 'horizontal_label_class' => 'sr-only', 'required' => true, 'horizontal_input_wrapper_class' => 'foo', 'attr' => ['autofocus' => true, 'placeholder' => '612345678']])->add('sendChallenge', 'submit', ['label' => 'ss.form.ss_send_sms_challenge.button.send_challenge', 'attr' => ['class' => 'btn btn-primary pull-right']]); }