flat the reference array to make it easy for serialize

@param  array $reference reference data
@return array flattered array
@access protected
503522
protected function flatReference(array $reference)/*# : array */
    {
        reset($reference);
        foreach ($reference as $key => $value) {
            if (is_object($value)) {
                $reference[$key] = get_class($value);
            } elseif (is_array($value)) {
                $reference[$key] = $this->flatReference($value);
            }
        }
        ksort($reference);
        return $reference;
    }
1345109
protected function _convertConstraintColumns($references)
    {
        if ($this->_driver->isAutoQuotingEnabled()) {
            if (is_string($references)) {
                return $this->_driver->quoteIdentifier($references);
            }

            return implode(', ', array_map(
                [$this->_driver, 'quoteIdentifier'],
                $references
            ));
        } else {
            if (is_string($references)) {
                return $references;
            }
            return implode(', ', $references);
        }
    }
1349084
public static function getClassName($reference)
    {
        $reference = is_string($reference) ? $reference : ClassLookup::getClass($reference);
        $className = explode('\\', $reference);

        return array_pop($className);
    }
138361
public function flatten(array $array)
    {
        $tmp = array();
        foreach ($array as $a) {
            if (is_array($a)) {
                $tmp = array_merge($tmp, array_flat($a));
            } else {
                $tmp[] = $a;
            }
        }

        return $tmp;
    }
536448
protected function flatten(array $data): array
    {
        $result = [];
        foreach ($data as $key => $value) {
            $item = [
                'label' => $value['label'],
                'inactive' => $value['inactive']
            ];

            $result[$key] = $item;

            if (isset($value['children'])) {
                $result = array_merge($result, $this->flatten($value['children']));
            }
        }

        return $result;
    }
531658
public function flat(array $types = []) {
        if (in_array(get_class($this), $types))
            return [$this];
        $flat = [];
        foreach ($this->children as $c) {
            $flat = array_merge($flat, $c->flat($types));
        }
        return $flat;
    }
721282
public static function flatten (array $sequence)
    {
        $flat = array();
        array_walk_recursive($sequence, function ($element) use (&$flat) { $flat []= $element; });
        return $flat;
    }
900150
protected function renderReference($reference)
    {
        if (!isset($this->settings['references'][$reference])) {
            $this->outputLine('Reference "%s" is not configured', [$reference]);
            $this->quit(1);
        }
        $referenceConfiguration = $this->settings['references'][$reference];
        $affectedClassNames = $this->getAffectedClassNames($referenceConfiguration['affectedClasses']);
        $parserClassName = $referenceConfiguration['parser']['implementationClassName'];
        $parserOptions = isset($referenceConfiguration['parser']['options']) ? $referenceConfiguration['parser']['options'] : [];
        /** @var $classParser \Neos\DocTools\Domain\Service\AbstractClassParser */
        $classParser = new $parserClassName($parserOptions);
        $classReferences = [];
        foreach ($affectedClassNames as $className) {
            $classReferences[$className] = $classParser->parse($className);
        }
        usort($classReferences, function (ClassReference $a, ClassReference $b) {
            if ($a->getTitle() == $b->getTitle()) {
                return 0;
            }

            return ($a->getTitle() < $b->getTitle()) ? -1 : 1;
        });
        $standaloneView = new \Neos\FluidAdaptor\View\StandaloneView();
        $templatePathAndFilename = isset($referenceConfiguration['templatePathAndFilename']) ? $referenceConfiguration['templatePathAndFilename'] : 'resource://Neos.DocTools/Private/Templates/ClassReferenceTemplate.txt';
        $standaloneView->setTemplatePathAndFilename($templatePathAndFilename);
        $standaloneView->assign('title', isset($referenceConfiguration['title']) ? $referenceConfiguration['title'] : $reference);
        $standaloneView->assign('classReferences', $classReferences);
        file_put_contents($referenceConfiguration['savePathAndFilename'], $standaloneView->render());
        $this->outputLine('DONE.');
    }
465700
protected function flattenArray(array $array, $separator = null)
    {
        $flattened = array();

        if (is_null($separator)) {
            $separator = $this->separator;
        }

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $flattened = array_merge($flattened, $this->flattenArray($value, $key.$separator));
            } else {
                $flattened[trim($separator.$key, $this->separator)] = $value;
            }
        }

        return $flattened;
    }
807871
public function getReferences(): array
    {
        if (empty($this->parent)) {
            throw new NodeException("Unable to aggregate reference values, parent is missing");
        }

        if (empty($this->parent->references[$this->outerKey])) {
            return [];
        }

        return array_keys($this->parent->references[$this->outerKey]);
    }
764114
public function addReferenceCache($reference)
    {
        $cache = $this->getMandango()->getCache();

        foreach ($this->getQueryHashes() as $hash) {
            $value = $cache->has($hash) ? $cache->get($hash) : array();
            if (!isset($value['references']) || !in_array($reference, $value['references'])) {
                $value['references'][] = $reference;
                $cache->set($hash, $value);
            }
        }
    }
493511
public function resolveMany(array $references)
    {
        $convertedParameters = array();

        foreach ($references as $reference) {
            $convertedValue = $this->resolve($reference);
            $convertedParameters[] = $convertedValue;
        }

        return $convertedParameters;
    }
389315
private function resolve(Reference $reference, $class)
    {
        $result = $reference;

        do {
            $refString = (string) $reference->getMergedUri();
            $result = $result->resolve(function ($data) use ($result, $class) {
                return $this->denormalizer->denormalize($data, $class, 'json', [
                    'document-origin' => (string) $result->getMergedUri()->withFragment(''),
                ]);
            });
        } while ($result instanceof Reference);

        return [$refString, $result];
    }
952713
public function expandArrayProperties($array, $reference_array = [])
    {
        $data = new Data($array);
        if ($reference_array) {
            $reference_data = new Data($reference_array);
            $this->doExpandArrayProperties($data, $array, '', $reference_data);
        } else {
            $this->doExpandArrayProperties($data, $array);
        }

        return $data->export();
    }
1066940
public function flatten($column) {
        $out = array();
        foreach ($this as $row) {
            $out[] = $row->flatten($column);
        }
        return $out;
    }
977489
public function setHead($reference)
    {
        if ($reference instanceof Reference) {
            $this->head = $reference;
        } elseif (is_array($reference)) {
            list ($name, $type) = $reference;
            $this->head = new Reference($name, $type);
        }

        return $this;
    }
405386
public function prune($reference = null)
    {
        if ($reference) {
            $this->addUsingAlias(ReferenceTableMap::COL_ID, $reference->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }