/**
  * @dataProvider getParseData
  */
 public function testParse($input, $output, $expectExtraChars = false, $maxIcuVersion = null)
 {
     $hasExtraChars = false;
     $parsed = AgaviDecimalFormatter::parse($input, null, $hasExtraChars);
     $this->assertEquals($output, $parsed);
     $this->assertEquals($expectExtraChars, $hasExtraChars);
 }
 /**
  * Validates the input
  * 
  * @return     bool The input is valid number according to given parameters.
  * 
  * @author     Dominik del Bondio <*****@*****.**>
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 protected function validate()
 {
     $value =& $this->getData($this->getArgument());
     if (!is_scalar($value)) {
         // non scalar values would cause notices
         $this->throwError();
         return false;
     }
     $hasExtraChars = false;
     if (!is_int($value) && !is_float($value)) {
         $locale = null;
         if (AgaviConfig::get('core.use_translation') && !$this->getParameter('no_locale', false)) {
             if ($locale = $this->getParameter('in_locale')) {
                 $locale = $this->getContext()->getTranslationManager()->getLocale($locale);
             } else {
                 $locale = $this->getContext()->getTranslationManager()->getCurrentLocale();
             }
         }
         $parsedValue = AgaviDecimalFormatter::parse($value, $locale, $hasExtraChars);
     } else {
         $parsedValue = $value;
     }
     switch (strtolower($this->getParameter('type'))) {
         case 'int':
         case 'integer':
             if (!is_int($parsedValue) || $hasExtraChars) {
                 $this->throwError('type');
                 return false;
             }
             break;
         case 'float':
         case 'double':
             if (!is_float($parsedValue) && !is_int($parsedValue) || $hasExtraChars) {
                 $this->throwError('type');
                 return false;
             }
             break;
         default:
             if ($parsedValue === false || $hasExtraChars) {
                 $this->throwError('type');
                 return false;
             }
     }
     if ($this->hasParameter('min') && $parsedValue < $this->getParameter('min')) {
         $this->throwError('min');
         return false;
     }
     if ($this->hasParameter('max') && $parsedValue > $this->getParameter('max')) {
         $this->throwError('max');
         return false;
     }
     switch (strtolower($this->getParameter('cast_to', $this->getParameter('type')))) {
         case 'int':
         case 'integer':
             $parsedValue = (int) $parsedValue;
             break;
         case 'float':
         case 'double':
             $parsedValue = (double) $parsedValue;
             break;
     }
     if ($this->hasParameter('export')) {
         $this->export($parsedValue);
     } else {
         $value = $parsedValue;
     }
     return true;
 }