Conditions | 100 |
Paths | > 20000 |
Total Lines | 498 |
Code Lines | 332 |
Lines | 167 |
Ratio | 33.53 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
605 | public static function finishCurrentSpan(&$result, $theEnd = false) { |
||
606 | $textSpan = substr($result, self::$posSpanStart); |
||
607 | $result = substr($result, 0, self::$posSpanStart); |
||
608 | |||
609 | // Get rid of empty spans, so that our check for presence of RTL will work |
||
610 | $result = str_replace([self::$startLTR . self::$endLTR, self::$startRTL . self::$endRTL], '', $result); |
||
611 | |||
612 | // Look for numeric strings that are times (hh:mm:ss). These have to be separated from surrounding numbers. |
||
613 | $tempResult = ''; |
||
614 | while ($textSpan != '') { |
||
615 | $posColon = strpos($textSpan, ':'); |
||
616 | if ($posColon === false) { |
||
617 | break; |
||
618 | } // No more possible time strings |
||
619 | $posLRE = strpos($textSpan, WT_UTF8_LRE); |
||
620 | if ($posLRE === false) { |
||
621 | break; |
||
622 | } // No more numeric strings |
||
623 | $posPDF = strpos($textSpan, WT_UTF8_PDF, $posLRE); |
||
624 | if ($posPDF === false) { |
||
625 | break; |
||
626 | } // No more numeric strings |
||
627 | |||
628 | $tempResult .= substr($textSpan, 0, $posLRE + 3); // Copy everything preceding the numeric string |
||
629 | $numericString = substr($textSpan, $posLRE + 3, $posPDF - $posLRE); // Separate the entire numeric string |
||
630 | $textSpan = substr($textSpan, $posPDF + 3); |
||
631 | $posColon = strpos($numericString, ':'); |
||
632 | if ($posColon === false) { |
||
633 | // Nothing that looks like a time here |
||
634 | $tempResult .= $numericString; |
||
635 | continue; |
||
636 | } |
||
637 | $posBlank = strpos($numericString . ' ', ' '); |
||
638 | $posNbsp = strpos($numericString . ' ', ' '); |
||
639 | if ($posBlank < $posNbsp) { |
||
640 | $posSeparator = $posBlank; |
||
641 | $lengthSeparator = 1; |
||
642 | } else { |
||
643 | $posSeparator = $posNbsp; |
||
644 | $lengthSeparator = 6; |
||
645 | } |
||
646 | if ($posColon > $posSeparator) { |
||
647 | // We have a time string preceded by a blank: Exclude that blank from the numeric string |
||
648 | $tempResult .= substr($numericString, 0, $posSeparator); |
||
649 | $tempResult .= WT_UTF8_PDF; |
||
650 | $tempResult .= substr($numericString, $posSeparator, $lengthSeparator); |
||
651 | $tempResult .= WT_UTF8_LRE; |
||
652 | $numericString = substr($numericString, $posSeparator + $lengthSeparator); |
||
653 | } |
||
654 | |||
655 | $posBlank = strpos($numericString, ' '); |
||
656 | $posNbsp = strpos($numericString, ' '); |
||
657 | if ($posBlank === false && $posNbsp === false) { |
||
658 | // The time string isn't followed by a blank |
||
659 | $textSpan = $numericString . $textSpan; |
||
660 | continue; |
||
661 | } |
||
662 | |||
663 | // We have a time string followed by a blank: Exclude that blank from the numeric string |
||
664 | if ($posBlank === false) { |
||
665 | $posSeparator = $posNbsp; |
||
666 | $lengthSeparator = 6; |
||
667 | } elseif ($posNbsp === false) { |
||
668 | $posSeparator = $posBlank; |
||
669 | $lengthSeparator = 1; |
||
670 | } elseif ($posBlank < $posNbsp) { |
||
671 | $posSeparator = $posBlank; |
||
672 | $lengthSeparator = 1; |
||
673 | } else { |
||
674 | $posSeparator = $posNbsp; |
||
675 | $lengthSeparator = 6; |
||
676 | } |
||
677 | $tempResult .= substr($numericString, 0, $posSeparator); |
||
678 | $tempResult .= WT_UTF8_PDF; |
||
679 | $tempResult .= substr($numericString, $posSeparator, $lengthSeparator); |
||
680 | $posSeparator += $lengthSeparator; |
||
681 | $numericString = substr($numericString, $posSeparator); |
||
682 | $textSpan = WT_UTF8_LRE . $numericString . $textSpan; |
||
683 | } |
||
684 | $textSpan = $tempResult . $textSpan; |
||
685 | $trailingBlanks = ''; |
||
686 | $trailingBreaks = ''; |
||
687 | |||
688 | /* ****************************** LTR text handling ******************************** */ |
||
689 | |||
690 | if (self::$currentState === 'LTR') { |
||
691 | // Move trailing numeric strings to the following RTL text. Include any blanks preceding or following the numeric text too. |
||
692 | View Code Duplication | if (I18N::direction() === 'rtl' && self::$previousState === 'RTL' && !$theEnd) { |
|
693 | $trailingString = ''; |
||
694 | $savedSpan = $textSpan; |
||
695 | while ($textSpan !== '') { |
||
696 | // Look for trailing spaces and tentatively move them |
||
697 | if (substr($textSpan, -1) === ' ') { |
||
698 | $trailingString = ' ' . $trailingString; |
||
699 | $textSpan = substr($textSpan, 0, -1); |
||
700 | continue; |
||
701 | } |
||
702 | if (substr($textSpan, -6) === ' ') { |
||
703 | $trailingString = ' ' . $trailingString; |
||
704 | $textSpan = substr($textSpan, 0, -1); |
||
705 | continue; |
||
706 | } |
||
707 | if (substr($textSpan, -3) !== WT_UTF8_PDF) { |
||
708 | // There is no trailing numeric string |
||
709 | $textSpan = $savedSpan; |
||
710 | break; |
||
711 | } |
||
712 | |||
713 | // We have a numeric string |
||
714 | $posStartNumber = strrpos($textSpan, WT_UTF8_LRE); |
||
715 | if ($posStartNumber === false) { |
||
716 | $posStartNumber = 0; |
||
717 | } |
||
718 | $trailingString = substr($textSpan, $posStartNumber, strlen($textSpan) - $posStartNumber) . $trailingString; |
||
719 | $textSpan = substr($textSpan, 0, $posStartNumber); |
||
720 | |||
721 | // Look for more spaces and move them too |
||
722 | while ($textSpan != '') { |
||
723 | if (substr($textSpan, -1) == ' ') { |
||
724 | $trailingString = ' ' . $trailingString; |
||
725 | $textSpan = substr($textSpan, 0, -1); |
||
726 | continue; |
||
727 | } |
||
728 | if (substr($textSpan, -6) == ' ') { |
||
729 | $trailingString = ' ' . $trailingString; |
||
730 | $textSpan = substr($textSpan, 0, -1); |
||
731 | continue; |
||
732 | } |
||
733 | break; |
||
734 | } |
||
735 | |||
736 | self::$waitingText = $trailingString . self::$waitingText; |
||
737 | break; |
||
738 | } |
||
739 | } |
||
740 | |||
741 | $savedSpan = $textSpan; |
||
742 | // Move any trailing <br>, optionally preceded or followed by blanks, outside this LTR span |
||
743 | while ($textSpan != '') { |
||
744 | if (substr($textSpan, -1) == ' ') { |
||
745 | $trailingBlanks = ' ' . $trailingBlanks; |
||
746 | $textSpan = substr($textSpan, 0, -1); |
||
747 | continue; |
||
748 | } |
||
749 | if (substr('......' . $textSpan, -6) == ' ') { |
||
750 | $trailingBlanks = ' ' . $trailingBlanks; |
||
751 | $textSpan = substr($textSpan, 0, -6); |
||
752 | continue; |
||
753 | } |
||
754 | break; |
||
755 | } |
||
756 | View Code Duplication | while (substr($textSpan, -9) == '<LTRbr>') { |
|
757 | $trailingBreaks = '<br>' . $trailingBreaks; // Plain <br> because it’s outside a span |
||
758 | $textSpan = substr($textSpan, 0, -9); |
||
759 | } |
||
760 | if ($trailingBreaks != '') { |
||
761 | while ($textSpan != '') { |
||
762 | if (substr($textSpan, -1) == ' ') { |
||
763 | $trailingBreaks = ' ' . $trailingBreaks; |
||
764 | $textSpan = substr($textSpan, 0, -1); |
||
765 | continue; |
||
766 | } |
||
767 | if (substr('......' . $textSpan, -6) == ' ') { |
||
768 | $trailingBreaks = ' ' . $trailingBreaks; |
||
769 | $textSpan = substr($textSpan, 0, -6); |
||
770 | continue; |
||
771 | } |
||
772 | break; |
||
773 | } |
||
774 | self::$waitingText = $trailingBlanks . self::$waitingText; // Put those trailing blanks inside the following span |
||
775 | } else { |
||
776 | $textSpan = $savedSpan; |
||
777 | } |
||
778 | |||
779 | $trailingBlanks = ''; |
||
780 | $trailingPunctuation = ''; |
||
781 | $trailingID = ''; |
||
782 | $trailingSeparator = ''; |
||
783 | $leadingSeparator = ''; |
||
784 | while (I18N::direction() === 'rtl') { |
||
785 | if (strpos($result, self::$startRTL) !== false) { |
||
786 | // Remove trailing blanks for inclusion in a separate LTR span |
||
787 | while ($textSpan != '') { |
||
788 | if (substr($textSpan, -1) === ' ') { |
||
789 | $trailingBlanks = ' ' . $trailingBlanks; |
||
790 | $textSpan = substr($textSpan, 0, -1); |
||
791 | continue; |
||
792 | } |
||
793 | if (substr($textSpan, -6) === ' ') { |
||
794 | $trailingBlanks = ' ' . $trailingBlanks; |
||
795 | $textSpan = substr($textSpan, 0, -1); |
||
796 | continue; |
||
797 | } |
||
798 | break; |
||
799 | } |
||
800 | |||
801 | // Remove trailing punctuation for inclusion in a separate LTR span |
||
802 | if ($textSpan == '') { |
||
803 | $trailingChar = "\n"; |
||
804 | } else { |
||
805 | $trailingChar = substr($textSpan, -1); |
||
806 | } |
||
807 | if (strpos(self::PUNCTUATION, $trailingChar) !== false) { |
||
808 | $trailingPunctuation = $trailingChar; |
||
809 | $textSpan = substr($textSpan, 0, -1); |
||
810 | } |
||
811 | } |
||
812 | |||
813 | // Remove trailing ID numbers that look like "(xnnn)" for inclusion in a separate LTR span |
||
814 | while (true) { |
||
815 | if (substr($textSpan, -1) != ')') { |
||
816 | break; |
||
817 | } // There is no trailing ')' |
||
818 | $posLeftParen = strrpos($textSpan, '('); |
||
819 | if ($posLeftParen === false) { |
||
820 | break; |
||
821 | } // There is no leading '(' |
||
822 | $temp = self::stripLrmRlm(substr($textSpan, $posLeftParen)); // Get rid of UTF8 control codes |
||
823 | |||
824 | // If the parenthesized text doesn't look like an ID number, |
||
825 | // we don't want to touch it. |
||
826 | // This check won’t work if somebody uses ID numbers with an unusual format. |
||
827 | $offset = 1; |
||
828 | $charArray = self::getChar($temp, $offset); // Get 1st character of parenthesized text |
||
829 | if (strpos(self::NUMBERS, $charArray['letter']) !== false) { |
||
830 | break; |
||
831 | } |
||
832 | $offset += $charArray['length']; // Point at 2nd character of parenthesized text |
||
833 | if (strpos(self::NUMBERS, substr($temp, $offset, 1)) === false) { |
||
834 | break; |
||
835 | } |
||
836 | // 1st character of parenthesized text is alpha, 2nd character is a digit; last has to be a digit too |
||
837 | if (strpos(self::NUMBERS, substr($temp, -2, 1)) === false) { |
||
838 | break; |
||
839 | } |
||
840 | |||
841 | $trailingID = substr($textSpan, $posLeftParen); |
||
842 | $textSpan = substr($textSpan, 0, $posLeftParen); |
||
843 | break; |
||
844 | } |
||
845 | |||
846 | // Look for " - " or blank preceding the ID number and remove it for inclusion in a separate LTR span |
||
847 | if ($trailingID != '') { |
||
848 | while ($textSpan != '') { |
||
849 | View Code Duplication | if (substr($textSpan, -1) == ' ') { |
|
850 | $trailingSeparator = ' ' . $trailingSeparator; |
||
851 | $textSpan = substr($textSpan, 0, -1); |
||
852 | continue; |
||
853 | } |
||
854 | View Code Duplication | if (substr($textSpan, -6) == ' ') { |
|
855 | $trailingSeparator = ' ' . $trailingSeparator; |
||
856 | $textSpan = substr($textSpan, 0, -6); |
||
857 | continue; |
||
858 | } |
||
859 | View Code Duplication | if (substr($textSpan, -1) == '-') { |
|
860 | $trailingSeparator = '-' . $trailingSeparator; |
||
861 | $textSpan = substr($textSpan, 0, -1); |
||
862 | continue; |
||
863 | } |
||
864 | break; |
||
865 | } |
||
866 | } |
||
867 | |||
868 | // Look for " - " preceding the text and remove it for inclusion in a separate LTR span |
||
869 | $foundSeparator = false; |
||
870 | $savedSpan = $textSpan; |
||
871 | while ($textSpan != '') { |
||
872 | View Code Duplication | if (substr($textSpan, 0, 1) == ' ') { |
|
873 | $leadingSeparator = ' ' . $leadingSeparator; |
||
874 | $textSpan = substr($textSpan, 1); |
||
875 | continue; |
||
876 | } |
||
877 | View Code Duplication | if (substr($textSpan, 0, 6) == ' ') { |
|
878 | $leadingSeparator = ' ' . $leadingSeparator; |
||
879 | $textSpan = substr($textSpan, 6); |
||
880 | continue; |
||
881 | } |
||
882 | View Code Duplication | if (substr($textSpan, 0, 1) == '-') { |
|
883 | $leadingSeparator = '-' . $leadingSeparator; |
||
884 | $textSpan = substr($textSpan, 1); |
||
885 | $foundSeparator = true; |
||
886 | continue; |
||
887 | } |
||
888 | break; |
||
889 | } |
||
890 | if (!$foundSeparator) { |
||
891 | $textSpan = $savedSpan; |
||
892 | $leadingSeparator = ''; |
||
893 | } |
||
894 | break; |
||
895 | } |
||
896 | |||
897 | // We're done: finish the span |
||
898 | $textSpan = self::starredName($textSpan, 'LTR'); // Wrap starred name in <u> and </u> tags |
||
899 | View Code Duplication | while (true) { |
|
900 | // Remove blanks that precede <LTRbr> |
||
901 | if (strpos($textSpan, ' <LTRbr>') !== false) { |
||
902 | $textSpan = str_replace(' <LTRbr>', '<LTRbr>', $textSpan); |
||
903 | continue; |
||
904 | } |
||
905 | if (strpos($textSpan, ' <LTRbr>') !== false) { |
||
906 | $textSpan = str_replace(' <LTRbr>', '<LTRbr>', $textSpan); |
||
907 | continue; |
||
908 | } |
||
909 | break; |
||
910 | } |
||
911 | if ($leadingSeparator != '') { |
||
912 | $result = $result . self::$startLTR . $leadingSeparator . self::$endLTR; |
||
913 | } |
||
914 | $result = $result . $textSpan . self::$endLTR; |
||
915 | if ($trailingSeparator != '') { |
||
916 | $result = $result . self::$startLTR . $trailingSeparator . self::$endLTR; |
||
917 | } |
||
918 | if ($trailingID != '') { |
||
919 | $result = $result . self::$startLTR . $trailingID . self::$endLTR; |
||
920 | } |
||
921 | if ($trailingPunctuation != '') { |
||
922 | $result = $result . self::$startLTR . $trailingPunctuation . self::$endLTR; |
||
923 | } |
||
924 | if ($trailingBlanks != '') { |
||
925 | $result = $result . self::$startLTR . $trailingBlanks . self::$endLTR; |
||
926 | } |
||
927 | } |
||
928 | |||
929 | /* ****************************** RTL text handling ******************************** */ |
||
930 | |||
931 | if (self::$currentState == 'RTL') { |
||
932 | $savedSpan = $textSpan; |
||
933 | |||
934 | // Move any trailing <br>, optionally followed by blanks, outside this RTL span |
||
935 | while ($textSpan != '') { |
||
936 | if (substr($textSpan, -1) == ' ') { |
||
937 | $trailingBlanks = ' ' . $trailingBlanks; |
||
938 | $textSpan = substr($textSpan, 0, -1); |
||
939 | continue; |
||
940 | } |
||
941 | if (substr('......' . $textSpan, -6) == ' ') { |
||
942 | $trailingBlanks = ' ' . $trailingBlanks; |
||
943 | $textSpan = substr($textSpan, 0, -6); |
||
944 | continue; |
||
945 | } |
||
946 | break; |
||
947 | } |
||
948 | View Code Duplication | while (substr($textSpan, -9) == '<RTLbr>') { |
|
949 | $trailingBreaks = '<br>' . $trailingBreaks; // Plain <br> because it’s outside a span |
||
950 | $textSpan = substr($textSpan, 0, -9); |
||
951 | } |
||
952 | if ($trailingBreaks != '') { |
||
953 | self::$waitingText = $trailingBlanks . self::$waitingText; // Put those trailing blanks inside the following span |
||
954 | } else { |
||
955 | $textSpan = $savedSpan; |
||
956 | } |
||
957 | |||
958 | // Move trailing numeric strings to the following LTR text. Include any blanks preceding or following the numeric text too. |
||
959 | View Code Duplication | if (!$theEnd && I18N::direction() !== 'rtl') { |
|
960 | $trailingString = ''; |
||
961 | $savedSpan = $textSpan; |
||
962 | while ($textSpan != '') { |
||
963 | // Look for trailing spaces and tentatively move them |
||
964 | if (substr($textSpan, -1) === ' ') { |
||
965 | $trailingString = ' ' . $trailingString; |
||
966 | $textSpan = substr($textSpan, 0, -1); |
||
967 | continue; |
||
968 | } |
||
969 | if (substr($textSpan, -6) === ' ') { |
||
970 | $trailingString = ' ' . $trailingString; |
||
971 | $textSpan = substr($textSpan, 0, -1); |
||
972 | continue; |
||
973 | } |
||
974 | if (substr($textSpan, -3) !== WT_UTF8_PDF) { |
||
975 | // There is no trailing numeric string |
||
976 | $textSpan = $savedSpan; |
||
977 | break; |
||
978 | } |
||
979 | |||
980 | // We have a numeric string |
||
981 | $posStartNumber = strrpos($textSpan, WT_UTF8_LRE); |
||
982 | if ($posStartNumber === false) { |
||
983 | $posStartNumber = 0; |
||
984 | } |
||
985 | $trailingString = substr($textSpan, $posStartNumber, strlen($textSpan) - $posStartNumber) . $trailingString; |
||
986 | $textSpan = substr($textSpan, 0, $posStartNumber); |
||
987 | |||
988 | // Look for more spaces and move them too |
||
989 | while ($textSpan != '') { |
||
990 | if (substr($textSpan, -1) == ' ') { |
||
991 | $trailingString = ' ' . $trailingString; |
||
992 | $textSpan = substr($textSpan, 0, -1); |
||
993 | continue; |
||
994 | } |
||
995 | if (substr($textSpan, -6) == ' ') { |
||
996 | $trailingString = ' ' . $trailingString; |
||
997 | $textSpan = substr($textSpan, 0, -1); |
||
998 | continue; |
||
999 | } |
||
1000 | break; |
||
1001 | } |
||
1002 | |||
1003 | self::$waitingText = $trailingString . self::$waitingText; |
||
1004 | break; |
||
1005 | } |
||
1006 | } |
||
1007 | |||
1008 | // Trailing " - " needs to be prefixed to the following span |
||
1009 | if (!$theEnd && substr('...' . $textSpan, -3) == ' - ') { |
||
1010 | $textSpan = substr($textSpan, 0, -3); |
||
1011 | self::$waitingText = ' - ' . self::$waitingText; |
||
1012 | } |
||
1013 | |||
1014 | while (I18N::direction() === 'rtl') { |
||
1015 | // Look for " - " preceding <RTLbr> and relocate it to the front of the string |
||
1016 | $posDashString = strpos($textSpan, ' - <RTLbr>'); |
||
1017 | if ($posDashString === false) { |
||
1018 | break; |
||
1019 | } |
||
1020 | $posStringStart = strrpos(substr($textSpan, 0, $posDashString), '<RTLbr>'); |
||
1021 | if ($posStringStart === false) { |
||
1022 | $posStringStart = 0; |
||
1023 | } else { |
||
1024 | $posStringStart += 9; |
||
1025 | } // Point to the first char following the last <RTLbr> |
||
1026 | |||
1027 | $textSpan = substr($textSpan, 0, $posStringStart) . ' - ' . substr($textSpan, $posStringStart, $posDashString - $posStringStart) . substr($textSpan, $posDashString + 3); |
||
1028 | } |
||
1029 | |||
1030 | // Strip leading spaces from the RTL text |
||
1031 | $countLeadingSpaces = 0; |
||
1032 | while ($textSpan != '') { |
||
1033 | View Code Duplication | if (substr($textSpan, 0, 1) == ' ') { |
|
1034 | $countLeadingSpaces++; |
||
1035 | $textSpan = substr($textSpan, 1); |
||
1036 | continue; |
||
1037 | } |
||
1038 | View Code Duplication | if (substr($textSpan, 0, 6) == ' ') { |
|
1039 | $countLeadingSpaces++; |
||
1040 | $textSpan = substr($textSpan, 6); |
||
1041 | continue; |
||
1042 | } |
||
1043 | break; |
||
1044 | } |
||
1045 | |||
1046 | // Strip trailing spaces from the RTL text |
||
1047 | $countTrailingSpaces = 0; |
||
1048 | while ($textSpan != '') { |
||
1049 | View Code Duplication | if (substr($textSpan, -1) == ' ') { |
|
1050 | $countTrailingSpaces++; |
||
1051 | $textSpan = substr($textSpan, 0, -1); |
||
1052 | continue; |
||
1053 | } |
||
1054 | View Code Duplication | if (substr($textSpan, -6) == ' ') { |
|
1055 | $countTrailingSpaces++; |
||
1056 | $textSpan = substr($textSpan, 0, -6); |
||
1057 | continue; |
||
1058 | } |
||
1059 | break; |
||
1060 | } |
||
1061 | |||
1062 | // Look for trailing " -", reverse it, and relocate it to the front of the string |
||
1063 | if (substr($textSpan, -2) === ' -') { |
||
1064 | $posDashString = strlen($textSpan) - 2; |
||
1065 | $posStringStart = strrpos(substr($textSpan, 0, $posDashString), '<RTLbr>'); |
||
1066 | if ($posStringStart === false) { |
||
1067 | $posStringStart = 0; |
||
1068 | } else { |
||
1069 | $posStringStart += 9; |
||
1070 | } // Point to the first char following the last <RTLbr> |
||
1071 | |||
1072 | $textSpan = substr($textSpan, 0, $posStringStart) . '- ' . substr($textSpan, $posStringStart, $posDashString - $posStringStart) . substr($textSpan, $posDashString + 2); |
||
1073 | } |
||
1074 | |||
1075 | if ($countLeadingSpaces != 0) { |
||
1076 | $newLength = strlen($textSpan) + $countLeadingSpaces; |
||
1077 | $textSpan = str_pad($textSpan, $newLength, ' ', (I18N::direction() === 'rtl' ? STR_PAD_LEFT : STR_PAD_RIGHT)); |
||
1078 | } |
||
1079 | if ($countTrailingSpaces != 0) { |
||
1080 | if (I18N::direction() === 'ltr') { |
||
1081 | if ($trailingBreaks === '') { |
||
1082 | // Move trailing RTL spaces to front of following LTR span |
||
1083 | $newLength = strlen(self::$waitingText) + $countTrailingSpaces; |
||
1084 | self::$waitingText = str_pad(self::$waitingText, $newLength, ' ', STR_PAD_LEFT); |
||
1085 | } |
||
1086 | } else { |
||
1087 | $newLength = strlen($textSpan) + $countTrailingSpaces; |
||
1088 | $textSpan = str_pad($textSpan, $newLength, ' ', STR_PAD_RIGHT); |
||
1089 | } |
||
1090 | } |
||
1091 | |||
1092 | // We're done: finish the span |
||
1093 | $textSpan = self::starredName($textSpan, 'RTL'); // Wrap starred name in <u> and </u> tags |
||
1094 | $result = $result . $textSpan . self::$endRTL; |
||
1095 | } |
||
1096 | |||
1097 | if (self::$currentState != 'LTR' && self::$currentState != 'RTL') { |
||
1098 | $result = $result . $textSpan; |
||
1099 | } |
||
1100 | |||
1101 | $result .= $trailingBreaks; // Get rid of any waiting <br> |
||
1102 | } |
||
1103 | |||
1156 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.