From 66e8de5a4427efe45808b154a2e0094fc7ae359b Mon Sep 17 00:00:00 2001 From: JBlond Date: Tue, 14 Jul 2020 12:32:44 +0200 Subject: [PATCH 1/3] update doc --- LICENSE | 2 +- lib/jblond/Diff.php | 25 ++++++++++--------- lib/jblond/Diff/DiffUtils.php | 10 ++++---- lib/jblond/Diff/Renderer/Html/HtmlArray.php | 23 +++++++++-------- lib/jblond/Diff/Renderer/Html/Inline.php | 16 ++++++------ lib/jblond/Diff/Renderer/Html/SideBySide.php | 16 ++++++------ lib/jblond/Diff/Renderer/Html/Unified.php | 6 ++--- lib/jblond/Diff/Renderer/RendererAbstract.php | 22 ++++++++-------- lib/jblond/Diff/Renderer/Text/Context.php | 16 ++++++------ lib/jblond/Diff/Renderer/Text/Unified.php | 14 +++++------ lib/jblond/Diff/Renderer/Text/UnifiedCli.php | 16 ++++++------ lib/jblond/Diff/SequenceMatcher.php | 24 +++++++++--------- 12 files changed, 96 insertions(+), 94 deletions(-) diff --git a/LICENSE b/LICENSE index 88d00098..78654c0d 100644 --- a/LICENSE +++ b/LICENSE @@ -12,7 +12,7 @@ modification, are permitted provided that the following conditions are met: - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - Neither the name of the Chris Boulton nor the names of its contributors + - Neither the name of the Mario Brandt nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/lib/jblond/Diff.php b/lib/jblond/Diff.php index feb5c8bd..98deb1c9 100644 --- a/lib/jblond/Diff.php +++ b/lib/jblond/Diff.php @@ -21,14 +21,14 @@ * * PHP version 7.2 or greater * - * @package jblond - * @author Chris Boulton - * @author Mario Brandt - * @author Ferry Cools - * @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 + * @author Mario Brandt + * @author Ferry Cools + * @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 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 umber 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 diff --git a/lib/jblond/Diff/DiffUtils.php b/lib/jblond/Diff/DiffUtils.php index 2fd26e8d..e054527a 100644 --- a/lib/jblond/Diff/DiffUtils.php +++ b/lib/jblond/Diff/DiffUtils.php @@ -7,11 +7,11 @@ * * PHP version 7.2 or greater * - * @package jblond\Diff - * @author Mario Brandt - * @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 + * @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 { diff --git a/lib/jblond/Diff/Renderer/Html/HtmlArray.php b/lib/jblond/Diff/Renderer/Html/HtmlArray.php index ca3cb5d3..67bd2b43 100644 --- a/lib/jblond/Diff/Renderer/Html/HtmlArray.php +++ b/lib/jblond/Diff/Renderer/Html/HtmlArray.php @@ -11,20 +11,21 @@ * * PHP version 7.2 or greater * - * @package jblond\Diff\Renderer\Html - * @author Chris Boulton - * @author Mario Brandt - * @author Ferry Cools - * @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 + * @author Mario Brandt + * @author Ferry Cools + * @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 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. diff --git a/lib/jblond/Diff/Renderer/Html/Inline.php b/lib/jblond/Diff/Renderer/Html/Inline.php index b32b5067..77fd36fa 100644 --- a/lib/jblond/Diff/Renderer/Html/Inline.php +++ b/lib/jblond/Diff/Renderer/Html/Inline.php @@ -9,14 +9,14 @@ * * PHP version 7.2 or greater * - * @package jblond\Diff\Renderer\Html - * @author Chris Boulton - * @author Mario Brandt - * @author Ferry Cools - * @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 + * @author Mario Brandt + * @author Ferry Cools + * @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 { diff --git a/lib/jblond/Diff/Renderer/Html/SideBySide.php b/lib/jblond/Diff/Renderer/Html/SideBySide.php index 4acd7a98..6d1ae675 100644 --- a/lib/jblond/Diff/Renderer/Html/SideBySide.php +++ b/lib/jblond/Diff/Renderer/Html/SideBySide.php @@ -9,14 +9,14 @@ * * PHP version 7.2 or greater * - * @package jblond\Diff\Renderer\Html - * @author Chris Boulton - * @author Mario Brandt - * @author Ferry Cools - * @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 + * @author Mario Brandt + * @author Ferry Cools + * @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 { diff --git a/lib/jblond/Diff/Renderer/Html/Unified.php b/lib/jblond/Diff/Renderer/Html/Unified.php index bfc38f08..2a60df86 100644 --- a/lib/jblond/Diff/Renderer/Html/Unified.php +++ b/lib/jblond/Diff/Renderer/Html/Unified.php @@ -10,11 +10,11 @@ * PHP version 7.2 or greater * * @package jblond\Diff\Renderer\Html - * @author Mario Brandt + * @author Mario Brandt * @author Ferry Cools - * @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 diff --git a/lib/jblond/Diff/Renderer/RendererAbstract.php b/lib/jblond/Diff/Renderer/RendererAbstract.php index 6e3bb23c..b1e76704 100644 --- a/lib/jblond/Diff/Renderer/RendererAbstract.php +++ b/lib/jblond/Diff/Renderer/RendererAbstract.php @@ -11,14 +11,14 @@ * * PHP version 7.2 or greater * - * @package jblond\Diff\Renderer - * @author Chris Boulton - * @author Mario Brandt - * @author Ferry Cools - * @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 + * @author Mario Brandt + * @author Ferry Cools + * @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,7 +29,7 @@ abstract class RendererAbstract public $diff; /** - * @var array Array of the default options that apply to this renderer. + * @var array Array of the default options that apply to this renderer. */ protected $defaultOptions = [ 'title1' => 'Version1', @@ -37,7 +37,7 @@ abstract class RendererAbstract ]; /** - * @var array Array containing the user applied and merged default options for the renderer. + * @var array 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 $options Array of options to set. */ public function setOptions(array $options) { diff --git a/lib/jblond/Diff/Renderer/Text/Context.php b/lib/jblond/Diff/Renderer/Text/Context.php index 880f2be3..455cb254 100644 --- a/lib/jblond/Diff/Renderer/Text/Context.php +++ b/lib/jblond/Diff/Renderer/Text/Context.php @@ -11,14 +11,14 @@ * * PHP version 7.2 or greater * - * @package jblond\Diff\Renderer\Text - * @author Chris Boulton - * @author Mario Brandt - * @author Ferry Cools - * @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 + * @author Mario Brandt + * @author Ferry Cools + * @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 { diff --git a/lib/jblond/Diff/Renderer/Text/Unified.php b/lib/jblond/Diff/Renderer/Text/Unified.php index 89b8ff7e..aa3d3a62 100644 --- a/lib/jblond/Diff/Renderer/Text/Unified.php +++ b/lib/jblond/Diff/Renderer/Text/Unified.php @@ -11,13 +11,13 @@ * * PHP version 7.2 or greater * - * @package jblond\Diff\Renderer\Text - * @author Chris Boulton - * @author Mario Brandt - * @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 + * @author Mario Brandt + * @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 */ /** diff --git a/lib/jblond/Diff/Renderer/Text/UnifiedCli.php b/lib/jblond/Diff/Renderer/Text/UnifiedCli.php index 3e85bf68..196edfab 100644 --- a/lib/jblond/Diff/Renderer/Text/UnifiedCli.php +++ b/lib/jblond/Diff/Renderer/Text/UnifiedCli.php @@ -12,11 +12,11 @@ * * PHP version 7.2 or greater * - * @package jblond\Diff\Renderer\Text - * @author Mario Brandt - * @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 + * @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 $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); diff --git a/lib/jblond/Diff/SequenceMatcher.php b/lib/jblond/Diff/SequenceMatcher.php index c44b1ccc..2a90cd75 100644 --- a/lib/jblond/Diff/SequenceMatcher.php +++ b/lib/jblond/Diff/SequenceMatcher.php @@ -11,14 +11,14 @@ * * PHP version 7.2 or greater * - * @package jblond\Diff - * @author Chris Boulton - * @author Mario Brandt - * @author Ferry Cools - * @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 + * @author Mario Brandt + * @author Ferry Cools + * @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 { From 4f2b31a5e43aaa11e3f9d7a0209cf8e652a10711 Mon Sep 17 00:00:00 2001 From: JBlond Date: Wed, 15 Jul 2020 21:41:14 +0200 Subject: [PATCH 2/3] correct typo --- lib/jblond/Diff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jblond/Diff.php b/lib/jblond/Diff.php index 98deb1c9..aa02e18b 100644 --- a/lib/jblond/Diff.php +++ b/lib/jblond/Diff.php @@ -112,7 +112,7 @@ public function __construct($version1, $version2, array $options = []) * * @param mixed $var Variable to get type from. * - * @return int umber indicating the type of the variable. 0 for array type and 1 for string type. + * @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'. * */ From 8555fdd922fa8423aac371b99dfb83ed9f550c7b Mon Sep 17 00:00:00 2001 From: JBlond Date: Thu, 16 Jul 2020 08:24:26 +0200 Subject: [PATCH 3/3] update doc --- lib/jblond/Diff.php | 2 +- lib/jblond/Diff/Renderer/Html/HtmlArray.php | 2 +- lib/jblond/Diff/Renderer/RendererAbstract.php | 6 +++--- lib/jblond/Diff/Renderer/Text/UnifiedCli.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/jblond/Diff.php b/lib/jblond/Diff.php index aa02e18b..acd0b888 100644 --- a/lib/jblond/Diff.php +++ b/lib/jblond/Diff.php @@ -50,7 +50,7 @@ class Diff private $groupedCodes; /** - * @var array Associative array containing the default options available + * @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. diff --git a/lib/jblond/Diff/Renderer/Html/HtmlArray.php b/lib/jblond/Diff/Renderer/Html/HtmlArray.php index 67bd2b43..02cd0b8e 100644 --- a/lib/jblond/Diff/Renderer/Html/HtmlArray.php +++ b/lib/jblond/Diff/Renderer/Html/HtmlArray.php @@ -23,7 +23,7 @@ class HtmlArray extends RendererAbstract { /** - * @var array Associative array containing the default options available + * @var array 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. diff --git a/lib/jblond/Diff/Renderer/RendererAbstract.php b/lib/jblond/Diff/Renderer/RendererAbstract.php index b1e76704..269323c2 100644 --- a/lib/jblond/Diff/Renderer/RendererAbstract.php +++ b/lib/jblond/Diff/Renderer/RendererAbstract.php @@ -29,7 +29,7 @@ abstract class RendererAbstract public $diff; /** - * @var array Array of the default options that apply to this renderer. + * @var array Array of the default options that apply to this renderer. */ protected $defaultOptions = [ 'title1' => 'Version1', @@ -37,7 +37,7 @@ abstract class RendererAbstract ]; /** - * @var array Array containing the user applied and merged default options for the renderer. + * @var array 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 $options Array of options to set. */ public function setOptions(array $options) { diff --git a/lib/jblond/Diff/Renderer/Text/UnifiedCli.php b/lib/jblond/Diff/Renderer/Text/UnifiedCli.php index 196edfab..24c6eeb2 100644 --- a/lib/jblond/Diff/Renderer/Text/UnifiedCli.php +++ b/lib/jblond/Diff/Renderer/Text/UnifiedCli.php @@ -34,7 +34,7 @@ class UnifiedCli extends RendererAbstract /** * UnifiedCli constructor. - * @param array $options + * @param array $options */ public function __construct(array $options = []) {