original_string: public function calculate($expression) {
          // Make sure no malicious code is present in the expression. Refer MDL-46148 for details.
          if ($error = qtype_calculated_find_formula_errors($expression)) {
              throw new moodle_exception('illegalformulasyntax', 'qtype_calculated', '', $error);
          }
          $expression = $this->substitute_values_for_eval($expression);
          if ($datasets = question_bank::get_qtype('calculated')->find_dataset_names($expression)) {
              // Some placeholders were not substituted.
              throw new moodle_exception('illegalformulasyntax', 'qtype_calculated', '',
                  '{' . reset($datasets) . '}');
          }
          return $this->calculate_raw($expression);
      }
code: public function calculate($expression) {
          // Make sure no malicious code is present in the expression. Refer MDL-46148 for details.
          if ($error = qtype_calculated_find_formula_errors($expression)) {
              throw new moodle_exception('illegalformulasyntax', 'qtype_calculated', '', $error);
          }
          $expression = $this->substitute_values_for_eval($expression);
          if ($datasets = question_bank::get_qtype('calculated')->find_dataset_names($expression)) {
              // Some placeholders were not substituted.
              throw new moodle_exception('illegalformulasyntax', 'qtype_calculated', '',
                  '{' . reset($datasets) . '}');
          }
          return $this->calculate_raw($expression);
      }
code_tokens: public function calculate ( $ expression ) { // Make sure no malicious code is present in the expression. Refer MDL-46148 for details. if ( $ error = qtype_calculated_find_formula_errors ( $ expression ) ) { throw new moodle_exception ( 'illegalformulasyntax' , 'qtype_calculated' , '' , $ error ) ; } $ expression = $ this -> substitute_values_for_eval ( $ expression ) ; if ( $ datasets = question_bank :: get_qtype ( 'calculated' ) -> find_dataset_names ( $ expression ) ) { // Some placeholders were not substituted. throw new moodle_exception ( 'illegalformulasyntax' , 'qtype_calculated' , '' , '{' . reset ( $ datasets ) . '}' ) ; } return $ this -> calculate_raw ( $ expression ) ; }
docstring: Evaluate an expression using the variable values.
  @param string $expression the expression. A PHP expression with placeholders
  like {a} for where the variables need to go.
  @return float the computed result.
docstring_tokens: Evaluate an expression using the variable values .