Turn contents into a string of the correct format

@param   mixed   $content
@param   string  $format
@param   array   $options
@return  string
427146
public function toContent($contents, $format, $options = array())
	{
		if (!($contents instanceof Registry))
		{
			$contents = new Registry($contents);
		}

		return $contents->toString($format, $options);
	}
1215561
public function format($content, $conf)
    {
        // set default values
        $inputFormat = $conf['inputFormat'] ?: 'Y-m-d\TH:i:s\Z';
        $outputFormat = $conf['outputFormat'] ?: '';
        return $this->formatService->format($content, $inputFormat, $outputFormat);
    }
114693
public function renderSVG($content, array $options = []) {
		$options = $options + $this->defaultOptions;

		$identifier = isset($options['identifier']) ? (string)$options['identifier'] : md5($content);

		if (!isset($this->usedSvgs[$identifier])) {
			$symbol = $this->processSVG($content, $options);
		} else {
			$symbol = $this->usedSvgs[$identifier];
		}

		return $this->renderSymbol($symbol, $options);
	}
21079
public function data($content, $options = [])
    {
        if (isset($options['returnAll']) && $options['returnAll']) {
            return BlockSelectOption::getOptionsArray($this->_block->id);
        }
        return parent::data($content);
    }
765469
public function keyword($title, $content, $options = [])
    {
        $data = array_merge([
            'title'   => $title, 
            'content' => $content
        ], $options);

        return $this->send('keyword', $data);
    }
354686
protected function compress($content, $type, $options = array())
    {
        $commandline =array($this->javaPath);

        if (null !== $this->stackSize) {
            array_push($commandline, '-Xss'.$this->stackSize);
        }

        array_push($commandline, '-jar', $this->jarPath);

        foreach ($options as $option) {
            array_push($commandline, $option);
        }

        if (null !== $this->charset) {
            array_push($commandline, '--charset', $this->charset);
        }

        if (null !== $this->lineBreak) {
            array_push($commandline, '--line-break', $this->lineBreak);
        }

        // input and output files
        $tempDir = FilesystemUtils::getTemporaryDirectory();
        $input = tempnam($tempDir, 'assetic_yui_input');
        $output = tempnam($tempDir, 'assetic_yui_output');
        file_put_contents($input, $content);
        array_push($commandline, '-o', $output, '--type', $type, $input);

        $proc = new Process(implode(' ', $commandline));
        $code = $proc->run();
        unlink($input);

        if (0 !== $code) {
            if (file_exists($output)) {
                unlink($output);
            }

            throw FilterException::fromProcess($proc)->setInput($content);
        }

        if (!file_exists($output)) {
            throw new \RuntimeException('Error creating output file.');
        }

        $retval = file_get_contents($output);
        unlink($output);

        return $retval;
    }
879287
public function keyword($title, $content, $options=array()){

        $data = array();
        
        $data['title'] = $title;
        $data['content'] = $content;

        $data = array_merge($data, $options);
        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');

        return $this->request($this->keywordUrl, $data);
    }
1128403
public function transform($content, $options = [])
    {
        // if there is no namespace we assume the first letter is uppercase
        if (!$content || strpos($content, self::NAMESPACE_DELIMITER) === false) {
            return ucfirst($content);
        }

        // get the last character after the last backslash and set it to uppercase
        if (($pos = strrpos($content, self::NAMESPACE_DELIMITER)) !== false) {
            $content[$pos+1] = ucfirst($content[$pos+1]);
        }

        return $content;
    }
1060236
private function getFormat(array $options)
    {
        if (isset($options[self::PARAM_FORMAT])) {
            return $options[self::PARAM_FORMAT];
        } else {
            return $this->defaultFormat;
        }
    }
1343398
public function display($content, $options = [])
    {
        if (!empty($options['meta']) || !empty($options['pageBuilder'])) {
            $content = preg_replace_callback(
                '/{{\s*\$(?P<block>\w*)\s*}}/',
                function ($matches) {
                    return str_replace('"', "'", strip_tags(PageBuilder::block($matches['block'])));
                },
                $content
            );
            $content = str_replace('%page_name%', PageBuilder::pageName(), $content);
            $content = str_replace('%site_name%', config('coaster::site.name'), $content);
        }
        if (!empty($options['meta'])) {
            $content = trim(str_replace(PHP_EOL, ' ', $content));
            $content = preg_replace('/\s+/', ' ', $content);
            $content = htmlentities(strip_tags(html_entity_decode($content, ENT_QUOTES, 'UTF-8')));
            $content = StringHelper::cutString($content);
        }
        return parent::display($content, $options);
    }
660012
public function createTask(string $content, array $options = [])
    {
        if ('' === $content) {
            return false;
        }

        unset($options['content']);
        $data   = $this->prepareRequestData(array_merge(['content' => $content], $options));
        $result = $this->post('tasks', $data);

        $status = $result->getStatusCode();
        if (200 === $status) {
            return json_decode($result->getBody()->getContents());
        }

        return false;
    }
626193
public function prepareContent($content)
    {
        if (is_array($content)) {
            $ctt = '';
            foreach ($content as $key=>$ctt) {
                $content .= $ctt;
            }
            $content = $ctt;
        }
        $_escaped_output = strip_tags((string) $content);
        if ($_escaped_output != (string) $content) {
            if (preg_match('/(.*)<body(.*)</body>/i', (string) $content, $matches)) {
                $_output = $matches[0];
            } else {
                $_output = (string) $content;
            }
            $content = Html2Text::convert($_output);
        }
        return (string) $content;
    }
915022
public function format_answer($answer, $context, $answerformat, $options = []) {

        if (is_object($options)) {
            $options = (array) $options;
        }

        if (empty($options['context'])) {
            $options['context'] = $context;
        }

        if (empty($options['para'])) {
            $options['para'] = true;
        }

        return format_text($answer, $answerformat, $options);
    }
593522
public function contentTag($name, $content, array $options = array(), $escape = false)
    {
        if ($content instanceof \Closure) {
            ob_start();
            $ret     = $content();
            $content = ob_get_clean();
            if ($ret !== null) {
                $content = $ret;
            }
        }
        return $this->contentTagString($name, $content, $options, $escape);
    }
28793
public function link($url, $content = '', $options = [], $safe = false)
    {
        if (is_null($content)) {
            $content = $url;
        }

        return '<a href="'.$this->_generator->generateUrl($url).'"'.self::attributes($options).'>'.self::encode($content, $safe).'</a>';
    }
156520
protected function formatContent($content)
    {
        $searches = array(
            '{{filename}}',
            '{{namespace}}',
            '{{className}}',
            '{{model}}',
            '{{fullModel}}',
            '{{camelModel}}',
            '{{pluralModel}}',
            '{{userModel}}',
            '{{fullUserModel}}',

        );

        $replaces = array(
            $this->data['filename'],
            $this->data['namespace'],
            $this->data['className'],
            $this->data['model'],
            $this->data['fullModel'],
            $this->data['camelModel'],
            $this->data['pluralModel'],
            $this->data['userModel'],
            $this->data['fullUserModel'],
        );

        $content = str_replace($searches, $replaces, $content);

        //
        $class = $this->data['fullModel'];

        return str_replace("use {$class};\nuse {$class};", "use {$class};", $content);
    }
1155412
public function transform($content, $options = [])
    {
        if (!$content instanceof \DateInterval) {
            return 0;
        }

        $decTime = 0;
        $decTime += ($content->d ? $content->d * 60 * 24 : 0);
        $decTime += ($content->h ? $content->h * 60 : 0);
        $decTime += $content->i;
        $decTime += ($content->s ? $content->s / 60 : 0);

        return $decTime;
    }