converts the data into a key/value store array

@param $keyGetter
@param $valueGetter

@return array
@throws \Justimmo\Exception\MethodNotFoundException
343270
public function toKeyValue($keyGetter, $valueGetter)
    {
        $return = array();
        foreach ($this as $value) {
            if (!method_exists($value, $keyGetter)) {
                throw new MethodNotFoundException('Method ' . $keyGetter . ' not found on ' . get_class($value));
            }
            if (!method_exists($value, $valueGetter)) {
                throw new MethodNotFoundException('Method ' . $valueGetter . ' not found on ' . get_class($value));
            }
            $return[$value->$keyGetter()] = $value->$valueGetter();
        }

        return $return;
    }
1317466
private function prepareGetterParams($getter_params, $user, $resource)
    {
        if (empty($getter_params)) {
            return [];
        }
        $values = [];
        foreach ($getter_params as $getter_name=>$params) {
            foreach ($params as $param) {
                if ('@' !== $param[ 'param_name' ][ 0 ]) {
                    $values[$getter_name][] = $param[ 'param_value' ];
                } else {
                    $values[$getter_name][] = $this->attributeManager->retrieveAttribute($this->attributeManager->getAttribute($param[ 'param_value' ]), $user, $resource);
                }
            }
        }
        return $values;
    }
19861
public function extractKeys() {
    if (!$this->hasScalarKeys()) {
      throw new \DomainException('Cannot extract non-scalar keys from array lookup ' . $this);
    }
    return array_map(function(ScalarNode $key) { return $key->toValue(); }, $this->getKeys());
  }
1130090
public function setGet($key, $value = null)
    {
        if (is_array($key)) {
            $this->get = array_merge($this->get, $key);
        } else {
            $this->get[$key] = $value;
        }
    }
376159
public function toArray( callable $valueConverter = null ): array {
		return [
			'type' => $this->getType(),
			'newvalue' => $this->objectToArray( $this->newValue, $valueConverter ),
		];
	}
1279802
public function getFlexformSectionsRecursively($dataArr, $valueKey = 'vDEF')
    {
        $out = [];
        foreach ($dataArr as $k => $el) {
            if (is_array($el) && is_array($el['el'])) {
                $out[$k] = $this->getFlexformSectionsRecursively($el['el']);
            } elseif (is_array($el) && is_array($el['data']['el'])) {
                $out[] = $this->getFlexformSectionsRecursively($el['data']['el']);
            } elseif (isset($el[$valueKey])) {
                $out[$k] = $el[$valueKey];
            }
        }

        return $out;
    }
914924
public static function forMap(callable $keySelector = null, callable $valueSelector = null): self
    {
        $selectKey   = (null !== $keySelector) ? $keySelector : function($value, $key) { return $key; };
        $selectValue = (null !== $valueSelector) ? $valueSelector : function($value) { return $value; };
        return new self(
                function() { return []; },
                function(&$map, $element, $key) use($selectKey, $selectValue)
                {
                    $map[$selectKey($element, $key)] = $selectValue($element, $key);
                }
        );
    }
782585
public static function gets(array &$data, array $needKeys = [], $unsetKey = false): array
    {
        $needed = [];

        foreach ($needKeys as $key => $default) {
            if (\is_int($key)) {
                $key = $default;
                $default = null;
            }

            if (isset($data[$key])) {
                $value = $data[$key];

                if (\is_int($default)) {
                    $value = (int)$value;
                } elseif (\is_string($default)) {
                    $value = \trim($value);
                } elseif (\is_array($default)) {
                    $value = (array)$value;
                }

                $needed[$key] = $value;

                if ($unsetKey) {
                    unset($data[$key]);
                }
            } else {
                $needed[$key] = $default;
            }
        }

        return $needed;
    }
890413
public function pairs($keyField, $valueField) {
		$result = $this->find();
		$ret = array();
		foreach ($result as $item) {
			if ($keyField == null || !isset($item->$valueField)) {
				$ret[] = $item->$valueField;
			} else {
				$key = $item->$keyField;
				$val = $item->$valueField;
				$ret[$key] = $val;
			}
			
		}
		return $ret;
	}
908883
public static function each($value, AbstractValidator $valueValidator, AbstractValidator $keyValidator = null)
    {
        $isValid = true;

        foreach ($value as $key => $data) {
            if ($keyValidator instanceof AbstractValidator) {
                $isValid = $isValid && $keyValidator->validate($key);
            }

            $isValid = $isValid && $valueValidator->validate($data);
        }

        return $isValid;
    }
765713
public function readMap($keyType, $valueType) {
		$map = array();
		$count = $this->readShort();
		for ($i = 0; $i < $count; ++$i) {
			$map[$this->readByType($keyType, true)] = $this->readByType($valueType, true);
		}
		return $map;
	}
749708
public function sameValueAs(ValueObjectInterface $keyValuePair)
    {
        if (false === Util::classEquals($this, $keyValuePair)) {
            return false;
        }

        return $this->getKey()->sameValueAs($keyValuePair->getKey()) && $this->getValue()->sameValueAs($keyValuePair->getValue());
    }
24230
private function parseGetter(string $getterStub, array $fieldInfo)
    {
        $property      = $fieldInfo['name'];
        $comment       = $fieldInfo['column_comment'];
        $primaryKey    = $fieldInfo['key'] === 'PRI';
        $aliasProperty = StringHelper::camel($property);
        $this->checkAliasProperty($aliasProperty);
        $function   = StringHelper::camel($aliasProperty);
        $function   = 'get' . ucfirst($function);
        $default    = $fieldInfo['default'] ?? '';
        $returnType = $this->schema->phpMap[$fieldInfo['type']] ?? 'mixed';

        $this->getterStub .= PHP_EOL . str_replace([
                "{{comment}}\n",
                '{{function}}',
                '{{attribute}}',
                '{{coReturnType}}',
                '{{returnType}}',
            ], [
                !empty($comment) ? "     * {$comment}\n" : '',
                $function,
                $aliasProperty,
                $returnType !== 'mixed' && !$primaryKey && !in_array(strtolower($default), ['\'\'', '""', 'null']) && empty($default) ? $returnType : 'mixed',
                '',
            ], $getterStub);
    }
80121
public static function groupByColumn(array $array, $keyColumn, $valueColumn = null): array
    {
        $result = [];

        foreach ($array as $item) {
            if (!isset($item[$keyColumn])) {
                continue;
            }

            $key = $item[$keyColumn];
            if (!isset($result[$key])) {
                $result[$key] = [];
            }

            if (null !== $valueColumn) {
                $result[$key][] = $item[$valueColumn];
            } else {
                $result[$key][] = $item;
            }
        }

        return $result;
    }
8019
public static function toKeysArray(ResultIterator $iterator)
    {
        $keys = array();
        foreach ($iterator as $result) {
            $keys[] = $result->getKey();
            
        }
        return $keys;
    }
325913
protected function getKeyList($columnName, $keyValue, array $keyList)
    {
        if ($keyValue === true) {
            $tableIndexName = SchemaUtils::generateIndexName($columnName);
            $keyList[$tableIndexName] = array($columnName);
        } else if (is_string($keyValue)) {
            $tableIndexName = SchemaUtils::generateIndexName($keyValue);
            $keyList[$tableIndexName][] = $columnName;
        }

        return $keyList;
    }
819074
protected function cached(string $key, Closure $dataGetter)
    {
        if ($this->cacheRepository->has($key)) {
            return $this->cacheRepository->get($key);
        }
        $result = $dataGetter();
        $this->cacheRepository->put($key, $result, $this->cacheTimeout);
        return $result;
    }