@@ -603,59 +603,6 @@ public function getGroupedOpcodes(int $context = 3) : array
603
603
return $ groups ;
604
604
}
605
605
606
- /**
607
- * Return a measure of the similarity between the two sequences.
608
- * This will be a float value between 0 and 1.
609
- *
610
- * Out of all of the ratio calculation functions, this is the most
611
- * expensive to call if getMatchingBlocks or getOpCodes is yet to be
612
- * called.
613
- *
614
- * The ratio is calculated as (2 * number of matches) / total number of
615
- * elements in both sequences.
616
- *
617
- * @return float The calculated ratio.
618
- */
619
- public function ratio () : float
620
- {
621
- $ matches = array_reduce (
622
- $ this ->getMatchingBlocks (),
623
- function ($ sum , $ triple ) {
624
- return $ this ->ratioReduce ($ sum , $ triple );
625
- },
626
- 0
627
- );
628
- return $ this ->calculateRatio ($ matches , count ($ this ->old ) + count ($ this ->new ));
629
- }
630
-
631
- /**
632
- * Helper function to calculate the number of matches for Ratio().
633
- *
634
- * @param int $sum The running total for the number of matches.
635
- * @param array $triple Array containing the matching block triple to add to the running total.
636
- * @return int The new running total for the number of matches.
637
- */
638
- private function ratioReduce (int $ sum , array $ triple ) : int
639
- {
640
- return $ sum + ($ triple [count ($ triple ) - 1 ]);
641
- }
642
-
643
- /**
644
- * Helper function for calculating the ratio to measure similarity for the strings.
645
- * The ratio is defined as being 2 * (number of matches / total length)
646
- *
647
- * @param int $matches The number of matches in the two strings.
648
- * @param int $length The length of the two strings.
649
- * @return float The calculated ratio.
650
- */
651
- private function calculateRatio (int $ matches , int $ length = 0 ) : float
652
- {
653
- if ($ length ) {
654
- return 2 * ($ matches / $ length );
655
- }
656
- return 1 ;
657
- }
658
-
659
606
/**
660
607
* Helper function that provides the ability to return the value for a key
661
608
* in an array of it exists, or if it doesn't then return a default value.
0 commit comments