function = $function; $this->columnToFilter = $columnToFilter; $this->filter(); } protected function filter() { foreach($this->table->getRows() as $key => $row) { $columnValue = $row->getColumn($this->columnToFilter); if( $columnValue !== false && !call_user_func( $this->function, $columnValue)) { $this->table->deleteRow($key); } } } }