original_string: protected function validateCrs()
      {
          $nonEmpty   = array();
          $enabled    = array();
          $required   = array();
          $optsValid  = array();
          foreach ($this->props['options'] as $opt) {
              if (empty($opt['attribs']['disabled']) && !isset($opt['optgroup'])) {
                  $enabled[] = $opt['attribs']['value'];
                  $optsValid[] = $opt['attribs']['value'];
              }
              if (!empty($opt['attribs']['required'])) {
                  $required[] = $opt['attribs']['value'];
              }
          }
          $values = $this->attribs['type'] == 'radio'
              ? (array) $this->attribs['value']
              : $this->props['values'];
          if (!empty($values)) {
              $this->debug->log('values', $values);
              foreach ($values as $k => $val) {
                  if (!\in_array($val, $optsValid)) {
                      $this->debug->warn('invalid answer!', $val);
                      unset($values[$k]);
                  } elseif ($val != '') {
                      $nonEmpty[] = $val;
                  }
              }
          }
          if (($this->isRequired() || !empty($required) ) && !empty($enabled) && empty($nonEmpty)) {
              $this->debug->log('required, enabled, & no value!');
              $this->props['isValid'] = false;
          }
      }
code: protected function validateCrs()
      {
          $nonEmpty   = array();
          $enabled    = array();
          $required   = array();
          $optsValid  = array();
          foreach ($this->props['options'] as $opt) {
              if (empty($opt['attribs']['disabled']) && !isset($opt['optgroup'])) {
                  $enabled[] = $opt['attribs']['value'];
                  $optsValid[] = $opt['attribs']['value'];
              }
              if (!empty($opt['attribs']['required'])) {
                  $required[] = $opt['attribs']['value'];
              }
          }
          $values = $this->attribs['type'] == 'radio'
              ? (array) $this->attribs['value']
              : $this->props['values'];
          if (!empty($values)) {
              $this->debug->log('values', $values);
              foreach ($values as $k => $val) {
                  if (!\in_array($val, $optsValid)) {
                      $this->debug->warn('invalid answer!', $val);
                      unset($values[$k]);
                  } elseif ($val != '') {
                      $nonEmpty[] = $val;
                  }
              }
          }
          if (($this->isRequired() || !empty($required) ) && !empty($enabled) && empty($nonEmpty)) {
              $this->debug->log('required, enabled, & no value!');
              $this->props['isValid'] = false;
          }
      }
code_tokens: protected function validateCrs ( ) { $ nonEmpty = array ( ) ; $ enabled = array ( ) ; $ required = array ( ) ; $ optsValid = array ( ) ; foreach ( $ this -> props [ 'options' ] as $ opt ) { if ( empty ( $ opt [ 'attribs' ] [ 'disabled' ] ) && ! isset ( $ opt [ 'optgroup' ] ) ) { $ enabled [ ] = $ opt [ 'attribs' ] [ 'value' ] ; $ optsValid [ ] = $ opt [ 'attribs' ] [ 'value' ] ; } if ( ! empty ( $ opt [ 'attribs' ] [ 'required' ] ) ) { $ required [ ] = $ opt [ 'attribs' ] [ 'value' ] ; } } $ values = $ this -> attribs [ 'type' ] == 'radio' ? ( array ) $ this -> attribs [ 'value' ] : $ this -> props [ 'values' ] ; if ( ! empty ( $ values ) ) { $ this -> debug -> log ( 'values' , $ values ) ; foreach ( $ values as $ k => $ val ) { if ( ! \ in_array ( $ val , $ optsValid ) ) { $ this -> debug -> warn ( 'invalid answer!' , $ val ) ; unset ( $ values [ $ k ] ) ; } elseif ( $ val != '' ) { $ nonEmpty [ ] = $ val ; } } } if ( ( $ this -> isRequired ( ) || ! empty ( $ required ) ) && ! empty ( $ enabled ) && empty ( $ nonEmpty ) ) { $ this -> debug -> log ( 'required, enabled, & no value!' ) ; $ this -> props [ 'isValid' ] = false ; } }
docstring: Validate Checkbox, Radio, Select
  
  @return void
docstring_tokens: Validate Checkbox Radio Select