src/ORM/ArrayList.php
public function filter()
    {

        $keepUs = call_user_func_array([$this, 'normaliseFilterArgs'], func_get_args());

        $itemsToKeep = [];
        foreach ($this->items as $item) {
            $keepItem = true;
            foreach ($keepUs as $column => $value) {
                if ((is_array($value) && !in_array($this->extractValue($item, $column), $value))
                    || (!is_array($value) && $this->extractValue($item, $column) != $value)
                ) {
                    $keepItem = false;
                    break;
                }
            }
            if ($keepItem) {
                $itemsToKeep[] = $item;
            }
        }

        $list = clone $this;
        $list->items = $itemsToKeep;
        return $list;
    }
public function filter()
    {

        $keepUs = call_user_func_array([$this, 'normaliseFilterArgs'], func_get_args());

        $itemsToKeep = [];
        foreach ($this->items as $item) {
            $keepItem = true;
            foreach ($keepUs as $column => $value) {
                if ((is_array($value) && !in_array($this->extractValue($item, $column), $value))
                    || (!is_array($value) && $this->extractValue($item, $column) != $value)
                ) {
                    $keepItem = false;
                    break;
                }
            }
            if ($keepItem) {
                $itemsToKeep[] = $item;
            }
        }

        $list = clone $this;
        $list->items = $itemsToKeep;
        return $list;
    }
public function filter ( ) { $ keepUs = call_user_func_array ( [ $ this , 'normaliseFilterArgs' ] , func_get_args ( ) ) ; $ itemsToKeep = [ ] ; foreach ( $ this -> items as $ item ) { $ keepItem = true ; foreach ( $ keepUs as $ column => $ value ) { if ( ( is_array ( $ value ) && ! in_array ( $ this -> extractValue ( $ item , $ column ) , $ value ) ) || ( ! is_array ( $ value ) && $ this -> extractValue ( $ item , $ column ) != $ value ) ) { $ keepItem = false ; break ; } } if ( $ keepItem ) { $ itemsToKeep [ ] = $ item ; } } $ list = clone $ this ; $ list -> items = $ itemsToKeep ; return $ list ; }
Filter the list to include items with these charactaristics

@return ArrayList
@see SS_List::filter()
@example $list->filter('Name', 'bob'); // only bob in the list
@example $list->filter('Name', array('aziz', 'bob'); // aziz and bob in list
@example $list->filter(array('Name'=>'bob, 'Age'=>21)); // bob with the Age 21 in list
@example $list->filter(array('Name'=>'bob, 'Age'=>array(21, 43))); // bob with the Age 21 or 43
@example $list->filter(array('Name'=>array('aziz','bob'), 'Age'=>array(21, 43)));
// aziz with the age 21 or 43 and bob with the Age 21 or 43
Filter the list to include items with these charactaristics