Plugin Directory

Changeset 3444861


Ignore:
Timestamp:
01/22/2026 01:16:17 PM (2 months ago)
Author:
whiteshadow
Message:

Minor: Add a rejectKeys() method to the array wrapper.

It works like rejectValues(), except it filters by key instead of by value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin-menu-editor/trunk/includes/ame-collections.php

    r3434592 r3444861  
    169169    }
    170170
     171    public function rejectKeys(callable $callback): self {
     172        $filtered = array_filter($this->array, function ($key) use ($callback) {
     173            return !$callback($key);
     174        }, ARRAY_FILTER_USE_KEY);
     175        return new ArrayWrapper($filtered);
     176    }
     177
    171178    public function implode($separator): string {
    172179        return implode($separator, $this->array);
Note: See TracChangeset for help on using the changeset viewer.