Get headers for the current file extension.

@param string $content

@return array
321745
public function getHeaders(string $content): array
    {
        \preg_match_all('/(?<=["\'])[^="\']*\.(' . \implode('|', $this->imageExtensions) . ')\.*\d*\.*(?=["\'])/', $content, $imagesFiles);
        $paths = $this->streamlineFilePaths((array)$imagesFiles[0]);

        return $this->mapPathsWithType($paths, 'image');
    }
917539
public static function buildAndGetDocument($content) :array {
		// convert the array to a basic CSV string
		$content = is_array($content) ? self::convertArrayToString($content) : $content;
		// convert the content to the proper charset (if needs be)
		$content = mb_convert_encoding($content, self::destination_charset);
		// prefix it with the BOM characters
		$content = self::getBomCharacters() . $content;
		// return the formatted document
		return [
			$content,
			self::destination_charset
		];
	}
982089
protected function parse($content)
    {
        $result = array();
        foreach ($this->parsers as $parser) {
            $nodes = $parser->getNodes($content);
            if (!$nodes) {
                continue;
            }

            foreach ($nodes as $node) {
                $result[] = $node;
            }
        }

        return $result;
    }
993341
public static function extractImports($content)
    {
        $imports = array();
        static::filterImports($content, function($matches) use(& $imports) {
            $imports[] = $matches['url'];
        });

        return array_unique($imports);
    }
341037
protected function formatContent($content)
    {
        return str_replace(
            ['{{slug}}', '{{name}}', '{{namespace}}'],
            [$this->slug, $this->name, $this->pluggable->getNamespace()],
            $content
        );
    }
271020
public function parseNewPagesFrom($content) {
		$pages = array();
		if (preg_match_all('/\[\[([\w\s_.-]+)\]\]/', $content, $matches)) {
			// exit(print_r($matches));
			foreach ($matches[1] as $pageTitle) {
				$pages[] = $pageTitle;
			}
		}

		return $pages;
	}
95356
public static function metadata(string $content): array
	{
		if (preg_match_all(self::$metadataPattern, $content, $matches) !== false) {
			$combine = array_combine($matches[1], $matches[2]);

			if ($combine === false) {
				throw new LogicException('Matches count is not equal.');
			}

			return $combine;
		}

		return [];
	}
582656
protected function retrieveH5P( $content ) {
		if ( $this->sourceHasH5pApi && $this->targetHasH5pApi ) {
			// Download H5P
			$h5p_ids = $this->downloads->h5p( $content );
			foreach ( $h5p_ids as $h5p_id ) {
				if ( str_starts_with( $h5p_id, '#fixme' ) ) {
					// Flag problem, remove broken H5P shortcode
					$this->targetHasFetchedAllTheH5p = false;
					$h5p_id = str_remove_prefix( $h5p_id, '#fixme' );
					$content = $this->h5p->replaceUncloneable( $content, $h5p_id );
				} else {
					$this->clonedItems['h5p'][] = $h5p_id;
				}
			}
		} else {
			// Remove all H5P shortcodes
			$content = $this->h5p->replaceUncloneable( $content );
		}
		return $content;
	}
806412
private function detectFormatByContent($content)
    {
        if (preg_match('/^\\{.*\\}$/is', $content)) {
            return self::FORMAT_JSON;
        }
        if (preg_match('/^([^=&])+=[^=&]+(&[^=&]+=[^=&]+)*$/', $content)) {
            return self::FORMAT_URLENCODED;
        }
        if (preg_match('/^<.*>$/s', $content)) {
            return self::FORMAT_XML;
        }
    }
128653
public static function findTemporaryUploads($content)
    {
        $links = self::findExternalLinks($content);

        if (empty($links)) {
            return $links;
        }

        $files = [];

        foreach ($links as $link) {
            $strpos = strpos($link, '/' . self::TEMPORARY_FOLDER . '/');
            if ($strpos === false) {
                continue;
            }

            $path = substr($link, $strpos);

            $file = File::find(ASSETS_DIR . $path);

            if ($file) {
                $files[] = $file;
            }
        }

        return $files;
    }
893269
public function parse($content)
    {
        // if there is no path it's not needed to try to get a clean one
        if (empty($content)) return [];

        $path = $this->getCleanPath($content);
        $pathParts = [$this->delimiter];
        // check if there is even a need for further checks
        if (mb_strpos($path, $this->delimiter) === false) {
            if (!$path) {
                return [$this->delimiter];
            }

            // set the root and the path
            $tmpPathParts = [
                $this->delimiter,
                $path
            ];

            return $tmpPathParts;
        }

        // if there's a deeper path it's time to walk through it and clean the empty parts etc
        $tmpPathParts = explode($this->delimiter, $path);


        // walk through the array and remove the empty entries
        for ($i = 0, $c = count($tmpPathParts); $i < $c; $i++) {
            if (!$tmpPathParts[$i]) unset($tmpPathParts[$i]);
        }

        // prepend the default delimiter
        $pathParts = array_merge($pathParts, $tmpPathParts);

        // path parts
        return $pathParts;
    }
372083
public function doShortcode($content)
    {
        if (false === strpos($content, '[')) {
            return $content;
        }

        if (empty($this->_shortcodes) || !is_array($this->_shortcodes))
            return $content;

        /**
         * Clear content from ignore blocks
         */
        $pattern = $this->getIgnorePattern();
        $content = preg_replace_callback("~$pattern~isu", ['self', '_stack'], $content);

        /**
         * parse nested
         */
        $content = $this->parseContent($content);

        /**
         * Replase shorcodes in content
         */
        $content = strtr($content, self::_stack());

        return $content;
    }
720332
protected function getEOL($content)
    {
        static $eols = [
            "\r\n",
            "\n",
            "\r",
        ];
        foreach($eols as $eol)
        {
            if(strpos($content, $eol))
            {
                return $eol;
            }
        }
        return PHP_EOL;
    }
501253
protected function _get_domain( $content ) {
		$permalink = $this->get_permalink();
		if ( ! $permalink ) {
			$permalink = $this->_get_permalink( $content );
		}

		preg_match( '/https?:\/\/([^\/]+)/', $permalink, $reg );
		if ( ! empty( $reg[1] ) ) {
			return $reg[1];
		}
	}
898625
public function json($content)
    {
        if (is_array($content)) {
            $content = json_encode($content);
        }

        $this->content = $content;

        return $this->header('Content-Type', 'application/json');
    }
1025702
protected function getFullTextValues(Content $content)
    {
        $fullTextValues = [];
        foreach ($content->fields as $field) {
            $fieldDefinition = $this->contentTypeHandler->getFieldDefinition(
                $field->fieldDefinitionId, Content\Type::STATUS_DEFINED
            );
            if (!$fieldDefinition->isSearchable) {
                continue;
            }

            $value = $this->getFullTextFieldValue($field, $fieldDefinition);
            if (empty($value)) {
                continue;
            }

            $fullTextValues[] = new FullTextValue(
                [
                    'id' => $field->id,
                    'fieldDefinitionId' => $field->fieldDefinitionId,
                    'fieldDefinitionIdentifier' => $fieldDefinition->identifier,
                    'languageCode' => $field->languageCode,
                    'value' => !is_array($value) ? $value : implode(' ', $value),
                ]
            );
        }

        return $fullTextValues;
    }
1243337
public function getHttpPushHeaders(string $content): array
    {
        $headers = [];
        /** @var ConfigurationService $configurationService */
        $configurationService = GeneralUtility::makeInstance(ConfigurationService::class);
        if ($configurationService->isBool('sendHttp2PushEnable')) {
            $limit = (int)$configurationService->get('sendHttp2PushFileLimit');
            $extensions = GeneralUtility::trimExplode(',', (string)$configurationService->get('sendHttp2PushFileExtensions'), true);
            $handlers = $this->getHttpPushHandler();

            foreach ($extensions as $extension) {
                foreach ($handlers as $handler) {
                    /** @var AbstractHttpPush $handler */
                    if ($handler->canHandleExtension($extension)) {
                        $headers = \array_merge($headers, $handler->getHeaders($content));
                    }
                }
            }

            $headers = \array_slice($headers, 0, $limit);
        }

        return $headers;
    }