[TASK] Move signals to own emit functions 52/31452/2
authorNicole Cordes <typo3@cordes.co>
Mon, 7 Jul 2014 07:49:33 +0000 (09:49 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 7 Jul 2014 17:50:46 +0000 (19:50 +0200)
Two new signals were introduced with the patch
https://review.typo3.org/#/c/27746/. This patch moves the dispatch of
the signals into own functions to improve the tracing of signals.

Resolves: #60133
Releases: 6.3, 6.2
Change-Id: Iecb7ff25ec31556c939dff6b0cf8749ebd3ff997
Reviewed-on: https://review.typo3.org/31452
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/core/Classes/Database/SoftReferenceIndex.php

index 594ce55..415d868 100644 (file)
@@ -603,7 +603,7 @@ class SoftReferenceIndex {
 
                // Dispatch available signal slots.
                $linkHandlerFound = FALSE;
-               list($linkHandlerFound, $finalTagParts) = $this->getSignalSlotDispatcher()->dispatch(get_class($this), 'getTypoLinkParts', array($linkHandlerFound, $finalTagParts, $linkHandlerKeyword, $linkHandlerValue));
+               list($linkHandlerFound, $finalTagParts) = $this->emitGetTypoLinkParts($linkHandlerFound, $finalTagParts, $linkHandlerKeyword, $linkHandlerValue);
                if ($linkHandlerFound) {
                        return $finalTagParts;
                }
@@ -788,7 +788,7 @@ class SoftReferenceIndex {
                                break;
                        default:
                                $linkHandlerFound = FALSE;
-                               list($linkHandlerFound, $tLP, $content, $newElements) = $this->getSignalSlotDispatcher()->dispatch(get_class($this), 'setTypoLinkPartsElement', array($linkHandlerFound, $tLP, $content, $elements, $idx, $tokenID, $this));
+                               list($linkHandlerFound, $tLP, $content, $newElements) = $this->emitSetTypoLinkPartsElement($linkHandlerFound, $tLP, $content, $elements, $idx, $tokenID);
                                // We need to merge the array, otherwise we would loose the reference.
                                \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($elements, $newElements);
 
@@ -844,4 +844,28 @@ class SoftReferenceIndex {
                return GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\Dispatcher');
        }
 
+       /**
+        * @param bool $linkHandlerFound
+        * @param array $finalTagParts
+        * @param string $linkHandlerKeyword
+        * @param string $linkHandlerValue
+        * @return array
+        */
+       protected function emitGetTypoLinkParts($linkHandlerFound, $finalTagParts, $linkHandlerKeyword, $linkHandlerValue) {
+               return $this->getSignalSlotDispatcher()->dispatch(get_class($this), 'getTypoLinkParts', array($linkHandlerFound, $finalTagParts, $linkHandlerKeyword, $linkHandlerValue));
+       }
+
+       /**
+        * @param bool $linkHandlerFound
+        * @param array $tLP
+        * @param string $content
+        * @param array $elements
+        * @param int $idx
+        * @param string $tokenID
+        * @return array
+        */
+       protected function emitSetTypoLinkPartsElement($linkHandlerFound, $tLP, $content, $elements, $idx, $tokenID) {
+               return $this->getSignalSlotDispatcher()->dispatch(get_class($this), 'setTypoLinkPartsElement', array($linkHandlerFound, $tLP, $content, $elements, $idx, $tokenID, $this));
+       }
+
 }