Merge pull request #18548 from civicrm/5.30
[civicrm-core.git] / Civi / Api4 / Query / SqlFunction.php
index 19753d91acfa4f73e5b15b10d68a8e5eb073aeca..dbc245f7bfc40dfd5e3ed0c5e6dbc74a47614b75 100644 (file)
@@ -22,6 +22,19 @@ abstract class SqlFunction extends SqlExpression {
 
   protected $args = [];
 
+  /**
+   * Used for categorizing functions in the UI
+   *
+   * @var string
+   */
+  protected static $category;
+
+  const CATEGORY_AGGREGATE = 'aggregate',
+    CATEGORY_COMPARISON = 'comparison',
+    CATEGORY_DATE = 'date',
+    CATEGORY_MATH = 'math',
+    CATEGORY_STRING = 'string';
+
   /**
    * Parse the argument string into an array of function arguments
    */
@@ -186,4 +199,16 @@ abstract class SqlFunction extends SqlExpression {
     return $params;
   }
 
+  /**
+   * @return string
+   */
+  public static function getCategory(): string {
+    return static::$category;
+  }
+
+  /**
+   * @return string
+   */
+  abstract public static function getTitle(): string;
+
 }