protected function setImportedValue($value)
 {
     if ($value !== null && $value != $this->getFixedValue()) {
         $value = null;
         $this->setError(FormControlError::invalid());
     }
     parent::setImportedValue($value);
 }
 function importValue($value)
 {
     if (!in_array($value, $this->getAvailableValues())) {
         $value = null;
         $this->setError(FormControlError::invalid());
     }
     if (!$value && !$this->isOptional()) {
         $this->setError(FormControlError::missing());
     }
     return parent::importValue($value);
 }
 function importValue($value)
 {
     if ($value && !is_scalar($value)) {
         $value = null;
         $this->setError(FormControlError::invalid());
     } else {
         if (!$value && !$this->isOptional()) {
             $this->setError(FormControlError::missing());
         }
     }
     $this->setImportedValue($value);
     return !$this->hasError();
 }
 function importValue($value)
 {
     if ($value && !is_scalar($value)) {
         $value = null;
         $this->setError(FormControlError::invalid());
     } else {
         if (!in_array($value, $this->getAvailableValues())) {
             $value = null;
             $this->setError(FormControlError::invalid());
         }
     }
     $this->setImportedValue($value);
     return !$this->hasError();
 }
 function setImportedValue($value)
 {
     if ($this->trim && !$this->hasError()) {
         $value = trim($value);
         if (!$value && !$this->isOptional()) {
             $this->setError(FormControlError::missing());
         }
     }
     if ($this->pattern && !$this->hasError()) {
         if (!preg_match($this->pattern, $value)) {
             $this->setError(FormControlError::wrong());
         }
     }
     parent::setImportedValue($value);
 }
 function importValue($value)
 {
     if ($value && !is_array($value)) {
         $value = array();
         $this->setError(FormControlError::invalid());
     }
     if (!$value) {
         $value = array();
     }
     $value = array_intersect($this->getAvailableValues(), $value);
     if (!$value && !$this->isOptional()) {
         $this->setError(FormControlError::missing());
     }
     $this->setImportedValue($value);
     return !$this->hasError();
 }
 function getErrorMessage()
 {
     if ($this->error) {
         return $this->error->getMessage();
     }
 }
 function setError(FormControlError $error)
 {
     Assert::isFalse($error->is(FormControlError::MISSING), '%s cannot be missing', get_class($this));
     return parent::setError($error);
 }