Skip to content

Commit

Permalink
MDL-57791 analytics: Add missing 'new' to throw
Browse files Browse the repository at this point in the history
Also other code refinements. Credit to Mark Nelson.
  • Loading branch information
David Monllao committed Jul 24, 2017
1 parent 2db6e98 commit 08015e1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion analytics/classes/calculable.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ protected function classify_value($value, $ranges) {
$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.');
}

Expand Down
4 changes: 2 additions & 2 deletions analytics/classes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function check_can_list_insights(\context $context) {
*
* @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) {
Expand Down Expand Up @@ -163,7 +163,7 @@ public static function get_predictions_processor($predictionclass = false, $chec
/**
* Return all system predictions processors.
*
* @return \core_analytics\predictor
* @return \core_analytics\predictor[]
*/
public static function get_all_prediction_processors() {

Expand Down
3 changes: 1 addition & 2 deletions analytics/classes/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public function is_available() {
if (!$target) {
return false;
}
$analyser = $this->get_target();

$classname = $target->get_analyser_class();
if (!class_exists($classname)) {
Expand Down Expand Up @@ -296,7 +295,7 @@ protected function init_analyser($options = array()) {

$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.
Expand Down

0 comments on commit 08015e1

Please sign in to comment.