original_string: protected function get_graded_date($contextid, $userid, $checkfeedback = false) {
          if (empty($this->grades[$contextid][$userid])) {
              return false;
          }
          foreach ($this->grades[$contextid][$userid] as $gradeitemid => $gradeitem) {
  
              // We check that either feedback or the grade is set.
              if (($checkfeedback && $gradeitem->feedback) || $gradeitem->grade) {
  
                  // Grab the first graded date.
                  if ($gradeitem->dategraded && (empty($after) || $gradeitem->dategraded < $after)) {
                      $after = $gradeitem->dategraded;
                  }
              }
          }
  
          if (!isset($after)) {
              // False if there are no graded items.
              return false;
          }
  
          return $after;
      }
code: protected function get_graded_date($contextid, $userid, $checkfeedback = false) {
          if (empty($this->grades[$contextid][$userid])) {
              return false;
          }
          foreach ($this->grades[$contextid][$userid] as $gradeitemid => $gradeitem) {
  
              // We check that either feedback or the grade is set.
              if (($checkfeedback && $gradeitem->feedback) || $gradeitem->grade) {
  
                  // Grab the first graded date.
                  if ($gradeitem->dategraded && (empty($after) || $gradeitem->dategraded < $after)) {
                      $after = $gradeitem->dategraded;
                  }
              }
          }
  
          if (!isset($after)) {
              // False if there are no graded items.
              return false;
          }
  
          return $after;
      }
code_tokens: protected function get_graded_date ( $ contextid , $ userid , $ checkfeedback = false ) { if ( empty ( $ this -> grades [ $ contextid ] [ $ userid ] ) ) { return false ; } foreach ( $ this -> grades [ $ contextid ] [ $ userid ] as $ gradeitemid => $ gradeitem ) { // We check that either feedback or the grade is set. if ( ( $ checkfeedback && $ gradeitem -> feedback ) || $ gradeitem -> grade ) { // Grab the first graded date. if ( $ gradeitem -> dategraded && ( empty ( $ after ) || $ gradeitem -> dategraded < $ after ) ) { $ after = $ gradeitem -> dategraded ; } } } if ( ! isset ( $ after ) ) { // False if there are no graded items. return false ; } return $ after ; }
docstring: Returns the date a user was graded.
  
  @param int $contextid
  @param int $userid
  @param bool $checkfeedback Check that the student was graded or check that feedback was given
  @return int|false
docstring_tokens: Returns the date a user was graded .