Control for existing column names in evidence and take data

@param array $data Data to keep

@return int number of records taken
334655
public function takeData($data)
    {
        if ($this->debug === true) {
            $fbRelations = [];
            $fbColumns   = $this->getColumnsInfo();
            foreach ($this->getRelationsInfo() as $relation) {
                if (is_array($relation) && isset($relation['url'])) {
                    $fbRelations[$relation['url']] = $relation['url'];
                }
            }
            if (count($fbColumns)) {
                foreach ($data as $key => $value) {
                    if (!array_key_exists($key, $fbColumns)) {

                        if (!array_key_exists($key, $fbRelations)) {
                            $this->addStatusMessage(sprintf('unknown column %s for evidence %s',
                                    $key, $this->getEvidence()), 'warning');
                        } else {
                            if (!is_array($value)) {
                                $this->addStatusMessage(sprintf('subevidence %s in evidence %s must bee an array',
                                        $key, $this->getEvidence()), 'warning');
                            }
                        }
                    }
                }
            }
        }
        return parent::takeData($data);
    }
535627
protected function prepareDataForEntity(array $data)
    {
        /**
         * @var \Everon\DataMapper\Interfaces\Schema\Column $Column
         */
        foreach ($this->getMapper()->getTable()->getColumns() as $name => $Column) {
            if (array_key_exists($name, $data) === false) {
                if ($Column->isPk()) {
                    $data[$name] = null;
                }
                else if ($Column->isNullable() === false) {
                    throw new Exception\Domain('Missing Entity data: "%s" for "%s"', [$name, $this->getMapper()->getTable()->getName()]);
                }
                
                $data[$name] = null;
            }
            
            $data[$name] = $Column->getColumnDataForEntity($data[$name]);
        }

        return $data;
    }
461988
public function update(array $data)
    {
        $cardId = empty($data['id']) ? 0: (int) $data['id'];
        if ($cardId <= 0) {
            throw new Exception('Required field id');
        }
        $data['cardId'] = $data['id'];
        unset($data['id']);

        if (empty($data['columnId'])) {
            throw new Exception('Required field columnId');
        }

        if (empty($data['oldColumnId'])) {
            throw new Exception('Required field oldColumnId');
        }

        return $this->rest->put("$this->action/$cardId/move", $data);
    }
119202
protected function getLabelFromRecordData(array $data)
    {
        $label = Arrays::getValueByPath($data, $this->labelDataKey);
        if ($label === null) {
            throw new \Exception('Could not determine label from record data (key: ' . $this->labelDataKey . '). See ' . self::class . ' for more information.', 1462968958372);
        }
        return (string)$label;
    }
1326634
public function columnCount()
    {
        if(empty($this->_resultData) || empty($this->_resultData->result)){
            return 0;
        }

        return count(@$this->_resultData->result[0]);
    }
1036926
public static function arrayColumns(array $data)
    {
        // Count the amount of values from the source input
        $count = count($data);

        if ($count === 0) {
            return false;
        }

        if ($count === 1) {
            return array_keys($data[0]);
        }

        if (isset($data[0])) {
            return array_keys($data[0]);
        } else {
            return false;
        }
    }
932160
public function filterColumns(array $data) {
        $testCols = array_fill_keys($this->info(Zend_Db_Table_Abstract::COLS), null);
        $testCols[self::PASSWORD_COLUMN] = null;
        $testCols[self::IMAGE_URL_COLUMN] = null;
        return array_intersect_key($data, $testCols);
    }
911619
public function update(array $data)
    {
        $affected = 0;
        foreach ($this->table->data['data'] as &$rs) {
            if ($this->matchWhere($rs)) {
                $rs = array_merge($rs, $data);
                $affected++;
            }
        }

        if ($affected) {
            $this->table->save();
        }

        return $affected;
    }
105353
protected function getDataByColumn($data, $columns)
    {
        if (is_string($columns)) {
            return array_get($data, $columns);
        }

        if (is_array($columns)) {
            $value = [];
            foreach ($columns as $name => $column) {
                if (!array_has($data, $column)) {
                    continue;
                }
                $value[$name] = array_get($data, $column);
            }

            return $value;
        }
    }
1320353
public function unserialize($data)
    {
        $data = unserialize($data);
        $args = self::parseArray($data);
        $this->__construct($args['name']);

        foreach ($args as $property => $value)
        {
            if (!empty($value))
                $this->set($property, $value);
        }
            
        return $col;
    }
1254770
public function count()
    {
        $select = clone $this->select;
        $select->reset(Select::COLUMNS);
        $select->columns([
            'c' => $this->raw('COUNT(*)')
        ]);
        
        $rows = $this->loadRecords($select);
        if (isset($rows[0]['c'])) {
            return (int)$rows[0]['c'];
        }
        
        return false;
    }
1008998
public function setColumns(array $data)
    {
        unset($this->query['columns']);
        foreach ($data as $field => $value) {
            $this->addColumn($field, $value);
        }
        return $this;
    }
201862
protected function setIdFromData(array $data)
    {
        $key = $this->key();
        if (isset($data[$key])) {
            $this->setId($data[$key]);
            unset($data[$key]);
        }

        return $data;
    }
658906
public function getColumnInfo($column, $evidence = null)
    {
        $columnsInfo = $this->getColumnsInfo(empty($evidence) ? $this->getEvidence()
                : $evidence);
        return (empty($column) || empty($columnsInfo) || !is_array($columnsInfo))
                ? null : array_key_exists($column, $columnsInfo) ? $columnsInfo[$column]
                : null;
    }
765360
public function getColumnsInfo($evidence = null)
    {
        $evidence = is_null($evidence) ? $this->getEvidence() : $evidence;
        if (!array_key_exists($evidence, $this->columnsInfo)) {
            $this->updateColumnsInfo($this->getOfflineColumnsInfo($evidence),
                $evidence);
        }
        return $this->columnsInfo[$evidence];
    }
802549
protected function get(array $data)
    {
        if (!empty($data)) {
            if ($u = \array_pop($data)) {
                foreach ($this->get($data) as $p) {
                    foreach ($u as $v) {
                        yield $p + [\count($p) => $v];
                    }
                }
            }
        } else {
            yield [];
        }
    }
629759
public function fill(array $data)
    {
        foreach ($data as $key => &$row) {
            $this->original = $value = array_get($row, $this->name);

            $value = $this->htmlEntityEncode($value);

            array_set($row, $this->name, $value);

            if ($this->isDefinedColumn()) {
                $this->useDefinedColumn();
            }

            if ($this->hasDisplayCallbacks()) {
                $value = $this->callDisplayCallbacks($this->original, $key);
                array_set($row, $this->name, $value);
            }
        }

        return $data;
    }