@@ -46,25 +46,25 @@ class Patch
4646 */
4747 protected $ diff ;
4848 /**
49- * @var Match
49+ * @var Matcher
5050 */
51- protected $ match ;
51+ protected $ matcher ;
5252
5353 /**
5454 * @param Diff|null $diff
55- * @param Match |null $match
55+ * @param Matcher |null $matcher
5656 */
57- public function __construct (Diff $ diff = null , Match $ match = null )
57+ public function __construct (Diff $ diff = null , Matcher $ matcher = null )
5858 {
59- if (!isset ($ match )) {
60- $ match = new Match ();
59+ if (!isset ($ matcher )) {
60+ $ matcher = new Matcher ();
6161 }
6262 if (!isset ($ diff )) {
6363 $ diff = new Diff ();
6464 }
6565
6666 $ this ->diff = $ diff ;
67- $ this ->match = $ match ;
67+ $ this ->matcher = $ matcher ;
6868 }
6969
7070 /**
@@ -100,11 +100,11 @@ public function setMargin($margin)
100100 }
101101
102102 /**
103- * @return Match
103+ * @return Matcher
104104 */
105- protected function getMatch ()
105+ protected function getMatcher ()
106106 {
107- return $ this ->match ;
107+ return $ this ->matcher ;
108108 }
109109
110110 /**
@@ -233,10 +233,10 @@ public function addContext(PatchObject $patch, $text)
233233
234234 // Look for the first and last matches of pattern in text.
235235 // If two different matches are found, increase the pattern length.
236- $ match = $ this ->getMatch ();
236+ $ matcher = $ this ->getMatcher ();
237237 while (
238238 (!$ pattern || mb_strpos ($ text , $ pattern ) !== mb_strrpos ($ text , $ pattern )) &&
239- ($ match ->getMaxBits () == 0 || mb_strlen ($ pattern ) < $ match ->getMaxBits () - 2 * $ this ->getMargin ())
239+ ($ matcher ->getMaxBits () == 0 || mb_strlen ($ pattern ) < $ matcher ->getMaxBits () - 2 * $ this ->getMargin ())
240240 ) {
241241 $ padding += $ this ->getMargin ();
242242 $ pattern = mb_substr (
@@ -409,7 +409,7 @@ public function make($a, $b = null, $c = null)
409409 */
410410 public function splitMax (&$ patches )
411411 {
412- $ patchSize = $ this ->getMatch ()->getMaxBits ();
412+ $ patchSize = $ this ->getMatcher ()->getMaxBits ();
413413 if ($ patchSize == 0 ) {
414414 // TODO PHP has fixed size int, so this case isn't relevant.
415415 return ;
@@ -619,8 +619,8 @@ public function apply($patches, $text)
619619 $ delta = 0 ;
620620 $ results = array ();
621621 $ diff = $ this ->getDiff ();
622- $ match = $ this ->getMatch ();
623- $ maxBits = $ match ->getMaxBits ();
622+ $ matcher = $ this ->getMatcher ();
623+ $ maxBits = $ matcher ->getMaxBits ();
624624
625625 foreach ($ patches as $ patch ) {
626626 $ expectedLoc = $ patch ->getStart2 () + $ delta ;
@@ -632,18 +632,18 @@ public function apply($patches, $text)
632632 if ($ text1Len > $ maxBits ) {
633633 // self::splitMax() will only provide an oversized pattern in the case of
634634 // a monster delete.
635- $ startLoc = $ match ->main ($ text , mb_substr ($ text1 , 0 , $ maxBits ), $ expectedLoc );
635+ $ startLoc = $ matcher ->main ($ text , mb_substr ($ text1 , 0 , $ maxBits ), $ expectedLoc );
636636
637637 if ($ startLoc != -1 ) {
638- $ endLoc = $ match ->main ($ text , mb_substr ($ text1 , -$ maxBits ),
638+ $ endLoc = $ matcher ->main ($ text , mb_substr ($ text1 , -$ maxBits ),
639639 $ expectedLoc + $ text1Len - $ maxBits );
640640 if ($ endLoc == -1 || $ startLoc >= $ endLoc ) {
641641 // Can't find valid trailing context. Drop this patch.
642642 $ startLoc = -1 ;
643643 }
644644 }
645645 } else {
646- $ startLoc = $ match ->main ($ text , $ text1 , $ expectedLoc );
646+ $ startLoc = $ matcher ->main ($ text , $ text1 , $ expectedLoc );
647647 }
648648
649649 if ($ startLoc == -1 ) {
0 commit comments