protected function generateLink(
        EventDispatcherInterface $eventDispatcher,
        $strLink,
        $objArticle,
        $blnAddArchive = false,
        $blnIsReadMore = false
    ) {
        // Internal link.
        if ($objArticle->source !== 'external') {
            return sprintf(
                '<a href="%s" title="%s">%s%s</a>',
                $this->generateNewsUrl($eventDispatcher, $objArticle, $blnAddArchive),
                specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objArticle->headline), true),
                $strLink,
                ($blnIsReadMore ? ' <span class="invisible">' . $objArticle->headline . '</span>' : '')
            );
        }

        /** @var StringUtil $stringUtilAdapter */
        $stringUtilAdapter = $this->framework->getAdapter(StringUtil::class);

        // Encode e-mail addresses.
        if (substr($objArticle->url, 0, 7) === 'mailto:') {
            $strArticleUrl = $stringUtilAdapter->encodeEmail($objArticle->url);
        } else {
        // Ampersand URIs.
            $strArticleUrl = ampersand($objArticle->url);
        }

        // External link.
        return sprintf(
            '<a href="%s" title="%s"%s>%s</a>',
            $strArticleUrl,
            specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['open'], $strArticleUrl)),
            $objArticle->target ? ' target="_blank"' : '',
            $strLink
        );
    }
protected function generateLink(
        EventDispatcherInterface $eventDispatcher,
        $strLink,
        $objArticle,
        $blnAddArchive = false,
        $blnIsReadMore = false
    ) {
        // Internal link.
        if ($objArticle->source !== 'external') {
            return sprintf(
                '<a href="%s" title="%s">%s%s</a>',
                $this->generateNewsUrl($eventDispatcher, $objArticle, $blnAddArchive),
                specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objArticle->headline), true),
                $strLink,
                ($blnIsReadMore ? ' <span class="invisible">' . $objArticle->headline . '</span>' : '')
            );
        }

        /** @var StringUtil $stringUtilAdapter */
        $stringUtilAdapter = $this->framework->getAdapter(StringUtil::class);

        // Encode e-mail addresses.
        if (substr($objArticle->url, 0, 7) === 'mailto:') {
            $strArticleUrl = $stringUtilAdapter->encodeEmail($objArticle->url);
        } else {
        // Ampersand URIs.
            $strArticleUrl = ampersand($objArticle->url);
        }

        // External link.
        return sprintf(
            '<a href="%s" title="%s"%s>%s</a>',
            $strArticleUrl,
            specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['open'], $strArticleUrl)),
            $objArticle->target ? ' target="_blank"' : '',
            $strLink
        );
    }
protected function generateLink ( EventDispatcherInterface $ eventDispatcher , $ strLink , $ objArticle , $ blnAddArchive = false , $ blnIsReadMore = false ) { // Internal link. if ( $ objArticle -> source !== 'external' ) { return sprintf ( '<a href="%s" title="%s">%s%s</a>' , $ this -> generateNewsUrl ( $ eventDispatcher , $ objArticle , $ blnAddArchive ) , specialchars ( sprintf ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'readMore' ] , $ objArticle -> headline ) , true ) , $ strLink , ( $ blnIsReadMore ? ' <span class="invisible">' . $ objArticle -> headline . '</span>' : '' ) ) ; } /** @var StringUtil $stringUtilAdapter */ $ stringUtilAdapter = $ this -> framework -> getAdapter ( StringUtil :: class ) ; // Encode e-mail addresses. if ( substr ( $ objArticle -> url , 0 , 7 ) === 'mailto:' ) { $ strArticleUrl = $ stringUtilAdapter -> encodeEmail ( $ objArticle -> url ) ; } else { // Ampersand URIs. $ strArticleUrl = ampersand ( $ objArticle -> url ) ; } // External link. return sprintf ( '<a href="%s" title="%s"%s>%s</a>' , $ strArticleUrl , specialchars ( sprintf ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'open' ] , $ strArticleUrl ) ) , $ objArticle -> target ? ' target="_blank"' : '' , $ strLink ) ; }
Generate a link and return it as string.

@param EventDispatcherInterface $eventDispatcher The event dispatcher.

@param string                   $strLink         The link text.

@param NewsModel                $objArticle      The model.

@param bool                     $blnAddArchive   Add the current archive parameter (news archive)
(default: false).

@param bool                     $blnIsReadMore   Determine if the link is a "read more" link.

@return string

@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName)
Generate a link and return it as string .