@param $content

@return mixed
@throws \yii\base\InvalidConfigException
494412
protected function determineExtension($content)
    {
        $filename = \Yii::getAlias('@runtime/' . uniqid());
        file_put_contents($filename, $content);

        $mime = FileHelper::getMimeType($filename);

        $extensions = FileHelper::getExtensionsByMimeType($mime);

        unlink($filename);

        return ArrayHelper::getValue($extensions, max(count($extensions) - 1, 0));
    }
254575
public function setContent($content)
    {
        if (is_null($this->mbRequest)) {
            return $this;
        }

        $this->prepare($this->mbRequest);

        if ($this->mbRequest->isMethod("GET") || $this->mbRequest->isMethod("DELETE")) {
            $this->statusCode = BaseResponse::HTTP_OK;
        } elseif ($this->mbRequest->isMethod("POST") || $this->mbRequest->isMethod("PUT")) {
            $this->statusCode = BaseResponse::HTTP_CREATED;
        } else {
            $this->statusCode = BaseResponse::HTTP_RESET_CONTENT;
        }

        if ($content instanceof \Exception) {
            $this->statusCode = $content->getCode();
            $this->statusCode = $this->isSuccessful() ? $this->statusCode : BaseResponse::HTTP_BAD_REQUEST;
        }

        if($this->isBuffer()){
            $this->original = $content;
        } elseif ($this->mbRequest->isAjax()) {
            $this->ajaxContent($content);
        } else {
            $this->htmlContent($content);
        }

        return $this;
    }
286584
protected function createDOM($content)
    {
        if (!$content) {
            return false;
        }
        $dom = new DOMDocument();
        $dom->loadHTML($content);
        $dom->preserveWhiteSpace = false;

        return $dom;
    }
195699
public function setContent($content)
    {
        $context = $this->_context;

        $context->content = (string)$content;

        return $this;
    }
873580
public function prepareContent($content)
    {
        if (is_array($content)) {
            $ctt = '';
            foreach ($content as $key=>$ctt_entry) {
                $ctt .= $ctt_entry;
            }
            $content = $ctt;
        }
        return (string) $content;
    }
206059
public function setContent($content)
    {
        if ($this->version != Feed::ATOM)
            throw new InvalidOperationException('The content element is supported in ATOM feeds only.');

        return $this->addElement('content', $content, array('type' => 'html'));
    }
42727
public function setContent($content)
    {
        $this->content = null;
        if ($content === null) {
            return;
        }

        if (TypeHandling::isSimpleType(gettype($content)) && !is_array($content)) {
            $this->content = (string)$content;
        }

        if (is_resource($content)) {
            $this->content = $content;
        }

        return $this;
    }
517212
protected function _defaultData($content)
    {
        $content = @unserialize($content);
        if (empty($content) || !is_a($content, \stdClass::class)) {
            $content = new \stdClass;
        }
        $content->selected = isset($content->selected) ? $content->selected : '';
        $content->price = isset($content->price) ? $content->price : '';
        return $content;
    }
915753
protected function stringOrCallback($content)
    {
        if( is_scalar($content) )
        {
            return $content;
        }
        elseif( is_callable($content) )
        {
            return Buffering\Callback::do($content);
        }

        throw new Exception\InvalidArgumentException('1.($content) parameter must be [scalar] or [callable] type!');
    }
1185812
public function parse($content)
    {
        $map = [];

        if (preg_match(self::CONFIGURATION_PATTERN, $content, $matches)) {
            if (preg_match(self::DATABASE_PATTERN, $matches[1], $database)) {
                $map[self::DATABASE_INDEX] = $database[1];
            }
            if (preg_match(self::COLLECTION_PATTERN, $matches[1], $collection)) {
                $map[self::COLLECTION_INDEX] = $collection[1];
            }
        }

        return $map;
    }
564785
public function getSerializedContent($content)
    {
        $serializationContext = clone $this->serializationContext;

        return $this->serializer->serialize(
            $content,
            'json',
            $serializationContext
        );
    }
576332
public function content($content = false)
    {
        if ($content === false) {
            return $this->adapter->fileGetContents($this->path);
        }

        $this->adapter->filePutContents($this->path, $content);
        return $this;
    }
1354888
public function parseRelease(&$content)
	{
		$release = new Release;
		$types = [];
		$lastType = '';
		$nameSet = false;

		$line = current($content);
		while ($line !== false)
		{
			$line = ltrim($line);

			if ($this->startsWith($line, '###'))
			{
				$type = $this->trimHashes($line);
				$types[$type] = [];
				$lastType = $type;
			}
			elseif ($nameSet &&
				$this->startsWith($line, '##') ||
				$this->startsWith($line, '[')
			)
			{
				prev($content);
				break;
			}
			elseif ($this->startsWith($line, '##'))
			{
				$this->handleName($release, $line);
				$nameSet = true;
			}
			else
			{
				$change = ltrim($line, "\t\n\r\0\x0B -");

				if ($change !== '')
				{
					$types[$lastType][] = $change;
				}
			}

			$line = next($content);
		}

		$release->setAllChanges($types);
		return $release;
	}
197510
protected function unpack($content)
    {
        if ( !is_array($content) ) return null;

        if ( $content['ttl'] > 0 && time() >= $content['time'] + $content['ttl'] ) {
            $this->remove($content['key']);

            return null;
        }

        return $content['value'];
    }
626054
private function checkContent($content)
    {
        if (! is_array($content) and ! is_string($content)) {
            throw new InvalidTypeException(
                'The content must be an array or string value, ' . gettype($content) . ' is given.'
            );
        }

        $this->checkSingleValuedContent($content);

        return is_array($content) ? $content : [$content];
    }
859638
protected function parseJson($content)
    {
        $content = json_decode($content, true);
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \UnexpectedValueException(sprintf(
                "JSON 解析失败: %s",
                json_last_error_msg()
            ));
        }

        return $content;
    }
621900
public function replace($content)
    {
        foreach ($this->hasChild as $name => $value) {
            $name = $this->placeholder($name);
            $this->blocks[$name] = $this->_replace($this->blocks[$name]);
        }

        return $this->_replace($content);
    }