public function filterHashCondition(array $data, $condition)
    {
        foreach ($condition as $column => $value) {
            if (is_array($value)) {
                // IN condition
                $data = $this->filterInCondition($data, 'IN', [$column, $value]);
            } else {
                $data = array_filter($data, function ($row) use ($column, $value) {
                    if ($value instanceof \Closure) {
                        return call_user_func($value, $row[$column]);
                    }

                    return $row[$column] == $value;
                });
            }
        }

        return $data;
    }
public function filterHashCondition(array $data, $condition)
    {
        foreach ($condition as $column => $value) {
            if (is_array($value)) {
                // IN condition
                $data = $this->filterInCondition($data, 'IN', [$column, $value]);
            } else {
                $data = array_filter($data, function ($row) use ($column, $value) {
                    if ($value instanceof \Closure) {
                        return call_user_func($value, $row[$column]);
                    }

                    return $row[$column] == $value;
                });
            }
        }

        return $data;
    }
public function filterHashCondition ( array $ data , $ condition ) { foreach ( $ condition as $ column => $ value ) { if ( is_array ( $ value ) ) { // IN condition $ data = $ this -> filterInCondition ( $ data , 'IN' , [ $ column , $ value ] ) ; } else { $ data = array_filter ( $ data , function ( $ row ) use ( $ column , $ value ) { if ( $ value instanceof \ Closure ) { return call_user_func ( $ value , $ row [ $ column ] ) ; } return $ row [ $ column ] == $ value ; } ) ; } } return $ data ; }
Applies a condition based on column-value pairs.

@param array $data data to be filtered
@param array $condition the condition specification

@return array filtered data
Applies a condition based on column - value pairs .