original_string: protected function activity_type_completed_by(\cm_info $activity, $starttime, $endtime, $student = false) {
  
          $fieldname = $this->get_timeclose_field();
          if (!$fieldname) {
              // This activity type do not have its own availability control.
              return null;
          }
  
          $this->fill_instance_data($activity);
          $instance = $this->instancedata[$activity->instance];
  
          if (!$instance->{$fieldname}) {
              return null;
          }
  
          if ($starttime < $instance->{$fieldname} && $endtime >= $instance->{$fieldname}) {
              return true;
          }
  
          return false;
      }
code: protected function activity_type_completed_by(\cm_info $activity, $starttime, $endtime, $student = false) {
  
          $fieldname = $this->get_timeclose_field();
          if (!$fieldname) {
              // This activity type do not have its own availability control.
              return null;
          }
  
          $this->fill_instance_data($activity);
          $instance = $this->instancedata[$activity->instance];
  
          if (!$instance->{$fieldname}) {
              return null;
          }
  
          if ($starttime < $instance->{$fieldname} && $endtime >= $instance->{$fieldname}) {
              return true;
          }
  
          return false;
      }
code_tokens: protected function activity_type_completed_by ( \ cm_info $ activity , $ starttime , $ endtime , $ student = false ) { $ fieldname = $ this -> get_timeclose_field ( ) ; if ( ! $ fieldname ) { // This activity type do not have its own availability control. return null ; } $ this -> fill_instance_data ( $ activity ) ; $ instance = $ this -> instancedata [ $ activity -> instance ] ; if ( ! $ instance -> { $ fieldname } ) { return null ; } if ( $ starttime < $ instance -> { $ fieldname } && $ endtime >= $ instance -> { $ fieldname } ) { return true ; } return false ; }
docstring: True if the activity is due or it has been closed during this period, false if during another period, null if no due time.
  
  It can be overwritten by activities that allow teachers to set a due date or a time close separately
  from Moodle availability system. Note that in most of the cases overwriting get_timeclose_field should
  be enough.
  
  Returns true or false if the time close date falls into the provided time range. Null otherwise.
  
  @param \cm_info $activity
  @param int $starttime
  @param int $endtime
  @param \stdClass|false $student
  @return null
docstring_tokens: True if the activity is due or it has been closed during this period false if during another period null if no due time .