@@ -54,6 +54,9 @@ class ParsedownExtended extends \ParsedownExtendedParentAlias
5454 /** @var bool $predefinedAbbreviationsAdded Tracks whether predefined abbreviations have been merged */
5555 private bool $ predefinedAbbreviationsAdded = false ;
5656
57+ /** @var array|null $internalHostsSet Cached set of internal hosts for link processing */
58+ private ?array $ internalHostsSet = null ;
59+
5760 /** @var array CONFIG_SCHEMA_DEFAULT Default configuration schema */
5861 private const CONFIG_SCHEMA_DEFAULT = [
5962 'abbreviations ' => [
@@ -555,20 +558,19 @@ private function isExternalLink(string $href): bool
555558 }
556559
557560 // Use cache for internal hosts set
558- $ internalHostsSet = null ;
559- if ($ internalHostsSet === null ) {
560- $ internalHostsSet = [];
561- $ internalHosts = $ this ->config ()->get ('links.external_links.internal_hosts ' );
562- foreach ($ internalHosts as $ h ) {
561+ if ($ this ->internalHostsSet === null ) {
562+ $ this ->internalHostsSet = [];
563+ $ this ->internalHosts = $ this ->config ()->get ('links.external_links.internal_hosts ' );
564+ foreach ($ this ->internalHosts as $ h ) {
563565 $ h = strtolower ($ h );
564566 if (strpos ($ h , 'www. ' ) === 0 ) {
565567 $ h = substr ($ h , 4 );
566568 }
567- $ internalHostsSet [$ h ] = true ;
569+ $ this -> internalHostsSet [$ h ] = true ;
568570 }
569571 }
570572
571- return !isset ($ internalHostsSet [$ host ]);
573+ return !isset ($ this -> internalHostsSet [$ host ]);
572574 }
573575
574576 /**
0 commit comments