* Sets the name of/filter for the name(s) of the shown acl option categories and
* returns this field.
*
+ * The category name supports a `.*` suffix for filtering by multiple categories,
+ * so that `user.*` matches all acl option categories beginning with `user.`, for example.
+ *
* @param string $categoryName name of/filter for the acl option categories
* @return static $this this field
*
*/
public function categoryName($categoryName)
{
- if (!\is_string($categoryName) || !\preg_match('~^[A-z0-9\-\_]+(\.[A-z0-9\-\_]+)+$~', $categoryName)) {
+ if (
+ !\is_string($categoryName)
+ || !\preg_match('~^[A-z0-9\-\_]+((\.[A-z0-9\-\_]+)+|(\.[A-z0-9\-\_]+)*?\.\*)$~', $categoryName)
+ ) {
throw new \InvalidArgumentException("Invalid category name given for field '{$this->getId()}'.");
}