Return all mappings

@return array with assoc array containing: generatedLine, generatedColumn, originalSource, originalLine, originalColumn, originalName
484970
public function getMappings()
    {
        if (isset($this->_mappings)) {
            return $this->_mappings;
        }

        $this->_mappings = array();

        $generatedLine = 1;
        $previousGeneratedColumn = 0;
        $previousOriginalLine = 0;
        $previousOriginalColumn = 0;
        $previousSource = 0;
        $previousName = 0;

        $str = $this->_map->mappings;
        $end = strlen($str);
        $pos = 0;

        while ($pos < $end) {
            if ($str[$pos] === ';') {
                $generatedLine++;
                $pos++;
                $previousGeneratedColumn = 0;
            } else if ($str[$pos] === ',') {
                $pos++;
            } else {
                $mapping = array();
                $mapping['generatedLine'] = $generatedLine;

                // Generated column.
                $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                $mapping['generatedColumn'] = $previousGeneratedColumn + $value;
                $previousGeneratedColumn = $mapping['generatedColumn'];

                if ($pos < $end && !($str[$pos]==',' || $str[$pos]==';')) {
                    // Original source.
                    $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                    $mapping['originalSource'] = (isset($this->_map->sourceRoot) ? $this->_map->sourceRoot.'/' : '')
                                                  . $this->_map->sources[$previousSource + $value];
                    $previousSource += $value;
                    if ($pos >= $end || ($str[$pos]==',' || $str[$pos]==';')) {
                        throw new Exception('Found a source, but no line and column');
                    }

                    // Original line.
                    $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                    $mapping['originalLine'] = $previousOriginalLine + $value;
                    $previousOriginalLine = $mapping['originalLine'];
                    // Lines are stored 0-based
                    $mapping['originalLine'] += 1;
                    if ($pos >= $end || ($str[$pos] == ',' || $str[$pos] == ';')) {
                        throw new Exception('Found a source and line, but no column');
                    }

                    // Original column.
                    $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                    $mapping['originalColumn'] = $previousOriginalColumn + $value;
                    $previousOriginalColumn = $mapping['originalColumn'];

                    if ($pos < $end && !($str[$pos] == ',' || $str[$pos] == ';')) {
                        // Original name.
                        $value = Kwf_SourceMaps_Base64VLQ::decodePos($str, $pos);
                        $mapping['originalName'] = $this->_map->names[$previousName + $value];
                        $previousName += $value;
                    } else {
                        $mapping['originalName'] = null;
                    }
                }
                $this->_mappings[] = $mapping;
            }
        }
        return $this->_mappings;
    }
131532
protected function parseMappings()
    {
        $this->mappedAttributes = [];

        foreach ($this->getMaps() as $attribute => $mapping) {
            if (is_array($mapping)) {
                $this->parseImplicitMapping($mapping, $attribute);
            } else {
                $this->mappedAttributes[$attribute] = $mapping;
            }
        }
    }
139323
protected function getCredentialListMappings() {
        if (!$this->_credentialListMappings) {
            $this->_credentialListMappings = new AuthRegistrationsCredentialListMappingList(
                $this->version,
                $this->solution['accountSid'],
                $this->solution['domainSid']
            );
        }

        return $this->_credentialListMappings;
    }
290223
public function getConfig(): array
    {
        $structure = [
            'locationMappings' => [],
            'defaultMappings' => [],
            'fallbackContentType' => $this->buildFallbackContentTypeStructure($this->fallbackContentType),
            'maxFileSize' => $this->maxFileSize,
        ];

        foreach ($this->locationMappings as $locationIdentifier => $locationConfiguration) {
            $structure['locationMappings'][$locationIdentifier] = [
                'contentTypeIdentifier' => $locationConfiguration['content_type_identifier'],
                'mimeTypeFilter' => $locationConfiguration['mime_type_filter'],
                'mappings' => [],
            ];

            foreach ($locationConfiguration['mappings'] as $mappingGroup) {
                $structure['locationMappings'][$locationIdentifier]['mappings'][] = $this->buildMappingGroupStructure($mappingGroup);
            }
        }

        foreach ($this->defaultMappings as $mappingGroup) {
            $structure['defaultMappings'][] = $this->buildMappingGroupStructure($mappingGroup);
        }

        return $structure;
    }
369194
public function getColumnObjectsMapping()
    {
        $mapping = [];
        $foreignTable = $this->getForeignTable();
        for ($i = 0, $size = count($this->localColumns); $i < $size; $i++) {
            $mapping[] = [
                'local'   => $this->parentTable->getColumn($this->localColumns[$i]),
                'foreign' => $foreignTable->getColumn($this->foreignColumns[$i]),
                'value' => $this->localValues[$i],
            ];
        }

        return $mapping;
    }
168224
public function getPropertyRelationMap(): array
    {
        $relations = [];

        foreach ($this->getRelationMappings() as $mapping) {
            $accessor = $mapping->getAccessor();

            if ($accessor instanceof PropertyAccessor) {
                $relations[$accessor->getPropertyName()] = $mapping->getRelation();
            }
        }

        return $relations;
    }
667982
public function all(): array
    {
        $out = [];
        foreach (parent::all() as $key => $props) {
            $out[$props['originalKey']] = $props['value'];
        }

        return $out;
    }
903733
private function getDatatableColumns(): array
    {
        $result = $this->getDisplayColumns();

        if (!$this->getGroupByField()) {
            $result[] = Utility::MENU_PROPERTY_NAME;
        }

        if (!$this->getGroupByField() && $this->batch) {
            $table = TableRegistry::get($this->entity->get('model'));
            // add primary key in FIRST position
            foreach ((array)$table->getPrimaryKey() as $primaryKey) {
                array_unshift($result, $table->aliasField($primaryKey));
            }
        }

        return $result;
    }
1228617
public function getRewriteMapsAsArray()
    {

        // initialize the array for the rewrite maps
        $rewriteMaps = array();

        // iterate over the rewriteMaps nodes and sort them into an array
        foreach ($this->getRewriteMaps() as $rewriteMapNode) {
            $rewriteMaps[$rewriteMapNode->getType()] = $rewriteMapNode->getParamsAsArray();
        }

        // return the array
        return $rewriteMaps;
    }
1246043
public function toMappedArray()
    {
        $values = $this->toArray();
        $mappedValues = [];
        foreach ($values as $key => $value) {
            $mappedValues[$key] = $this->readMapped($key);
        }

        return $mappedValues;
    }
628230
public function generateMappings()
    {
        if (! count($this->mappings)) {
            return '';
        }

        $this->source_keys = array_flip(array_keys($this->sources));

        // group mappings by generated line number.
        $groupedMap = $groupedMapEncoded = [];

        foreach ($this->mappings as $m) {
            $groupedMap[$m['generated_line']][] = $m;
        }

        ksort($groupedMap);
        $lastGeneratedLine = $lastOriginalIndex = $lastOriginalLine = $lastOriginalColumn = 0;

        foreach ($groupedMap as $lineNumber => $line_map) {
            while (++$lastGeneratedLine < $lineNumber) {
                $groupedMapEncoded[] = ';';
            }

            $lineMapEncoded = [];
            $lastGeneratedColumn = 0;

            foreach ($line_map as $m) {
                $mapEncoded = $this->encoder->encode($m['generated_column'] - $lastGeneratedColumn);
                $lastGeneratedColumn = $m['generated_column'];

                // find the index
                if ($m['source_file']) {
                    $index = $this->findFileIndex($m['source_file']);

                    if ($index !== false) {
                        $mapEncoded .= $this->encoder->encode($index - $lastOriginalIndex);
                        $lastOriginalIndex = $index;
                        // lines are stored 0-based in SourceMap spec version 3
                        $mapEncoded .= $this->encoder->encode($m['original_line'] - 1 - $lastOriginalLine);
                        $lastOriginalLine = $m['original_line'] - 1;
                        $mapEncoded .= $this->encoder->encode($m['original_column'] - $lastOriginalColumn);
                        $lastOriginalColumn = $m['original_column'];
                    }
                }

                $lineMapEncoded[] = $mapEncoded;
            }

            $groupedMapEncoded[] = implode(',', $lineMapEncoded) . ';';
        }

        return rtrim(implode($groupedMapEncoded), ';');
    }
133360
public function getQueryMapping($schemaKey = 'default')
    {
        /** @noinspection PhpUndefinedFieldInspection */
        /** @noinspection StaticInvocationViaThisInspection */
        $pathWithKey = $this->getSchemaMapping();
        if (!isset($pathWithKey[$schemaKey])) {
            return [];
        }

        $path = trim($pathWithKey[$schemaKey]);
        $contents = trim(file_get_contents($path));
        $result = json_decode($contents, true);
        if (!is_array($result)) {
            return [];
        }

        return $result;
    }
732181
public function getAllForeignKeys()
    {
        $columns = array();
        foreach ($this->getColumns() as $column) {
            foreach ($column->getForeignKeys() as $foreignKey) {
                if (array_key_exists($foreignKey->getId(), $columns)) {
                    continue;
                }
                $columns[$foreignKey->getId()] = $foreignKey;
            }
        }

        return $columns;
    }
525707
public function getAllTables(): array
    {
        $schema = $this->getSchema();

        $names           = $schema->listTableNames();
        $tableExceptions = ['migrations'];

        $result = [];
        foreach ($names as $name) {
            if (!in_array($name, $tableExceptions)) {
                $result[] = $name;
            }
        }

        return $result;
    }
81425
public function getAllClassNames()
    {
        if (!$this->paths) {
            throw MappingException::pathRequired();
        }
        $classes = [];
        $includedFiles = [];
        foreach ($this->paths as $path) {
            if (!is_dir($path)) {
                $this->logger->warning(sprintf(
                    'The given path "%s" seems to be incorrect. You need to edit victoire_core.base_paths configuration.',
                    $path
                ));
                continue;
            }
            $iterator = new \RegexIterator(
                new \RecursiveIteratorIterator(
                    new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS),
                    \RecursiveIteratorIterator::LEAVES_ONLY
                ),
                $this->regex,
                \RecursiveRegexIterator::GET_MATCH
            );
            foreach ($iterator as $file) {
                $sourceFile = realpath($file[0]);
                $includedFiles[] = $sourceFile;
            }
        }

        foreach ($includedFiles as $fileName) {
            $class = $this->getClassNameFromFile($fileName);
            if (class_exists($class) && !$this->isTransient($class)) {
                $classes[] = $class;
            }
        }

        return $classes;
    }
1019070
public function getUseLines()
    {
        $lines = [];

        $lines = array_merge($lines, $this->getUseLinesSymfony2Part());

        $lines[] = 'use Doctrine\ORM\Mapping as ORM;';

        $useArrayCollection = false;

        foreach ($this->getEntity()->getAttributes() as $attr) {
            if (null !== $attr->getForeign() && 'array' === $attr->getType()) {
                $useArrayCollection = true;
                break;
            }
        }

        if ($useArrayCollection) {
            $lines[] = 'use Doctrine\\Common\\Collections\\ArrayCollection;';
        }


        $lines = array_merge($lines, $this->getUseLinesUserAdditionsPart());

        return $lines;
    }
717372
private function _getKeyIdMap(): array
    {
        // lazily build mapping
        if (!isset($this->_keyIdMap)) {
            $this->_keyIdMap = array();
            foreach ($this->_certs as $cert) {
                $id = self::_getCertKeyId($cert);
                if (!isset($this->_keyIdMap[$id])) {
                    $this->_keyIdMap[$id] = array();
                }
                array_push($this->_keyIdMap[$id], $cert);
            }
        }
        return $this->_keyIdMap;
    }