ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Operators.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 enum Operators: string
24 {
25  case ADDITION = '+';
26  case SUBTRACTION = '-';
27  case MULTIPLICATION = '*';
28  case DIVISION = '/';
29  case POWER = '^';
30 
31  public function getPrecedence(): int
32  {
33  return match ($this) {
34  self::ADDITION => 1,
35  self::SUBTRACTION => 1,
36  self::MULTIPLICATION => 2,
37  self::DIVISION => 2,
38  self::POWER => 3,
39  };
40  }
41 }