original_string: public function resolve_dependencies() {
          if ($this->group) {
              // Default for when a group is selected.
              if ($this->attempts === null || $this->attempts == quiz_attempts_report::ALL_WITH) {
                  $this->attempts = quiz_attempts_report::ENROLLED_WITH;
              }
  
          } else if (!$this->group && $this->course->id == SITEID) {
              // Force report on front page to show all, unless a group is selected.
              $this->attempts = quiz_attempts_report::ALL_WITH;
  
          } else if (!in_array($this->attempts, array(quiz_attempts_report::ALL_WITH, quiz_attempts_report::ENROLLED_WITH,
                  quiz_attempts_report::ENROLLED_WITHOUT, quiz_attempts_report::ENROLLED_ALL))) {
              $this->attempts = quiz_attempts_report::ENROLLED_WITH;
          }
  
          $cleanstates = array();
          foreach (self::$statefields as $state) {
              if (in_array($state, $this->states)) {
                  $cleanstates[] = $state;
              }
          }
          $this->states = $cleanstates;
          if (count($this->states) == count(self::$statefields)) {
              // If all states have been selected, then there is no constraint
              // required in the SQL, so clear the array.
              $this->states = null;
          }
  
          if (!quiz_report_can_filter_only_graded($this->quiz)) {
              // A grading mode like 'average' has been selected, so we cannot do
              // the show the attempt that gave the final grade thing.
              $this->onlygraded = false;
          }
  
          if ($this->attempts == quiz_attempts_report::ENROLLED_WITHOUT) {
              $this->states = null;
              $this->onlygraded = false;
          }
  
          if (!$this->is_showing_finished_attempts()) {
              $this->onlygraded = false;
          }
  
          if ($this->pagesize < 1) {
              $this->pagesize = quiz_attempts_report::DEFAULT_PAGE_SIZE;
          }
      }
code: public function resolve_dependencies() {
          if ($this->group) {
              // Default for when a group is selected.
              if ($this->attempts === null || $this->attempts == quiz_attempts_report::ALL_WITH) {
                  $this->attempts = quiz_attempts_report::ENROLLED_WITH;
              }
  
          } else if (!$this->group && $this->course->id == SITEID) {
              // Force report on front page to show all, unless a group is selected.
              $this->attempts = quiz_attempts_report::ALL_WITH;
  
          } else if (!in_array($this->attempts, array(quiz_attempts_report::ALL_WITH, quiz_attempts_report::ENROLLED_WITH,
                  quiz_attempts_report::ENROLLED_WITHOUT, quiz_attempts_report::ENROLLED_ALL))) {
              $this->attempts = quiz_attempts_report::ENROLLED_WITH;
          }
  
          $cleanstates = array();
          foreach (self::$statefields as $state) {
              if (in_array($state, $this->states)) {
                  $cleanstates[] = $state;
              }
          }
          $this->states = $cleanstates;
          if (count($this->states) == count(self::$statefields)) {
              // If all states have been selected, then there is no constraint
              // required in the SQL, so clear the array.
              $this->states = null;
          }
  
          if (!quiz_report_can_filter_only_graded($this->quiz)) {
              // A grading mode like 'average' has been selected, so we cannot do
              // the show the attempt that gave the final grade thing.
              $this->onlygraded = false;
          }
  
          if ($this->attempts == quiz_attempts_report::ENROLLED_WITHOUT) {
              $this->states = null;
              $this->onlygraded = false;
          }
  
          if (!$this->is_showing_finished_attempts()) {
              $this->onlygraded = false;
          }
  
          if ($this->pagesize < 1) {
              $this->pagesize = quiz_attempts_report::DEFAULT_PAGE_SIZE;
          }
      }
code_tokens: public function resolve_dependencies ( ) { if ( $ this -> group ) { // Default for when a group is selected. if ( $ this -> attempts === null || $ this -> attempts == quiz_attempts_report :: ALL_WITH ) { $ this -> attempts = quiz_attempts_report :: ENROLLED_WITH ; } } else if ( ! $ this -> group && $ this -> course -> id == SITEID ) { // Force report on front page to show all, unless a group is selected. $ this -> attempts = quiz_attempts_report :: ALL_WITH ; } else if ( ! in_array ( $ this -> attempts , array ( quiz_attempts_report :: ALL_WITH , quiz_attempts_report :: ENROLLED_WITH , quiz_attempts_report :: ENROLLED_WITHOUT , quiz_attempts_report :: ENROLLED_ALL ) ) ) { $ this -> attempts = quiz_attempts_report :: ENROLLED_WITH ; } $ cleanstates = array ( ) ; foreach ( self :: $ statefields as $ state ) { if ( in_array ( $ state , $ this -> states ) ) { $ cleanstates [ ] = $ state ; } } $ this -> states = $ cleanstates ; if ( count ( $ this -> states ) == count ( self :: $ statefields ) ) { // If all states have been selected, then there is no constraint // required in the SQL, so clear the array. $ this -> states = null ; } if ( ! quiz_report_can_filter_only_graded ( $ this -> quiz ) ) { // A grading mode like 'average' has been selected, so we cannot do // the show the attempt that gave the final grade thing. $ this -> onlygraded = false ; } if ( $ this -> attempts == quiz_attempts_report :: ENROLLED_WITHOUT ) { $ this -> states = null ; $ this -> onlygraded = false ; } if ( ! $ this -> is_showing_finished_attempts ( ) ) { $ this -> onlygraded = false ; } if ( $ this -> pagesize < 1 ) { $ this -> pagesize = quiz_attempts_report :: DEFAULT_PAGE_SIZE ; } }
docstring: Check the settings, and remove any 'impossible' combinations.
docstring_tokens: Check the settings and remove any impossible combinations .