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
*/
* Get the name of this sql function.
* @return string
*/
- public function getName(): string {
- $className = get_class($this);
- $pos = strrpos($className, 'SqlFunction');
- return substr($className, $pos + 11);
+ public static function getName(): string {
+ $className = static::class;
+ return substr($className, strrpos($className, 'SqlFunction') + 11);
}
/**
return $params;
}
+ /**
+ * @return string
+ */
+ public static function getCategory(): string {
+ return static::$category;
+ }
+
+ /**
+ * @return string
+ */
+ abstract public static function getTitle(): string;
+
}