public function all(array $args = []): array
    {
        // Establish args.

        $default_args = [
            // Unique.
            'max'         => PHP_INT_MAX,
            'fail_on_max' => false,

            // Also used by {@link total()}.
            'include'                   => [],
            'exclude'                   => [],
            'exclude_deprecated_levels' => true,
            'no_cache'                  => false,
        ];
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);

        // Unique.
        $args['max']         = max(1, (int) $args['max']);
        $args['fail_on_max'] = (bool) $args['fail_on_max'];

        // Also used by {@link total()}.
        $args['include']                   = (array) $args['include'];
        $args['exclude']                   = (array) $args['exclude'];
        $args['exclude_deprecated_levels'] = (bool) $args['exclude_deprecated_levels'];
        $args['no_cache']                  = (bool) $args['no_cache'];

        // Check cache; already did this query?

        $cache_keys = $args; // Keys to consider when checking the cache.
        unset($cache_keys['no_cache']); // Cache key exclusions.

        if (($caps = &$this->cacheKey(__FUNCTION__, $cache_keys)) !== null && !$args['no_cache']) {
            return $caps; // Already cached this.
        }
        // Automatically fail if there are too many; when/if desirable.

        if ($args['fail_on_max'] && $this->total($args) > $args['max']) {
            return $caps = []; // Fail; too many.
        }
        // Return the array of all caps now.

        $caps = $this->collectAll(); // All possible caps.

        $caps = $args['include'] ? array_intersect_key($caps, array_fill_keys($args['include'], true)) : $caps;
        $caps = $args['exclude'] ? array_diff_key($caps, array_fill_keys($args['exclude'], true)) : $caps;
        $caps = $args['exclude_deprecated_levels'] ? array_diff_key($caps, array_fill_keys($this->deprecated_levels, true)) : $caps;

        asort($caps, SORT_NATURAL); // Sort naturally.

        return $caps;
    }
public function all(array $args = []): array
    {
        // Establish args.

        $default_args = [
            // Unique.
            'max'         => PHP_INT_MAX,
            'fail_on_max' => false,

            // Also used by {@link total()}.
            'include'                   => [],
            'exclude'                   => [],
            'exclude_deprecated_levels' => true,
            'no_cache'                  => false,
        ];
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);

        // Unique.
        $args['max']         = max(1, (int) $args['max']);
        $args['fail_on_max'] = (bool) $args['fail_on_max'];

        // Also used by {@link total()}.
        $args['include']                   = (array) $args['include'];
        $args['exclude']                   = (array) $args['exclude'];
        $args['exclude_deprecated_levels'] = (bool) $args['exclude_deprecated_levels'];
        $args['no_cache']                  = (bool) $args['no_cache'];

        // Check cache; already did this query?

        $cache_keys = $args; // Keys to consider when checking the cache.
        unset($cache_keys['no_cache']); // Cache key exclusions.

        if (($caps = &$this->cacheKey(__FUNCTION__, $cache_keys)) !== null && !$args['no_cache']) {
            return $caps; // Already cached this.
        }
        // Automatically fail if there are too many; when/if desirable.

        if ($args['fail_on_max'] && $this->total($args) > $args['max']) {
            return $caps = []; // Fail; too many.
        }
        // Return the array of all caps now.

        $caps = $this->collectAll(); // All possible caps.

        $caps = $args['include'] ? array_intersect_key($caps, array_fill_keys($args['include'], true)) : $caps;
        $caps = $args['exclude'] ? array_diff_key($caps, array_fill_keys($args['exclude'], true)) : $caps;
        $caps = $args['exclude_deprecated_levels'] ? array_diff_key($caps, array_fill_keys($this->deprecated_levels, true)) : $caps;

        asort($caps, SORT_NATURAL); // Sort naturally.

        return $caps;
    }
public function all ( array $ args = [ ] ) : array { // Establish args. $ default_args = [ // Unique. 'max' => PHP_INT_MAX , 'fail_on_max' => false , // Also used by {@link total()}. 'include' => [ ] , 'exclude' => [ ] , 'exclude_deprecated_levels' => true , 'no_cache' => false , ] ; $ args = array_merge ( $ default_args , $ args ) ; $ args = array_intersect_key ( $ args , $ default_args ) ; // Unique. $ args [ 'max' ] = max ( 1 , ( int ) $ args [ 'max' ] ) ; $ args [ 'fail_on_max' ] = ( bool ) $ args [ 'fail_on_max' ] ; // Also used by {@link total()}. $ args [ 'include' ] = ( array ) $ args [ 'include' ] ; $ args [ 'exclude' ] = ( array ) $ args [ 'exclude' ] ; $ args [ 'exclude_deprecated_levels' ] = ( bool ) $ args [ 'exclude_deprecated_levels' ] ; $ args [ 'no_cache' ] = ( bool ) $ args [ 'no_cache' ] ; // Check cache; already did this query? $ cache_keys = $ args ; // Keys to consider when checking the cache. unset ( $ cache_keys [ 'no_cache' ] ) ; // Cache key exclusions. if ( ( $ caps = & $ this -> cacheKey ( __FUNCTION__ , $ cache_keys ) ) !== null && ! $ args [ 'no_cache' ] ) { return $ caps ; // Already cached this. } // Automatically fail if there are too many; when/if desirable. if ( $ args [ 'fail_on_max' ] && $ this -> total ( $ args ) > $ args [ 'max' ] ) { return $ caps = [ ] ; // Fail; too many. } // Return the array of all caps now. $ caps = $ this -> collectAll ( ) ; // All possible caps. $ caps = $ args [ 'include' ] ? array_intersect_key ( $ caps , array_fill_keys ( $ args [ 'include' ] , true ) ) : $ caps ; $ caps = $ args [ 'exclude' ] ? array_diff_key ( $ caps , array_fill_keys ( $ args [ 'exclude' ] , true ) ) : $ caps ; $ caps = $ args [ 'exclude_deprecated_levels' ] ? array_diff_key ( $ caps , array_fill_keys ( $ this -> deprecated_levels , true ) ) : $ caps ; asort ( $ caps , SORT_NATURAL ) ; // Sort naturally. return $ caps ; }
All caps.

@since 160524 Cap utils.

@param array $args Behavioral args.

@return string[] Array of caps.
All caps .