Detects MIME Type based on given content.

@param  string  $content
@return mixed   string|null MIME Type or NULL if no mime type detected
969623
public static function detectByContent($content)
	{
		if (!class_exists('Finfo'))
		{
			return;
		}

		$finfo = new Finfo(FILEINFO_MIME_TYPE);
		$mimeType = $finfo->buffer($content);

		return $mimeType ?: null;
	}
273649
private function tryParse($content)
	{
		if(strlen($content) == 32)
		{
			$this->hash = $content;
			return true;
		}
		if(strlen($content) == 64)
		{
			$this->hash = hex2bin($content);
			return true;
		}
		return false;
	}
670619
public static function shortcodeToUnicode($content)
    {
        $replacements = self::getShortcodeCodepoints();
        return str_replace(array_keys($replacements), $replacements, $content);
    }
638718
protected function should_be_json( $content ) {
		return $content instanceof Jsonable ||
			   $content instanceof Arrayable ||
			   $content instanceof ArrayObject ||
			   $content instanceof JsonSerializable ||
			   is_array( $content );
	}
857276
public function isContentType($mime) {
    foreach ((array) $mime as $m) {
      $m = $this->getMime($m);
      if (strtolower($m) === $this->getContentTypeMime()) {
        return true;
      }
    }
    return false;
  }
869204
public static function getStreamExt($content)
    {
        $finfo = new finfo(FILEINFO_MIME);

        $mime = $finfo->buffer($content);

        return isset(self::$extensionMap[$mime]) ? self::$extensionMap[$mime] : '';
    }
49710
public function parse($content) {
        $this->_content = $content;

        $this->_parseExtends();

        if ($this->_parent != null) {
            $this->_parseExtendsMain();
        }

        $this->_parseDebugStart();
        $this->_parseExtend();
        $this->_parseInclude();
        $this->_parsePath();
        $this->_parseGravatar();
        $this->_parseAsset();
        $this->_parseUrl();
        $this->_parsePhp();
        $this->_parseLang();
        $this->_parseForeach();
        $this->_parseFor();
        $this->_parseVar();
        $this->_parseVarFunc();
        $this->_parseCondition();
        $this->_parseFunction();
        $this->_parseException();
        $this->_parseBlock();
        $this->_parseTemplate();
        $this->_parseCall();
        $this->_parseMinify();
        $this->_parseDebugEnd();

        return $this->_content;
    }
1326778
public function fileContent($content)
    {
        if (is_resource($this->fileContent)) {
            fclose($this->fileContent);
        }

        $this->fileContent = $content;

        if (is_resource($content) && empty($this->fileType)) {
            $this->fileType($this->getTypeFromResource($content));
        }

        return $this;
    }
51029
private function extractSignedContent($content)
    {
        $signature = substr($content, -40);

        if (substr($content, -43, 3) == self::VALUE_SEPARATOR . '_=' &&
            $signature == sha1(substr($content, 0, -40) . SettingsPiwik::getSalt())
        ) {
            // strip trailing: VALUE_SEPARATOR '_=' signature"
            return substr($content, 0, -43);
        }

        return false;
    }
516718
def get_content_type(name, content):
    
    if hasattr(content, "content_type"):
        content_type = content.content_type
    else:
        mime_type, encoding = mimetypes.guess_type(name)
        content_type = mime_type
    return content_type
207732
protected function shouldBeJson($content)
    {
        return $content instanceof Arrayable ||
               $content instanceof Jsonable ||
               $content instanceof ArrayObject ||
               $content instanceof JsonSerializable ||
               is_array($content);
    }
25935
public function convert($content)
    {
        $result = strtr($content, $this->rules);
        return $this->correct($result);
    }
746028
public function processContent(string $content): string
    {
        $matches = Strings::matchAll($content, '#\[' . RegexPattern::PR_OR_ISSUE . '\]#m');
        foreach ($matches as $match) {
            $link = sprintf('[#%d]: %s/pull/%d', $match['id'], $this->repositoryUrl, $match['id']);
            $this->linkAppender->add($match['id'], $link);
        }

        return $content;
    }
367077
public function decode_content($content) {
        if (!$content = $this->precheck_content($content)) { // Perform some prechecks
            return false;
        }
        // Iterate over all rules, chaining results
        foreach ($this->rules as $rule) {
            $content = $rule->decode($content);
        }
        return $content;
    }
278295
public function parseContent($content) {
        $dc = json_decode($content, true);

        $ret = [];

        foreach ($dc as $key => $content) {
            preg_match("/^(?P<type>[a-z0-9A-Z]*):(?P<path>(?P<id>[a-z0-9A-Z]*):(?P<field>[a-z0-9A-Z]*))$/", $key, $matches);

            $ret[] = [
                'type' => $matches['type'],
                'path' => $matches['path'],
                'id' => $matches['id'],
                'field' => $matches['field'],
                'content' => $content
            ];
        }

        return $ret;
    }
626764
public function mime($mime = null)
    {
        if (!func_num_args()) {
            list($mime, $charset) = $this->_inspectContentType();
            return $this->_mime = $mime;
        }

        $this->_mime = $mime ? strtolower($mime) : null;
        $this->_updateContentType();
        return $this;
    }
1266573
public function detect($content)
    {
        if ($content == '') {
            return [];
        }

        $data = json_decode($content, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw ErrorException::invalidResponse(json_last_error_msg(), json_last_error());
        }

        if (!empty($data['code'])) {
            throw ErrorException::failed(
                isset($data['message']) ? $data['message'] : '',
                $data['code']
            );
        }

        return (array) $data;
    }