original_string: public static function get_predictions_processor($predictionclass = false, $checkisready = true) {
  
          // We want 0 or 1 so we can use it as an array key for caching.
          $checkisready = intval($checkisready);
  
          if (!$predictionclass) {
              $predictionclass = get_config('analytics', 'predictionsprocessor');
          }
  
          if (empty($predictionclass)) {
              // Use the default one if nothing set.
              $predictionclass = self::default_mlbackend();
          }
  
          if (!class_exists($predictionclass)) {
              throw new \coding_exception('Invalid predictions processor ' . $predictionclass . '.');
          }
  
          $interfaces = class_implements($predictionclass);
          if (empty($interfaces['core_analytics\predictor'])) {
              throw new \coding_exception($predictionclass . ' should implement \core_analytics\predictor.');
          }
  
          // Return it from the cached list.
          if (!isset(self::$predictionprocessors[$checkisready][$predictionclass])) {
  
              $instance = new $predictionclass();
              if ($checkisready) {
                  $isready = $instance->is_ready();
                  if ($isready !== true) {
                      throw new \moodle_exception('errorprocessornotready', 'analytics', '', $isready);
                  }
              }
              self::$predictionprocessors[$checkisready][$predictionclass] = $instance;
          }
  
          return self::$predictionprocessors[$checkisready][$predictionclass];
      }
code: public static function get_predictions_processor($predictionclass = false, $checkisready = true) {
  
          // We want 0 or 1 so we can use it as an array key for caching.
          $checkisready = intval($checkisready);
  
          if (!$predictionclass) {
              $predictionclass = get_config('analytics', 'predictionsprocessor');
          }
  
          if (empty($predictionclass)) {
              // Use the default one if nothing set.
              $predictionclass = self::default_mlbackend();
          }
  
          if (!class_exists($predictionclass)) {
              throw new \coding_exception('Invalid predictions processor ' . $predictionclass . '.');
          }
  
          $interfaces = class_implements($predictionclass);
          if (empty($interfaces['core_analytics\predictor'])) {
              throw new \coding_exception($predictionclass . ' should implement \core_analytics\predictor.');
          }
  
          // Return it from the cached list.
          if (!isset(self::$predictionprocessors[$checkisready][$predictionclass])) {
  
              $instance = new $predictionclass();
              if ($checkisready) {
                  $isready = $instance->is_ready();
                  if ($isready !== true) {
                      throw new \moodle_exception('errorprocessornotready', 'analytics', '', $isready);
                  }
              }
              self::$predictionprocessors[$checkisready][$predictionclass] = $instance;
          }
  
          return self::$predictionprocessors[$checkisready][$predictionclass];
      }
code_tokens: public static function get_predictions_processor ( $ predictionclass = false , $ checkisready = true ) { // We want 0 or 1 so we can use it as an array key for caching. $ checkisready = intval ( $ checkisready ) ; if ( ! $ predictionclass ) { $ predictionclass = get_config ( 'analytics' , 'predictionsprocessor' ) ; } if ( empty ( $ predictionclass ) ) { // Use the default one if nothing set. $ predictionclass = self :: default_mlbackend ( ) ; } if ( ! class_exists ( $ predictionclass ) ) { throw new \ coding_exception ( 'Invalid predictions processor ' . $ predictionclass . '.' ) ; } $ interfaces = class_implements ( $ predictionclass ) ; if ( empty ( $ interfaces [ 'core_analytics\predictor' ] ) ) { throw new \ coding_exception ( $ predictionclass . ' should implement \core_analytics\predictor.' ) ; } // Return it from the cached list. if ( ! isset ( self :: $ predictionprocessors [ $ checkisready ] [ $ predictionclass ] ) ) { $ instance = new $ predictionclass ( ) ; if ( $ checkisready ) { $ isready = $ instance -> is_ready ( ) ; if ( $ isready !== true ) { throw new \ moodle_exception ( 'errorprocessornotready' , 'analytics' , '' , $ isready ) ; } } self :: $ predictionprocessors [ $ checkisready ] [ $ predictionclass ] = $ instance ; } return self :: $ predictionprocessors [ $ checkisready ] [ $ predictionclass ] ; }
docstring: Returns the provided predictions processor class.
  
  @param false|string $predictionclass Returns the system default processor if false
  @param bool $checkisready
  @return \core_analytics\predictor
docstring_tokens: Returns the provided predictions processor class .