Skip to content

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 3 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
25 changes: 13 additions & 12 deletions lib/jblond/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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, 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.
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/jblond/Diff/DiffUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
23 changes: 12 additions & 11 deletions lib/jblond/Diff/Renderer/Html/HtmlArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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.
Expand All @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions lib/jblond/Diff/Renderer/Html/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
16 changes: 8 additions & 8 deletions lib/jblond/Diff/Renderer/Html/SideBySide.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions lib/jblond/Diff/Renderer/Html/Unified.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions lib/jblond/Diff/Renderer/RendererAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -29,15 +29,15 @@ abstract class RendererAbstract
public $diff;

/**
* @var array Array of the default options that apply to this renderer.
* @var array<string, 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, string> Array containing the user applied and merged default options for the renderer.
*/
protected $options = [];

Expand All @@ -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, string> $options Array of options to set.
*/
public function setOptions(array $options)
{
Expand Down
16 changes: 8 additions & 8 deletions lib/jblond/Diff/Renderer/Text/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
14 changes: 7 additions & 7 deletions lib/jblond/Diff/Renderer/Text/Unified.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/**
Expand Down
16 changes: 8 additions & 8 deletions lib/jblond/Diff/Renderer/Text/UnifiedCli.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,7 +34,7 @@ class UnifiedCli extends RendererAbstract

/**
* UnifiedCli constructor.
* @param array $options
* @param array<string, string> $options
*/
public function __construct(array $options = [])
{
Expand Down Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions lib/jblond/Diff/SequenceMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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
{
Expand Down