private function applyFilters(array $settings): void
    {
        $data = $this->getSource();
        $data = array_filter(
            $data,
            function ($row) use ($settings) {
                foreach ($settings as $column => $filters) {
                    foreach ($filters as $filter => $value) {
                        // switch statement for filter
                        switch ($filter) {
                            case Grid\Grid::FILTER_EQ:
                                if ($row[$column] != $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_NE:
                                if ($row[$column] == $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_GT:
                                if ($row[$column] <= $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_GE:
                                if ($row[$column] < $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_LT:
                                if ($row[$column] >= $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_LE:
                                if ($row[$column] > $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_LIKE:
                                if (!preg_match('/' . $value . '/', $row[$column])) {
                                    return false;
                                }
                                break;
                        }
                    }
                }
                return true;
            }
        );
        $this->setSource($data);
    }
private function applyFilters(array $settings): void
    {
        $data = $this->getSource();
        $data = array_filter(
            $data,
            function ($row) use ($settings) {
                foreach ($settings as $column => $filters) {
                    foreach ($filters as $filter => $value) {
                        // switch statement for filter
                        switch ($filter) {
                            case Grid\Grid::FILTER_EQ:
                                if ($row[$column] != $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_NE:
                                if ($row[$column] == $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_GT:
                                if ($row[$column] <= $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_GE:
                                if ($row[$column] < $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_LT:
                                if ($row[$column] >= $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_LE:
                                if ($row[$column] > $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_LIKE:
                                if (!preg_match('/' . $value . '/', $row[$column])) {
                                    return false;
                                }
                                break;
                        }
                    }
                }
                return true;
            }
        );
        $this->setSource($data);
    }
private function applyFilters ( array $ settings ) : void { $ data = $ this -> getSource ( ) ; $ data = array_filter ( $ data , function ( $ row ) use ( $ settings ) { foreach ( $ settings as $ column => $ filters ) { foreach ( $ filters as $ filter => $ value ) { // switch statement for filter switch ( $ filter ) { case Grid \ Grid :: FILTER_EQ : if ( $ row [ $ column ] != $ value ) { return false ; } break ; case Grid \ Grid :: FILTER_NE : if ( $ row [ $ column ] == $ value ) { return false ; } break ; case Grid \ Grid :: FILTER_GT : if ( $ row [ $ column ] <= $ value ) { return false ; } break ; case Grid \ Grid :: FILTER_GE : if ( $ row [ $ column ] < $ value ) { return false ; } break ; case Grid \ Grid :: FILTER_LT : if ( $ row [ $ column ] >= $ value ) { return false ; } break ; case Grid \ Grid :: FILTER_LE : if ( $ row [ $ column ] > $ value ) { return false ; } break ; case Grid \ Grid :: FILTER_LIKE : if ( ! preg_match ( '/' . $ value . '/' , $ row [ $ column ] ) ) { return false ; } break ; } } } return true ; } ) ; $ this -> setSource ( $ data ) ; }
Apply filters to array

@param  array $settings

@return void
@throws Grid\GridException
Apply filters to array