forked from chrisboulton/php-diff
-
Notifications
You must be signed in to change notification settings - Fork 4
update doc #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
update doc #47
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,14 +21,14 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2020 Mario Brandt | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
class Diff | ||
{ | ||
|
@@ -50,8 +50,9 @@ class Diff | |
private $groupedCodes; | ||
|
||
/** | ||
* @var array Associative array containing the default options available for the diff class and their default | ||
* value. | ||
* @var array<string> 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. | ||
* - ignoreWhitespace When true, tabs and spaces are ignored while comparing. | ||
|
@@ -111,8 +112,8 @@ public function __construct($version1, $version2, array $options = []) | |
* | ||
* @param mixed $var Variable to get type from. | ||
* | ||
* @return int Number indicating the type of the variable. 0 for array type and 1 for string type. | ||
* @throws InvalidArgumentException When the type isn't 'array' or 'string'. | ||
* @return int Number indicating the type of the variable. 0 for array type and 1 for string type. | ||
* @throws InvalidArgumentException When the type isn't 'array' or 'string'. | ||
* | ||
*/ | ||
public function getArgumentType($var): int | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,11 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff | ||
* @author Mario Brandt <[email protected]> | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond\Diff | ||
* @author Mario Brandt <[email protected]> | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
class DiffUtils | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,20 +11,21 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff\Renderer\Html | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond\Diff\Renderer\Html | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2020 Mario Brandt | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
class HtmlArray extends RendererAbstract | ||
{ | ||
/** | ||
* @var array Associative array containing the default options available for this renderer and their default | ||
* value. | ||
* @var array<string> Associative array containing the default options available | ||
* for this renderer and their default value. | ||
* | ||
* - tabSize The amount of spaces to replace a tab character with. | ||
* - title_a Title of the "old" version of text. | ||
* - title_b Title of the "new" version of text. | ||
|
@@ -46,7 +47,7 @@ class HtmlArray extends RendererAbstract | |
* | ||
* This method is called by the renderers which extends this class. | ||
* | ||
* @param array $changes Contains the op-codes about the differences between "old and "new". | ||
* @param array $changes Contains the op-codes about the differences between "old and "new". | ||
* @param object|Inline|SideBySide|Unified $htmlRenderer Renderer which extends this class. | ||
* | ||
* @return string HTML representation of the differences. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,14 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff\Renderer\Html | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond\Diff\Renderer\Html | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2020 Mario Brandt | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
class Inline extends HtmlArray | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,14 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff\Renderer\Html | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond\Diff\Renderer\Html | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
class SideBySide extends HtmlArray | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,11 @@ | |
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff\Renderer\Html | ||
* @author Mario Brandt <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @copyright (c) 2020 Mario Brandt | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
class Unified extends HtmlArray | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,14 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff\Renderer | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond\Diff\Renderer | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2020 Mario Brandt | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
abstract class RendererAbstract | ||
{ | ||
|
@@ -29,15 +29,15 @@ abstract class RendererAbstract | |
public $diff; | ||
|
||
/** | ||
* @var array Array of the default options that apply to this renderer. | ||
* @var array<string> Array of the default options that apply to this renderer. | ||
*/ | ||
protected $defaultOptions = [ | ||
'title1' => 'Version1', | ||
'title2' => 'Version2', | ||
]; | ||
|
||
/** | ||
* @var array Array containing the user applied and merged default options for the renderer. | ||
* @var array<string> Array containing the user applied and merged default options for the renderer. | ||
*/ | ||
protected $options = []; | ||
|
||
|
@@ -57,7 +57,7 @@ public function __construct(array $options = []) | |
* Options are merged with the default to ensure that there aren't any missing | ||
* options. | ||
* | ||
* @param array $options Array of options to set. | ||
* @param array<string> $options Array of options to set. | ||
*/ | ||
public function setOptions(array $options) | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,14 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff\Renderer\Text | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond\Diff\Renderer\Text | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
class Context extends RendererAbstract | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,13 +11,13 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff\Renderer\Text | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond\Diff\Renderer\Text | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @copyright (c) 2020 Mario Brandt | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
|
||
/** | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,11 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff\Renderer\Text | ||
* @author Mario Brandt <[email protected]> | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond\Diff\Renderer\Text | ||
* @author Mario Brandt <[email protected]> | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
|
||
class UnifiedCli extends RendererAbstract | ||
|
@@ -34,7 +34,7 @@ class UnifiedCli extends RendererAbstract | |
|
||
/** | ||
* UnifiedCli constructor. | ||
* @param array $options | ||
* @param array<string> $options | ||
*/ | ||
public function __construct(array $options = []) | ||
{ | ||
|
@@ -62,11 +62,11 @@ public function render(): string | |
|
||
|
||
/** | ||
* @param $string | ||
* @param string $string | ||
* @param string $color | ||
* @return string | ||
*/ | ||
private function colorizeString($string, $color = ''): string | ||
private function colorizeString(string $string, string $color = ''): string | ||
{ | ||
if (isset($this->options['cliColor']) && $this->options['cliColor'] == 'simple') { | ||
return $this->colors->getColoredString($string, $color); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,14 @@ | |
* | ||
* PHP version 7.2 or greater | ||
* | ||
* @package jblond\Diff | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2009 Chris Boulton | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.0.0 | ||
* @link https://github.com/JBlond/php-diff | ||
* @package jblond\Diff | ||
* @author Chris Boulton <[email protected]> | ||
* @author Mario Brandt <[email protected]> | ||
* @author Ferry Cools <[email protected]> | ||
* @copyright (c) 2020 Mario Brandt | ||
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php | ||
* @version 2.1.0 | ||
* @link https://github.com/JBlond/php-diff | ||
*/ | ||
class SequenceMatcher | ||
{ | ||
|
@@ -79,9 +79,9 @@ class SequenceMatcher | |
* 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. | ||
* @param array $options | ||
* @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. | ||
* @param array $options | ||
* @param string|array|null $junkCallback Either an array or string that references a callback function | ||
* (if there is one) to determine 'junk' characters. | ||
*/ | ||
|
@@ -212,7 +212,7 @@ private function chainB() | |
* for the list of junk characters. | ||
* | ||
* @param string $bString | ||
* @return bool $b True if the character is considered junk. False if not. | ||
* @return bool True if the character is considered junk. False if not. | ||
*/ | ||
private function isBJunk(string $bString): bool | ||
{ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.