MDL-57791 analytics: Add missing 'new' to throw

Also other code refinements. Credit to Mark Nelson.
This commit is contained in:
David Monllao
2017-07-24 08:37:01 +02:00
parent 2db6e9811b
commit 08015e1895
3 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -208,7 +208,7 @@ abstract class calculable {
$match = false;
if (count($range) != 2) {
throw \coding_exception('classify_value() $ranges array param should contain 2 items, the predicate ' .
throw new \coding_exception('classify_value() $ranges array param should contain 2 items, the predicate ' .
'e.g. greater (gt), lower or equal (le)... and the value.');
}
+2 -2
View File
@@ -76,7 +76,7 @@ class manager {
*
* @param bool $enabled
* @param bool $trained
* @param \context $predictioncontext
* @param \context|false $predictioncontext
* @return \core_analytics\model[]
*/
public static function get_all_models($enabled = false, $trained = false, $predictioncontext = false) {
@@ -163,7 +163,7 @@ class manager {
/**
* Return all system predictions processors.
*
* @return \core_analytics\predictor
* @return \core_analytics\predictor[]
*/
public static function get_all_prediction_processors() {
+1 -2
View File
@@ -145,7 +145,6 @@ class model {
if (!$target) {
return false;
}
$analyser = $this->get_target();
$classname = $target->get_analyser_class();
if (!class_exists($classname)) {
@@ -296,7 +295,7 @@ class model {
$classname = $target->get_analyser_class();
if (!class_exists($classname)) {
throw \coding_exception($classname . ' class does not exists');
throw new \coding_exception($classname . ' class does not exists');
}
// Returns a \core_analytics\local\analyser\base class.