Skip to content

Commit

Permalink
Document methods
Browse files Browse the repository at this point in the history
* Add missing documentation.
* Fixes and reformatting.
  • Loading branch information
DigiLive authored and JBlond committed Jan 19, 2021
1 parent f4cf709 commit 9699b5b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
3 changes: 1 addition & 2 deletions lib/jblond/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ class Diff
private $groupedCodes;

/**
* @var array<string, string> 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.
Expand Down
4 changes: 2 additions & 2 deletions lib/jblond/Diff/Renderer/MainRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -291,7 +291,7 @@ public function sequenceToArray(string $pattern, string $sequence): array
* E.g.
* <pre>
* 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
* </pre>
*
Expand Down
28 changes: 9 additions & 19 deletions lib/jblond/Diff/SequenceMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*/
Expand Down

0 comments on commit 9699b5b

Please sign in to comment.