original_string: public function price(array $values)
      {
          if (count($values) != 1) {
              return $this->translation->text('@field has invalid value', array(
                  '@field' => $this->translation->text('Condition')));
          }
  
          $components = array_map('trim', explode('|', reset($values)));
  
          if (count($components) > 2) {
              return $this->translation->text('@field has invalid value', array(
                  '@field' => $this->translation->text('Condition')));
          }
  
          if (!is_numeric($components[0])) {
              return $this->translation->text('@field must be numeric', array(
                  '@field' => $this->translation->text('Price')));
          }
  
          if (strlen($components[0]) > 8) {
              return $this->translation->text('@field must not be longer than @max characters', array(
                  '@max' => 8,
                  '@field' => $this->translation->text('Price')));
          }
  
          if (empty($components[1])) {
              $components[1] = $this->currency->getDefault();
          }
  
          $currency = $this->currency->get($components[1]);
  
          if (empty($currency)) {
              return $this->translation->text('@name is unavailable', array(
                  '@name' => $this->translation->text('Currency')));
          }
  
          return true;
      }
code: public function price(array $values)
      {
          if (count($values) != 1) {
              return $this->translation->text('@field has invalid value', array(
                  '@field' => $this->translation->text('Condition')));
          }
  
          $components = array_map('trim', explode('|', reset($values)));
  
          if (count($components) > 2) {
              return $this->translation->text('@field has invalid value', array(
                  '@field' => $this->translation->text('Condition')));
          }
  
          if (!is_numeric($components[0])) {
              return $this->translation->text('@field must be numeric', array(
                  '@field' => $this->translation->text('Price')));
          }
  
          if (strlen($components[0]) > 8) {
              return $this->translation->text('@field must not be longer than @max characters', array(
                  '@max' => 8,
                  '@field' => $this->translation->text('Price')));
          }
  
          if (empty($components[1])) {
              $components[1] = $this->currency->getDefault();
          }
  
          $currency = $this->currency->get($components[1]);
  
          if (empty($currency)) {
              return $this->translation->text('@name is unavailable', array(
                  '@name' => $this->translation->text('Currency')));
          }
  
          return true;
      }
code_tokens: public function price ( array $ values ) { if ( count ( $ values ) != 1 ) { return $ this -> translation -> text ( '@field has invalid value' , array ( '@field' => $ this -> translation -> text ( 'Condition' ) ) ) ; } $ components = array_map ( 'trim' , explode ( '|' , reset ( $ values ) ) ) ; if ( count ( $ components ) > 2 ) { return $ this -> translation -> text ( '@field has invalid value' , array ( '@field' => $ this -> translation -> text ( 'Condition' ) ) ) ; } if ( ! is_numeric ( $ components [ 0 ] ) ) { return $ this -> translation -> text ( '@field must be numeric' , array ( '@field' => $ this -> translation -> text ( 'Price' ) ) ) ; } if ( strlen ( $ components [ 0 ] ) > 8 ) { return $ this -> translation -> text ( '@field must not be longer than @max characters' , array ( '@max' => 8 , '@field' => $ this -> translation -> text ( 'Price' ) ) ) ; } if ( empty ( $ components [ 1 ] ) ) { $ components [ 1 ] = $ this -> currency -> getDefault ( ) ; } $ currency = $ this -> currency -> get ( $ components [ 1 ] ) ; if ( empty ( $ currency ) ) { return $ this -> translation -> text ( '@name is unavailable' , array ( '@name' => $ this -> translation -> text ( 'Currency' ) ) ) ; } return true ; }
docstring: Validates a price condition
  @param array $values
  @return boolean|string
docstring_tokens: Validates a price condition