protected function filterData(callable $matcher, $offset=0, $limit=null)
    {
        $filtered = [];

        $i=-1;
        $added = 0;

        foreach ($this->getData() as $item) {

            if (!$matcher($item)) {
                continue;
            }

            $i++;

            if ($i < $offset) {
                continue;
            }

            $filtered[] = $item;
            $added++;

            if ($limit !== null && $added >= $limit) {
                return $filtered;
            }

        }

        return $filtered;

    }
protected function filterData(callable $matcher, $offset=0, $limit=null)
    {
        $filtered = [];

        $i=-1;
        $added = 0;

        foreach ($this->getData() as $item) {

            if (!$matcher($item)) {
                continue;
            }

            $i++;

            if ($i < $offset) {
                continue;
            }

            $filtered[] = $item;
            $added++;

            if ($limit !== null && $added >= $limit) {
                return $filtered;
            }

        }

        return $filtered;

    }
protected function filterData ( callable $ matcher , $ offset = 0 , $ limit = null ) { $ filtered = [ ] ; $ i = - 1 ; $ added = 0 ; foreach ( $ this -> getData ( ) as $ item ) { if ( ! $ matcher ( $ item ) ) { continue ; } $ i ++ ; if ( $ i < $ offset ) { continue ; } $ filtered [ ] = $ item ; $ added ++ ; if ( $ limit !== null && $ added >= $ limit ) { return $ filtered ; } } return $ filtered ; }
Filter the data and optionally slice it.

@param callable $matcher
@param int      $offset (optional)
@param int      $limit (optional)

@return array
Filter the data and optionally slice it .