Perform any translations necessary for the code to work

@param mixed $row array or \Traversable row
@param scalar $key
@return mixed Row array or false when errors occurred
962196
public function translateRowValues($row, $key)
    {
        $row = parent::translateRowValues($row, $key);

        if (! $row) {
            return false;
        }

        // Get the real organization from the provider_id or code if it exists
        if (isset($row[$this->orgIdField], $this->orgTranslations[$row[$this->orgIdField]])) {
            $row[$this->orgIdField] = $this->orgTranslations[$row[$this->orgIdField]];
        }

        if ($this->_skipUnknownPatients && isset($row[$this->patientNrField], $row[$this->orgIdField])) {
            if (! $this->checkPatient($row[$this->patientNrField], $row[$this->orgIdField])) {
                return false;
            }
        }

        $row['track_id']  = $this->getTrackId();
        $row['survey_id'] = $this->_surveyId;
        $row['token']     = strtolower($this->findTokenFor($row));

        return $row;
    }
480908
public function getContents($row)
    {
        if (is_callable($this->options['callable'])) {
            if (is_array($this->options['callable'])) {
                return call_user_func($this->options['callable'], [$row]);
            }

            return $this->options['callable']($row);
        }

        $propertyAccessor = PropertyAccess::createPropertyAccessor();

        try {
            return $propertyAccessor->getValue($row, $this->options['accessor_path']);
        } catch (UnexpectedTypeException $e) {
            return '';
        } catch (NoSuchPropertyException $e) {
            return $e->getMessage();
        }
    }
750865
public function getDbRowAsRowReadyForJSON($row)
    {
        $row4JSON = [
            'id'             => $row['event_id'],
            'name'           => $row['name'],
            'start_datetime' => $row['datetime_start'],
            'location'       => $row['location_place'].', '.$row['location_country'],
            'longitude'      => $row['geocoded_longitude'],
            'latitude'       => $row['geocoded_latitude'],
        ];

        return $row4JSON;
    }
151275
public function toArray($var = null, $key = null, $rows = [], $cb = null) {
        if (!$this->performed) {
            $this->select();
        }
        $rows = is_array($rows) ? $rows : [];
        if (is_array($var)) {
            $rows = $var;
            $var  = null;
        }
        if ($var == null && $key == null) {
            if ($rows) {
                foreach ($rows as $row) {
                    if (is_array($row)) {
                        array_unshift($this->resultSets, $row);
                    }
                }
            }

            return $this->resultSets;
        } else if ($var != null) {
            if ($cb instanceof \Closure) {
                foreach ($this->resultSets as $row) {
                    $value = $row [ $var ];
                    if ($key != null && isset ($row [ $key ])) {
                        $id           = $row [ $key ];
                        $rows [ $id ] = $cb($value, $id);
                    } else {
                        $rows [] = $cb($value);
                    }
                }
            } else {
                foreach ($this->resultSets as $row) {
                    $value = $row [ $var ];
                    if ($key != null && isset ($row [ $key ])) {
                        $id           = $row [ $key ];
                        $rows [ $id ] = $value;
                    } else {
                        $rows [] = $value;
                    }
                }
            }

            return $rows;
        } else if ($key != null) {
            if ($cb instanceof \Closure) {
                foreach ($this->resultSets as $row) {
                    $id           = $row [ $key ];
                    $rows [ $id ] = $cb($row);
                }
            } else {
                foreach ($this->resultSets as $row) {
                    $id           = $row [ $key ];
                    $rows [ $id ] = $row;
                }
            }

            return $rows;
        }

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

        return $this;
    }
1111218
private function getRowColumns($row)
    {
        $columns = range(0, $this->numberOfColumns - 1);
        foreach ($row as $cellKey => $cell) {
            if ($cell instanceof TableCell && $cell->getColspan() > 1) {
                // exclude grouped columns.
                $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
            }
        }

        return $columns;
    }
1308804
public function get($key) {
		$row = $this->db->dal()->from($this->getTable())->where('key', $key)->first();
		if(isset($row['value'])) {
			$res = unserialize($row['value']);
			if(isset($res['_dataType']) && isset($res['input']))
				return $this->types[$res['_dataType']][1]($res['input']);
			else
				return $res;
		}
	}
971873
private function convertColumns(array $row)
    {
        $result = [];

        foreach ($row as $fieldName => $value) {
            if (is_null($value)) {
                $result[$fieldName] = null;
                continue;
            }
            switch($this->columnTypes[$fieldName]) {
                case self::BOOL:
                    $value = is_null($value) ? null : $value == 't';
                    break;
                case self::INTEGER:
                case self::SMALLINT:
                case self::BIGINT:
                    $value = (int) $value;
                    break;
                case self::NUMERIC:
                    $value = (float) $value;
                    break;
                case self::JSON:
                    $value = json_decode($value, true);
                    break;
                case self::HSTORE:
                    $value = self::fromHStore($value);
                    break;
                case self::DATE:
                case self::TIMESTAMP:
                case self::TIMESTAMPTZ:
                    $value = self::fromTimestamp($value);
                    break;
                case self::SMALLINT_ARRAY:
                case self::INTEGER_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : intval($a);
                        }, $value);
                    }
                    break;
                case self::BIGINT_ARRAY:
                case self::NUMERIC_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : doubleval($a);
                        }, $value);
                    }
                    break;
                case self::TEXT_ARRAY:
                case self::VARCHAR_ARRAY:
                case self::CHAR_ARRAY:
                    $value = self::fromArray($value);
                    break;
                case self::HSTORE_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = self::fromHStore($val);
                    }
                    break;
                case self::JSON_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = json_decode($val, true);
                    }
                    break;
                case self::INTERVAL:
                    $value = self::fromInterval($value);
                    break;
            }

            $result[$fieldName] = $value;
        }
        return $result;
    }
1221299
private function translateRow(&$row)
    {
        $new_row = [];

        // Translate incoming data via mapping array.
        foreach ($row as $key => $value) {
            if (array_has($this->config['mapping'], $key)) {
                $new_row[array_get($this->config['mapping'], $key)] = $value;
            }
        }

        // Replace with translated row.
        $row = $new_row;
    }
77691
private function getObjectResult(array $columns, array $row)
    {
        $obj = new \stdClass();
        foreach ($columns as $key => $column) {
            $obj->{$column} = $row[$key];
        }

        return $obj;
    }
567076
public function indexBy(array $data, $key)
    {
        $newData = [];
        foreach ($data as $row) {
            $newData[$row[$key]] = $row;
        }

        return $newData;
    }
388666
public function hasRow($rowKey) : bool
    {
        $this->validateRowKey(__METHOD__, $rowKey);
        $this->loadRows();

        $rowHash = ValueHasher::hash($rowKey);

        return isset($this->rows[$rowHash]);
    }
1139707
public function getRow($rowKey) : TableDataRow
    {
        $this->validateRowKey(__METHOD__, $rowKey);
        $this->loadRows();

        $rowHash = ValueHasher::hash($rowKey);

        if (!isset($this->rows[$rowHash])) {
            throw InvalidArgumentException::format(
                'Invalid row key supplied to %s: expecting one of hashes (%s), value with \'%s\' hash given',
                __METHOD__, Debug::formatValues(array_keys($this->rows)), $rowHash
            );
        }

        return $this->rows[$rowHash];
    }
1171286
protected function transform($row)
    {
        // loop through the object keys and normalize
        $entry = [];

        if (is_object($row) && get_class($row) == 'Cassandra\\Map') {
            /** @var \Cassandra\Map $row */
            $keys = $row->keys();
            $data = [];
            foreach ($keys as $key) {
                $data[(string) $key] = $row->offsetGet($key);
            }
            $row = $data;
        }

        $handlerMap = [
            'Cassandra\\Timestamp' => function ($value) {
                return $this->handleTimestamp($value);
            },
            'Cassandra\\UserTypeValue' => function ($value) {
                return $this->transform($value);
            },
            'Cassandra\\Map' => function ($value) {
                return $this->transform($value);
            },
            'Cassandra\\Set' => function ($value) {
                return $this->transform($value);
            },
        ];

        foreach ($row as $key => $value) {

            // if it's not an object just assign it
            if (!is_object($value)) {
                $entry[$key] = $value;

                continue;
            }

            // it's an object so let's get the class
            $class = get_class($value);

            // it this a Cassandra object?
            if (array_key_exists($class, $handlerMap)) {
                $entry[$key] = $handlerMap[$class];

                continue;
            }

            // it's an object but not a known cassandra object so let
            // the hydrator deal with it.

            $entry[$key] = $value;
        }

        return $entry;
    }
949553
public function decode(string $row): array
    {
        $rows = explode(PHP_EOL, rtrim($row));
        return array_map(function($row) { return json_decode($row, true); }, $rows);
    }
1147788
public function translateRowValues($row, $key)
    {
        $row = parent::translateRowValues($row, $key);

        if (! $row) {
            return false;
        }

        if ((! isset($row['grs_id_user'])) && isset($row['gr2o_patient_nr'], $row['gr2o_id_organization'])) {
            $sql = 'SELECT gr2o_id_user
                    FROM gems__respondent2org
                    WHERE gr2o_patient_nr = ? AND gr2o_id_organization = ?';

            $id = $this->db->fetchOne($sql, array($row['gr2o_patient_nr'], $row['gr2o_id_organization']));

            if ($id) {
                $row['grs_id_user']  = $id;
                $row['gr2o_id_user'] = $id;
            }
        }

        if (empty($row['gr2o_email'])) {
            $row['calc_email'] = 1;
        }

        return $row;
    }
1260327
public function getCurrentOption(Row $row)
	{
		foreach ($this->getOptions() as $option) {
			if ($option->getValue() == $row->getValue($this->getColumn())) {
				return $option;
			}
		}

		return null;
	}