original_string: public function get_all_activities($activitytype) {
  
          // Using is set because we set it to false if there are no activities.
          if (!isset($this->courseactivities[$activitytype])) {
              $modinfo = get_fast_modinfo($this->get_course_data(), -1);
              $instances = $modinfo->get_instances_of($activitytype);
  
              if ($instances) {
                  $this->courseactivities[$activitytype] = array();
                  foreach ($instances as $instance) {
                      // By context.
                      $this->courseactivities[$activitytype][$instance->context->id] = $instance;
                  }
              } else {
                  $this->courseactivities[$activitytype] = false;
              }
          }
  
          return $this->courseactivities[$activitytype];
      }
code: public function get_all_activities($activitytype) {
  
          // Using is set because we set it to false if there are no activities.
          if (!isset($this->courseactivities[$activitytype])) {
              $modinfo = get_fast_modinfo($this->get_course_data(), -1);
              $instances = $modinfo->get_instances_of($activitytype);
  
              if ($instances) {
                  $this->courseactivities[$activitytype] = array();
                  foreach ($instances as $instance) {
                      // By context.
                      $this->courseactivities[$activitytype][$instance->context->id] = $instance;
                  }
              } else {
                  $this->courseactivities[$activitytype] = false;
              }
          }
  
          return $this->courseactivities[$activitytype];
      }
code_tokens: public function get_all_activities ( $ activitytype ) { // Using is set because we set it to false if there are no activities. if ( ! isset ( $ this -> courseactivities [ $ activitytype ] ) ) { $ modinfo = get_fast_modinfo ( $ this -> get_course_data ( ) , - 1 ) ; $ instances = $ modinfo -> get_instances_of ( $ activitytype ) ; if ( $ instances ) { $ this -> courseactivities [ $ activitytype ] = array ( ) ; foreach ( $ instances as $ instance ) { // By context. $ this -> courseactivities [ $ activitytype ] [ $ instance -> context -> id ] = $ instance ; } } else { $ this -> courseactivities [ $ activitytype ] = false ; } } return $ this -> courseactivities [ $ activitytype ] ; }
docstring: Returns all the activities of the provided type the course has.
  
  @param string $activitytype
  @return array
docstring_tokens: Returns all the activities of the provided type the course has .