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

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

            // Also used by {@link total()}.
            'filters' => [
                'orderby' => 'display_name',
            ],
            '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['filters']  = (array) $args['filters'];
        $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 (($users = &$this->cacheKey(__FUNCTION__, $cache_keys)) !== null && !$args['no_cache']) {
            return $users; // Already cached this.
        }
        // Automatically fail if there are too many; when/if desirable.

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

        $WP_User_Query = new \WP_User_Query(array_merge($args['filters'], [
            'fields' => 'all_with_meta', 'offset' => 0, 'paged' => 1, 'number' => -1, 'count_total' => true,
        ]));
        return $users = $WP_User_Query->get_results();
    }
public function all(array $args = []): array
    {
        // Establish args.

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

            // Also used by {@link total()}.
            'filters' => [
                'orderby' => 'display_name',
            ],
            '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['filters']  = (array) $args['filters'];
        $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 (($users = &$this->cacheKey(__FUNCTION__, $cache_keys)) !== null && !$args['no_cache']) {
            return $users; // Already cached this.
        }
        // Automatically fail if there are too many; when/if desirable.

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

        $WP_User_Query = new \WP_User_Query(array_merge($args['filters'], [
            'fields' => 'all_with_meta', 'offset' => 0, 'paged' => 1, 'number' => -1, 'count_total' => true,
        ]));
        return $users = $WP_User_Query->get_results();
    }
public function all ( array $ args = [ ] ) : array { // Establish args. $ default_args = [ // Unique. 'max' => PHP_INT_MAX , 'fail_on_max' => false , // Also used by {@link total()}. 'filters' => [ 'orderby' => 'display_name' , ] , '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 [ 'filters' ] = ( array ) $ args [ 'filters' ] ; $ 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 ( ( $ users = & $ this -> cacheKey ( __FUNCTION__ , $ cache_keys ) ) !== null && ! $ args [ 'no_cache' ] ) { return $ users ; // Already cached this. } // Automatically fail if there are too many; when/if desirable. if ( $ args [ 'fail_on_max' ] && $ this -> total ( $ args ) > $ args [ 'max' ] ) { return $ users = [ ] ; // Fail; too many. } // Return the array of all user objects now. $ WP_User_Query = new \ WP_User_Query ( array_merge ( $ args [ 'filters' ] , [ 'fields' => 'all_with_meta' , 'offset' => 0 , 'paged' => 1 , 'number' => - 1 , 'count_total' => true , ] ) ) ; return $ users = $ WP_User_Query -> get_results ( ) ; }
All users.

@since 160524 User utils.

@param array $args Behavioral args.

@return \WP_User[] Array of users.
All users .