From 9699b5bf6d05638e73d3a57d9bef78fc45f0cdae Mon Sep 17 00:00:00 2001 From: DigiLive Date: Thu, 10 Dec 2020 08:00:07 +0100 Subject: [PATCH] Document methods * Add missing documentation. * Fixes and reformatting. --- lib/jblond/Diff.php | 3 +-- lib/jblond/Diff/Renderer/MainRenderer.php | 4 ++-- lib/jblond/Diff/SequenceMatcher.php | 28 ++++++++--------------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/lib/jblond/Diff.php b/lib/jblond/Diff.php index fce45e2..69125dd 100644 --- a/lib/jblond/Diff.php +++ b/lib/jblond/Diff.php @@ -46,8 +46,7 @@ class Diff private $groupedCodes; /** - * @var array Associative array containing the default options available - * for the diff class and their default value. + * @var array Associative array containing the default options available for the diff class and their default value. * * - context The amount of lines to include around blocks that differ. * - trimEqual Strip blocks of equal lines from the start and end of the text. diff --git a/lib/jblond/Diff/Renderer/MainRenderer.php b/lib/jblond/Diff/Renderer/MainRenderer.php index 7399e0c..64f1aca 100644 --- a/lib/jblond/Diff/Renderer/MainRenderer.php +++ b/lib/jblond/Diff/Renderer/MainRenderer.php @@ -124,7 +124,7 @@ protected function renderSequences(): array * 4 - The end line in the second sequence. * * The different types of tags include: - * replace - The string from $startOld to $endOld in $oldText should be replaced by + * replace - The string in $oldText from $startOld to $endOld, should be replaced by * the string in $newText from $startNew to $endNew. * delete - The string in $oldText from $startOld to $endNew should be deleted. * insert - The string in $newText from $startNew to $endNew should be inserted at $startOld in @@ -291,7 +291,7 @@ public function sequenceToArray(string $pattern, string $sequence): array * E.g. *
      *         1234567
-     * OLd => "abcdefg" Start marker inserted at position 3
+     * Old => "abcdefg" Start marker inserted at position 3
      * New => "ab123fg"   End marker inserted at position 6
      * 
* diff --git a/lib/jblond/Diff/SequenceMatcher.php b/lib/jblond/Diff/SequenceMatcher.php index 1e5fc92..a9e40f6 100644 --- a/lib/jblond/Diff/SequenceMatcher.php +++ b/lib/jblond/Diff/SequenceMatcher.php @@ -46,17 +46,12 @@ class SequenceMatcher private $b2j = []; /** - * @var array - */ - private $options = []; - - /** - * @var null|array + * @var array A list of all of the op-codes for the differences between the compared strings. */ private $opCodes; /** - * @var null|array + * @var array A nested set of arrays for all of the matching sub-sequences the compared strings. */ private $matchingBlocks; @@ -72,9 +67,8 @@ class SequenceMatcher ]; /** - * The constructor. With the sequences being passed, they'll be set for the - * sequence matcher and it will perform a basic cleanup & calculate junk - * elements. + * The constructor. With the sequences being passed, they'll be set for the sequence matcher and it will perform a + * basic cleanup & calculate junk elements. * * @param string|array $old A string or array containing the lines to compare against. * @param string|array $new A string or array containing the lines to compare. @@ -295,11 +289,9 @@ public function getGroupedOpCodes(): array } /** - * Return a list of all of the op codes for the differences between the - * two strings. + * Return a list of all of the op codes for the differences between the two strings. * - * The nested array returned contains an array describing the op code - * which includes: + * The nested array returned contains an array describing the op code which includes: * 0 - The type of tag (as described below) for the op code. * 1 - The beginning line in the first sequence. * 2 - The end line in the first sequence. @@ -366,12 +358,10 @@ public function getOpCodes(): array } /** - * Return a nested set of arrays for all of the matching sub-sequences - * in the strings $a and $b. + * Return a nested set of arrays for all of the matching sub-sequences in compared strings $a and $b. * - * Each block contains the lower constraint of the block in $a, the lower - * constraint of the block in $b and finally the number of lines that the - * block continues for. + * Each block contains the lower constraint of the block in $a, the lower constraint of the block in $b and finally + * the number of lines that the block continues for. * * @return array Nested array of the matching blocks, as described by the function. */