Compile a geo shape map.

@param Fluent $fluent

@return array
768855
public function compileShape(Fluent $fluent)
    {
        $map = [
            'type'               => 'geo_shape',
            'tree'               => $fluent->tree,
            'precision'          => $fluent->precision,
            'tree_levels'        => $fluent->tree_levels,
            'strategy'           => $fluent->strategy,
            'distance_error_pct' => $fluent->distance_error_pct,
            'orientation'        => $fluent->orientation,
            'points_only'        => $fluent->points_only,
        ];

        return $this->formatMap($map);
    }
1337876
protected function getPropertiesFromMapping(Mapping $mapping)
    {
        $properties = array_merge(
            array_combine($mapping->getProperties(), $mapping->getProperties()),
            $mapping->getAliasedProperties()
        );

        return $properties;
    }
1091594
public function compileIp(Fluent $fluent)
    {
        $map = [
            'type'           => $fluent->type,
            'boost'          => $fluent->boost,
            'doc_values'     => $fluent->doc_values,
            'include_in_all' => $fluent->include_in_all,
            'index'          => $fluent->index,
            'null_value'     => $fluent->null_value,
            'precision_step' => $fluent->precision_step,
            'store'          => $fluent->store,
        ];

        return $this->formatMap($map);
    }
1134863
protected function buildPropertyMap()
    {
        $map = [];
        $properties = (new ReflectionObject($this))->getProperties(ReflectionProperty::IS_PUBLIC);

        foreach ($properties as $property) {
            $map[$property->getName()] = $property;
        }

        return $map;
    }
740544
public function generateMapping()
	{
		$mapping = array();
		$lines = explode("\n", $this->mime_types_text);
		foreach ($lines as $line) {
			$line = trim(preg_replace('~\\#.*~', '', $line));
			$parts = $line ? array_values(array_filter(explode("\t", $line))) : array();
			if (count($parts) === 2) {
				$mime = trim($parts[0]);
				$extensions = explode(' ', $parts[1]);
				foreach ($extensions as $extension) {
					$extension = trim($extension);
					if ($mime && $extension) {
						$mapping['mimes'][$extension][] = $mime;
						$mapping['extensions'][$mime][] = $extension;
						$mapping['mimes'][$extension] = array_unique($mapping['mimes'][$extension]);
						$mapping['extensions'][$mime] = array_unique($mapping['extensions'][$mime]);
					}
				}
			}
		}
		return $mapping;
	}
919156
public function compileDrop(Blueprint $blueprint, Fluent $command)
    {
        $match = $this->compileFrom($blueprint);
        $label = $this->prepareLabels(array($blueprint));

        return $match . " REMOVE n" . $label;
    }
595241
protected function getRawIncludeMap(): array
    {
        $map = [];

        foreach ($this->includes as $includeKey => $definition) {
            if (\is_int($includeKey)) {
                $includeKey = $definition;
                $definition = null;
            }

            $settings = [];
            if (!empty($definition)) {
                $parts = preg_split('/\s*\|\s*/', $definition);
                foreach ($parts as $part) {
                    if (!preg_match('/^([^:]+)(:(.+))?$/', $part, $match)) {
                        throw new ParseDefinitionException("Unable to parse field definition for '{$includeKey}''");
                    }
                    // If only list() was viable ...
                    $directive = $match[1];
                    $val = $match[3] ?? null;
                    switch ($directive) {
                        case 'default':
                            $settings['default'] = true;
                            break;
                        case 'relation':
                            $settings['relation'] = !empty($val) ?
                                preg_split('/s*,\s*/', $val) : [$includeKey];
                            break;
                        case 'method':
                            if (!empty($val)) {
                                $settings['method'] = $val;
                            }
                            break;
                        case 'item':
                            $settings['resource_type'] = 'item';
                            break;
                        case 'collection':
                            $settings['resource_type'] = 'collection';
                            break;
                        default:
                            throw new ParseDefinitionException("Invalid key '{$directive}' for {$includeKey}");
                    }
                }
            }

            if (!isset($settings['relation'])) {
                $settings['relation'] = [];
            }
            if (!isset($settings['method'])) {
                $settings['method'] = 'include'.StrHelper::studlyCase($includeKey);
            }
            if (!isset($settings['default'])) {
                $settings['default'] = false;
            }
            if (!isset($settings['resource_type'])) {
                $settings['resource_type'] = null;
            }

            $map[$includeKey] = $settings;
        }

        return $map;
    }
12555
public static function getCoordinateMap($key=NULL)
    {
        if ($key) {
            return isset(self::$_keyCoordinateMap[$key]) ? self::$_keyCoordinateMap[$key] : NULL;
        } else {
            return self::$_keyCoordinateMap;
        }
    }
290438
private function mapType($type)
    {
        $types = [
            Gmagick::IMGTYPE_BILEVEL              => 'BILEVEL',
            Gmagick::IMGTYPE_GRAYSCALE            => 'GRAYSCALE',
            Gmagick::IMGTYPE_GRAYSCALEMATTE       => 'GRAYSCALEMATTE',
            Gmagick::IMGTYPE_PALETTE              => 'PALETTE',
            Gmagick::IMGTYPE_PALETTEMATTE         => 'PALETTEMATTE',
            Gmagick::IMGTYPE_TRUECOLOR            => 'TRUECOLOR',
            Gmagick::IMGTYPE_TRUECOLORMATTE       => 'TRUECOLORMATTE',
            Gmagick::IMGTYPE_COLORSEPARATION      => 'COLORSEPARATION',
            Gmagick::IMGTYPE_COLORSEPARATIONMATTE => 'COLORSEPARATIONMATTE',
            Gmagick::IMGTYPE_OPTIMIZE             => 'OPTIMIZE',
            Gmagick::IMGTYPE_UNDEFINED            => 'UNDEFINED',
        ];

        if (!isset($types[$type])) {
            return $types[Gmagick::IMGTYPE_UNDEFINED];
        }

        return $types[$type];
    }
419178
public function collection()
    {
        if (!empty($this->response['data'])) {
            $data = [];

            foreach ($this->response['data'] as $object) {
                $data[] = new Fluent($this->resource, $object);
            }

            return $data;
        }

        return [];
    }
820725
public function getLocalForeignMapping()
    {
        $h = array();
        for ($i = 0, $size = count($this->localColumns); $i < $size; $i++) {
            $h[$this->localColumns[$i]] = $this->foreignColumns[$i];
        }

        return $h;
    }
888512
public function getNormalizedMap($mapping)
    {
        $result = [];

        foreach ($mapping as $map) {
            list ($left, $right) = $map;
            $item = [];
            $item[0] = $left instanceof Column ? ':' . $left->getName() : $left;
            $item[1] = $right instanceof Column ? ':' . $right->getName() : $right;
            $result[] = $item;
        }

        return $result;
    }
891931
private function buildParentMap()
    {
        $map = [];

        foreach ($this->configurations as $configuration) {
            if (null !== $parentId = $configuration->getParentId()) {
                $map[$configuration->getResourceId()] = $parentId;
            }
        }

        ksort($map);

        return $map;
    }
849374
public function mapBlocks(array $data): array
    {
        $blocks = [];

        foreach ($data as $dataItem) {
            $blockId = (int) $dataItem['id'];
            $locale = $dataItem['locale'];

            if (!isset($blocks[$blockId])) {
                $blocks[$blockId] = [
                    'id' => $blockId,
                    'layoutId' => (int) $dataItem['layout_id'],
                    'depth' => (int) $dataItem['depth'],
                    'path' => $dataItem['path'],
                    'parentId' => $dataItem['parent_id'] > 0 ? (int) $dataItem['parent_id'] : null,
                    'placeholder' => $dataItem['placeholder'],
                    'position' => $dataItem['parent_id'] > 0 ? (int) $dataItem['position'] : null,
                    'definitionIdentifier' => $dataItem['definition_identifier'],
                    'viewType' => $dataItem['view_type'],
                    'itemViewType' => $dataItem['item_view_type'],
                    'name' => $dataItem['name'],
                    'isTranslatable' => (bool) $dataItem['translatable'],
                    'mainLocale' => $dataItem['main_locale'],
                    'alwaysAvailable' => (bool) $dataItem['always_available'],
                    'status' => (int) $dataItem['status'],
                    'config' => $this->buildParameters((string) $dataItem['config']),
                ];
            }

            $blocks[$blockId]['parameters'][$locale] = $this->buildParameters((string) $dataItem['parameters']);
            $blocks[$blockId]['availableLocales'][] = $locale;
        }

        return array_values(
            array_map(
                static function (array $blockData): Block {
                    ksort($blockData['parameters']);
                    sort($blockData['availableLocales']);

                    return Block::fromArray($blockData);
                },
                $blocks
            )
        );
    }
698866
private function getMap(): array
    {
        $map = $this->map ?? config('transliterate.default_map');
        $lang = $this->lang ?? config('transliterate.default_lang');
        $customMaps = config('transliterate.custom_maps');

        $vendorMapsPath = __DIR__.DIRECTORY_SEPARATOR.'maps'.DIRECTORY_SEPARATOR;
        $path = $customMaps[$lang][$map] ?? $vendorMapsPath.$lang.DIRECTORY_SEPARATOR.$map.'.php';

        if (!file_exists($path)) {
            throw new \InvalidArgumentException("The transliteration map '${path}' doesn't exist");
        }

        /* @noinspection PhpIncludeInspection */
        return require $path;
    }
433319
public function mapModels($rows){
        $rst = array();
        foreach($rows as $row){
            $rst[] = $this->map($row);
        }
        
        return $rst;
    }
885519
public function compileCreate(Blueprint $blueprint, Fluent $command)
    {
        return sprintf('%s table %s (%s%s%s)',
            $blueprint->temporary ? 'create temporary' : 'create',
            $this->wrapTable($blueprint),
            implode(', ', $this->getColumns($blueprint)),
            (string) $this->addForeignKeys($blueprint),
            (string) $this->addPrimaryKeys($blueprint)
        );
    }