original_string: public function validate() {
          global $DB;
          $params = array_keys($this->params);
          $method = ($this->method == BADGE_CRITERIA_AGGREGATION_ALL);
          $singleparam = (count($params) == 1);
  
          foreach ($params as $param) {
              // Perform check if there only one parameter with any type of aggregation,
              // Or there are more than one parameter with aggregation ALL.
              if (($singleparam || $method) && !$DB->record_exists('cohort', array('id' => $param))) {
                  return array(false, get_string('error:invalidparamcohort', 'badges'));
              }
          }
  
          return array(true, '');
      }
code: public function validate() {
          global $DB;
          $params = array_keys($this->params);
          $method = ($this->method == BADGE_CRITERIA_AGGREGATION_ALL);
          $singleparam = (count($params) == 1);
  
          foreach ($params as $param) {
              // Perform check if there only one parameter with any type of aggregation,
              // Or there are more than one parameter with aggregation ALL.
              if (($singleparam || $method) && !$DB->record_exists('cohort', array('id' => $param))) {
                  return array(false, get_string('error:invalidparamcohort', 'badges'));
              }
          }
  
          return array(true, '');
      }
code_tokens: public function validate ( ) { global $ DB ; $ params = array_keys ( $ this -> params ) ; $ method = ( $ this -> method == BADGE_CRITERIA_AGGREGATION_ALL ) ; $ singleparam = ( count ( $ params ) == 1 ) ; foreach ( $ params as $ param ) { // Perform check if there only one parameter with any type of aggregation, // Or there are more than one parameter with aggregation ALL. if ( ( $ singleparam || $ method ) && ! $ DB -> record_exists ( 'cohort' , array ( 'id' => $ param ) ) ) { return array ( false , get_string ( 'error:invalidparamcohort' , 'badges' ) ) ; } } return array ( true , '' ) ; }
docstring: Checks criteria for any major problems.
  
  @return array A list containing status and an error message (if any).
docstring_tokens: Checks criteria for any major problems .