Removes all columns leaving only target one

@param array $row Current row
@param string $target Current column name
@return array
495965
private function leaveOnlyCurrent(array $row, $target)
    {
        $result = array();

        foreach ($row as $column => $value) {
            if ($column != $target) {
                $result[$column] = $value;
            }
        }

        return $result;
    }
357387
public function filterRow(array $condition)
	{
		$this->onBeforeFilter($this->data_source);
		$this->onAfterFilter($this->data_source);

		return $this->data_source->filterOne($condition)->getData();
	}
1316818
public function filterSubTable(Row $row)
    {
        if (!$this->enableRecursive) {
            return;
        }
        $subTable = $row->getSubtable();
        if ($subTable) {
            $this->filter($subTable);
        }
    }
777403
protected function collectDoubledColumns(array $row)
    {
        $foundNames = [];
        $doubledColumns = [];

        foreach ($row as $column) {

            if (isset($foundNames[$column])) {
                $doubledColumns[] = $column;
            }
            $foundNames[$column] = true;
        }

        return $doubledColumns;
    }
43746
private function prepareColumnValues($tableName, $row)
    {
        $ret = array();
        $columnTypes = $this->tableColumnTypes[$tableName];
        foreach ($row as $colName => $colValue) {
            $colValue = $this->hookTransformColumnValue($tableName, $colName, $colValue, $row);
            $ret[] = $this->escape($colValue, $columnTypes[$colName]);
        }

        return $ret;
    }
1112692
protected function isAllHeadingValuesPresentInRow(?array $row){

        if (true === empty($row)) {
            return false;
        }

        foreach($this->targettedHeadingValues as $headerValue){

            if (false === in_array(trim($headerValue), $row)) {
                //print($headerValue . ' not in ' . print_r($row,true));
                return false;
            }

        }

        return true;
    }
344731
protected function rowHasMessage($row)
    {
        $has_message = false;

        foreach ($this->columns as $column) {
            if ($column->hasMessage($row)) {
                $has_message = true;
                break;
            }
        }

        if (!$has_message) {
            foreach ($this->spanning_columns as $column) {
                if ($column->hasMessage($row)) {
                    $has_message = true;
                    break;
                }
            }
        }

        return $has_message;
    }
1267926
public function delete(DatabaseRowInterface $row)
    {
        // Create query object.
        $query = $this->getObject('lib:database.query.delete')
            ->table($this->getBase());

        //Create commandchain context
        $context = $this->getContext();
        $context->table     = $this->getBase();
        $context->data      = $row;
        $context->query     = $query;
        $context->affected  = false;

        if ($this->invokeCommand('before.delete', $context) !== false)
        {
            foreach ($this->getPrimaryKey() as $key => $column)
            {
                $context->query->where($column->name . ' = :' . $column->name)
                    ->bind(array($column->name => $context->data->$key));
            }

            // Execute the delete query.
            $context->affected = $this->getDriver()->delete($context->query);

            // Set the query in the context.
            if ($context->affected !== false) {
                $context->data->setStatus($context->affected ? Database::STATUS_DELETED : Database::STATUS_FAILED);
            }

            $this->invokeCommand('after.delete', $context);
        }

        return $context->affected;
    }
82604
public function process(array $row)
    {
        foreach ($row as &$item) {
            if (is_bool($item)) {
                $item = $item ? 1 : 0;
            }
        }

        return $row;
    }
1131771
public function replaceRows(array $rows): array
    {
        if (null === $this->data) {
            $this->buildIndex();
        }

        $list = [];
        foreach ($rows as $key => $row) {
            if (strpos($key, '@@')) {
                $key = $this->getNewKey();
            }
            $this->data[$key] = $list[$key] = $row;
        }

        if ($list) {
            $this->save();
        }

        return $list;
    }
776187
public function destroy($table, $row_id) {
		$table = config('center.tables.' . $table);

		# Security
		if (!isset($table->name)) {
			return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));
		}

		DB::table($table->name)->where('id', $row_id)->delete();

		return Redirect::to(Trail::last(action('\LeftRight\Center\Controllers\RowController@index', $table->name)));
	}
318402
public function reset( $row = null ) {

		$row = pods_absint( $row );

		$this->row = false;

		if ( isset( $this->data[ $row ] ) ) {
			$this->row = get_object_vars( $this->data[ $row ] );
		}

		if ( empty( $row ) ) {
			$this->row_number = - 1;
		} else {
			$this->row_number = $row - 1;
		}

		return $this->row;
	}
598912
public function other_cols($column, $row) {
        if (preg_match('/^val(\d+)$/', $column, $matches)) {
            $items = $this->feedbackstructure->get_items();
            $itemobj = feedback_get_item_class($items[$matches[1]]->typ);
            return trim($itemobj->get_printval($items[$matches[1]], (object) ['value' => $row->$column] ));
        }
        return $row->$column;
    }
534997
protected function filterRowsKeysByFunction($rows, $function)
    {
        if (empty($rows)) {
            return [];
        }

        $strKeyEmptyArray = array_flip(array_filter(array_keys($rows[0]), $function));

        return array_map(function ($row) use ($strKeyEmptyArray) {
            return array_intersect_key($row, $strKeyEmptyArray);
        }, $rows);
    }
915984
public function removeRow($key)
    {
        if (array_key_exists($key, $this->rows)) {
            unset($this->rows[$key]);
        }

        return $this;
    }
1208397
protected function guessHeader(array $row)
    {
        $containsOnlyColumnNames = $this->containsOnlyColumnNames($row);
        $columnsAreUnique = $this->columnsAreUnique($row);

        if ($containsOnlyColumnNames && $columnsAreUnique) {
            return $row;
        }

        if (!$this->getOption(self::FORCE_HEADER_LINE)) {
            return range(0, count($row)-1);
        }

        if (!$containsOnlyColumnNames) {
            $hint = implode(', ', $this->collectInvalidColumns($row));
            throw new DetectionFailedException("No header found because the following columns do not like a column name: [$hint]");
        }

        // !$columnsAreUnique)
        $hint = implode(', ', $this->collectDoubledColumns($row));
        throw new DetectionFailedException("No header found because the following columns occurs more than once: [$hint]");

    }
671624
protected function editColumns($data, $row)
    {
        foreach ($this->editColumns as $key => $value) {
            $value['content'] = Helper::compileContent($value['content'], $data, $row);
            Arr::set($data, $value['name'], $value['content']);
        }

        return $data;
    }