scopes ) { return true; } foreach ( $agent->scopes as $scope ) { if ( $scope === $action->action_cat ) { return true; } if ( null === $action->ability_name ) { continue; } if ( str_ends_with( $scope, '*' ) ) { if ( str_starts_with( $action->ability_name, substr( $scope, 0, -1 ) ) ) { return true; } } elseif ( $scope === $action->ability_name ) { return true; } } return false; } }