original_string: protected function calculate_raw($expression) {
          try {
              // In older PHP versions this this is a way to validate code passed to eval.
              // The trick came from http://php.net/manual/en/function.eval.php.
              if (@eval('return true; $result = ' . $expression . ';')) {
                  return eval('return ' . $expression . ';');
              }
          } catch (Throwable $e) {
              // PHP7 and later now throws ParseException and friends from eval(),
              // which is much better.
          }
          // In either case of an invalid $expression, we end here.
          throw new moodle_exception('illegalformulasyntax', 'qtype_calculated', '', $expression);
      }
code: protected function calculate_raw($expression) {
          try {
              // In older PHP versions this this is a way to validate code passed to eval.
              // The trick came from http://php.net/manual/en/function.eval.php.
              if (@eval('return true; $result = ' . $expression . ';')) {
                  return eval('return ' . $expression . ';');
              }
          } catch (Throwable $e) {
              // PHP7 and later now throws ParseException and friends from eval(),
              // which is much better.
          }
          // In either case of an invalid $expression, we end here.
          throw new moodle_exception('illegalformulasyntax', 'qtype_calculated', '', $expression);
      }
code_tokens: protected function calculate_raw ( $ expression ) { try { // In older PHP versions this this is a way to validate code passed to eval. // The trick came from http://php.net/manual/en/function.eval.php. if ( @ eval ( 'return true; $result = ' . $ expression . ';' ) ) { return eval ( 'return ' . $ expression . ';' ) ; } } catch ( Throwable $ e ) { // PHP7 and later now throws ParseException and friends from eval(), // which is much better. } // In either case of an invalid $expression, we end here. throw new moodle_exception ( 'illegalformulasyntax' , 'qtype_calculated' , '' , $ expression ) ; }
docstring: Evaluate an expression after the variable values have been substituted.
  @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 after the variable values have been substituted .