src/Policy.php
private function getRules(string $action): array
    {
        $rules = [];
        $parts = explode(self::DELIMITER, $action);

        while (array_pop($parts)) {
            $rules[] = implode(self::DELIMITER, $parts) . self::DELIMITER . self::WILDCARD;
        }

        $rules = array_reverse($rules);
        $rules[0] = trim($rules[0], self::DELIMITER);
        $rules[] = $action;

        return $rules;
    }
private function getRules(string $action): array
    {
        $rules = [];
        $parts = explode(self::DELIMITER, $action);

        while (array_pop($parts)) {
            $rules[] = implode(self::DELIMITER, $parts) . self::DELIMITER . self::WILDCARD;
        }

        $rules = array_reverse($rules);
        $rules[0] = trim($rules[0], self::DELIMITER);
        $rules[] = $action;

        return $rules;
    }
private function getRules ( string $ action ) : array { $ rules = [ ] ; $ parts = explode ( self :: DELIMITER , $ action ) ; while ( array_pop ( $ parts ) ) { $ rules [ ] = implode ( self :: DELIMITER , $ parts ) . self :: DELIMITER . self :: WILDCARD ; } $ rules = array_reverse ( $ rules ) ; $ rules [ 0 ] = trim ( $ rules [ 0 ] , self :: DELIMITER ) ; $ rules [ ] = $ action ; return $ rules ; }
Converts an action with potentially colon delimiters
into a set of permissions to check for.

@example
An action of "acme:blog:command:publish-article" becomes
an array of:
[
'*',
'acme:*',
'acme:blog:*',
'acme:blog:command:*',
'acme:blog:command:publish-article',
]

@param string $action

@return string[]
Converts an action with potentially colon delimiters into a set of permissions to check for .