Wrap a content.

@param string|null $prefix The prefix
@param string $content The content.
@param string|null $suffix The suffix.
@return string Returns the wrapped content.
323935
protected function wrapContent($prefix, $content, $suffix) {

        $output = [];

        if (null !== $prefix) {
            $output[] = $prefix;
        }
        $output[] = $content;
        if (null !== $suffix) {
            $output[] = $suffix;
        }

        return implode("", $output);
    }
38323
public function setTagPrefix($prefix)
    {
        if(!is_string($prefix) && $prefix !== null)
        {
            throw new HTMLTagException("The tag prefix must be a string or null.");
        }

        $this->tag_prefix_previous = $this->getTagPrefix();
        $this->tag_prefix = $prefix;

        return $this;

    }
367959
protected function parseTitle($title, $suffix, $has_suffix)
    {
        if (!$has_suffix):
            return $title;
        elseif(!empty($suffix)):
            return $title . $this->getTitleSeperator() . $suffix;
        else:
            return $this->config->get('defaults.title') ? $title . $this->getTitleSeperator() . $this->config->get('defaults.title', null) : $title;
        endif;
    }
661334
protected function wrapLayout($content)
    {
        // do not wrap the content if layout is turned off.
        if ($this->layout === false) {
            return $content;
        }
        
        $view = Yii::$app->getView();
        
        $vars = array_merge($this->_context, ['content' => $content]);
        
        return $view->renderPhpFile(Yii::getAlias($this->layout), $vars);
    }
604573
public static function replace($text, array $replacements = [], $prefix = '{', $suffix = '}')
    {
        $replacements = static::prepareBinding($replacements, $prefix, $suffix);

        $filter = function ($text) use ($replacements) {
            return strtr($text, $replacements);
        };

        if (is_array($text)) {
            $text = array_map($filter, $text);
        } else {
            $text = $filter($text);
        }

        return $text;
    }
1158757
public void formatWrapper(final StringBuilder sb, final ThrowableProxy cause, final String suffix) {
        this.formatWrapper(sb, cause, null, PlainTextRenderer.getInstance(), suffix);
    }
357160
public function getPathByConvention($suffix = null)
    {
        if (empty($suffix)) {
            return sprintf('%s_nodes', $this->getBundleName());
        }

        return sprintf('%s_nodes_%s', $this->getBundleName(), $suffix);
    }
1138862
public function prepend($xpath, $prefix)
    {
        $expressions = array();

        // If the xpath prefix contains a union we need to wrap it in parentheses.
        if (preg_match(self::UNION_PATTERN, $prefix)) {
            $prefix = '('.$prefix.')';
        }

        // Split any unions into individual expressions.
        foreach ($this->splitUnionParts($xpath) as $expression) {
            $expression = trim($expression);
            $parenthesis = '';

            // If the union is inside some braces, we need to preserve the opening braces and apply
            // the prefix only inside it.
            if (preg_match('/^[\(\s*]+/', $expression, $matches)) {
                $parenthesis = $matches[0];
                $expression = substr($expression, strlen($parenthesis));
            }

            // add prefix before element selector
            if (0 === strpos($expression, '/')) {
                $expression = $prefix.$expression;
            } else {
                $expression = $prefix.'/'.$expression;
            }
            $expressions[] = $parenthesis.$expression;
        }

        return implode(' | ', $expressions);
    }
406054
public static function truncate(
        $string,
        $length,
        $suffix = '',
        $wordBreak = true,
        $encoding = null
    ) {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        if ($length >= Mbstring::strlen($string, $encoding)) {
            return $string;
        }

        $result = Mbstring::substr($string, 0, $length, $encoding);

        if (!$wordBreak && Mbstring::strpos($result, ' ', 0, $encoding) !== $length) {
            $position = Mbstring::strrpos($result, ' ', 0, $encoding);
            $result = Mbstring::substr($result, 0, $position, $encoding);
        }

        return $result . $suffix;
    }
905513
public static function nullMinifier($content)
    {
        if (isset($content[0]) && $content[0] === "\xef") {
            $content = substr($content, 3);
        }
        $content = str_replace("\r\n", "\n", $content);

        return trim($content);
    }
458503
public function prefix($prefix = null)
	{
		if (null !== $prefix)
		{
			$this->prefix = $prefix;
		}
		return $this->prefix;
	}
119205
public function removePrefixFromString($prefix, $string)
    {
        if (GeneralUtility::isFirstPartOfStr($string, $prefix)) {
            return substr($string, strlen($prefix));
        } else {
            return $string;
        }
    }
41590
protected function setSuffix($suffix)
    {
        if (is_null($suffix) or is_bool($suffix)) {
            $this->suffix = null;
        } elseif ($suffix === '/') {
            $this->suffix = $suffix;
        } else {
            $this->suffix = '.' . trim($suffix, '.');
        }
    }
1337526
public static function cleanPrefix($prefixString)
    {
        $prefixString = trim($prefixString);
        if (empty($prefixString)) {
            return null;
        }

        $result = preg_replace('/_*$/i', '', strtolower($prefixString)) . '_';

        if ($result == '_') {
            return null;
        }

        return $result;
    }
373310
public function renderContent($content = null)
    {
        $repository = $this->editor->getRepository();

        if (null === $content) {
            if (null !== $page = $this->pageHelper->getCurrent()) {
                if (null === $content = $repository->loadSubjectContent($page)) {
                    if ($page->isAdvanced()) {
                        $content = $this->editor->createDefaultContent($page);
                        $this->persist($page);
                    } elseif (0 < strlen($html = $page->getHtml())) {
                        return $html;
                    } else {
                        return $this->config['default_content'];
                    }
                }
            } else {
                throw new Exception\RenderingException('Undefined content.');
            }
        } elseif ($content instanceof CM\ContentSubjectInterface) {
            if (null === $element = $repository->loadSubjectContent($content)) {
                $element = $this->editor->createDefaultContent($content);
                $this->persist($content);
            }
            $content = $element;
        } elseif (is_string($content)) {
            if (null === $element = $this->editor->getRepository()->findContentByName($content)) {
                $this->persist($element = $this->editor->createDefaultContent($content));
            }
            $content = $element;
        }

        if ($content instanceof EM\ContentInterface) {
            $this->tagManager->addTags($content->getEntityTag());

            $content = $this->editor->getViewBuilder()->buildContent($content);
        }

        if (!$content instanceof View\ContentView) {
            throw new Exception\InvalidArgumentException(
                'Expected string or instance of ' . CM\ContentSubjectInterface::class . ', ' .
                EM\ContentInterface::class . ' or ' . View\ContentView::class
            );
        }

        /** @noinspection PhpInternalEntityUsedInspection */
        return $this->getTemplate()->renderBlock('cms_content', [
            'content' => $content,
        ]);
    }
669963
public static function GetNamespaceUriForPrefix( $context, $prefix, $nav )
	{
		$ns  = "";
		if ( $prefix instanceof  Undefined || $prefix . "" == "" )
		{
			$ns = $nav->getNamespaceURI();
		}
		else
		{
			/**
			 * @var XmlNamespaceManager $nsmgr
			 */
		    $nsmgr = new XmlNamespaceManager();
		    ExtFuncs::ScanLocalNamespaces( $nsmgr, $nav->CloneInstance(), false );
		    $ns = $nsmgr->lookupNamespace( $prefix . "" );
		}
		return is_null( $ns )
			? Undefined::getValue()
			: new AnyUriValue( $ns );
	}
146387
public static function redisKey($host = null, $suffix = null)
    {
        if (is_null($host)) {
            return 'hosts';
        }

        $hostname = $host instanceof Host ? $host->hostname : $host;
        return 'host:'.$hostname.($suffix ? ':'.$suffix : '');
    }