From efa05b88f30d1841e715027b6bdcff3a5398dab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:08:22 +0300 Subject: [PATCH 01/16] Update AbstractRenderer.php --- src/Renderer/AbstractRenderer.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Renderer/AbstractRenderer.php b/src/Renderer/AbstractRenderer.php index 20d070af..1297ba9a 100644 --- a/src/Renderer/AbstractRenderer.php +++ b/src/Renderer/AbstractRenderer.php @@ -146,6 +146,24 @@ final public function render(Differ $differ): string * @param Differ $differ the differ object */ abstract protected function renderWoker(Differ $differ): string; + + /** + * The worker for array render. + * + * @param array $differArray the differ array + * + * @return string + */ + abstract protected function arrayRenderWoker(array $differArray): string; + + /** + * Woker's base function. + * + * @param array $changes the changes array + * + * @return string + */ + abstract protected function baseWoker(array $changes): string; /** * Update the Language object. From d9c6d448870f803301c3343fbaeb145a242eb567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:10:15 +0300 Subject: [PATCH 02/16] Update Inline.php --- src/Renderer/Html/Inline.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Renderer/Html/Inline.php b/src/Renderer/Html/Inline.php index 33b0d849..b51ab774 100644 --- a/src/Renderer/Html/Inline.php +++ b/src/Renderer/Html/Inline.php @@ -26,11 +26,29 @@ final class Inline extends AbstractHtml protected function renderWoker(Differ $differ): string { $changes = $this->getChanges($differ); + + return $this->baseWoker($changes); + } + + /** + * {@inheritdoc} + */ + protected function arrayRenderWoker(array $differArray): string + { + $changes = $differArray; - if (empty($changes)) { + return $this->baseWoker($changes); + } + + /** + * {@inheritdoc} + */ + protected function baseWoker(array $changes): string + { + if (empty($changes)) { return $this->getResultForIdenticals(); } - + $wrapperClasses = \array_merge( $this->options['wrapperClasses'], ['diff', 'diff-html', 'diff-inline'] @@ -51,7 +69,7 @@ protected function renderWoker(Differ $differ): string } return $html . ''; - } + } /** * Renderer the table header. From fbe2d046bb889450aa3634ced9d341ab1af733f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:11:22 +0300 Subject: [PATCH 03/16] Update Json.php --- src/Renderer/Html/Json.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Renderer/Html/Json.php b/src/Renderer/Html/Json.php index fa8800f0..aa5b724f 100644 --- a/src/Renderer/Html/Json.php +++ b/src/Renderer/Html/Json.php @@ -50,6 +50,22 @@ protected function renderWoker(Differ $differ): string ); } + /** + * {@inheritdoc} + */ + public function arrayRenderWoker(): string + { + return ''; + } + + /** + * {@inheritdoc} + */ + public function baseWoker(): string + { + return ''; + } + /** * Convert tags of changes to their string form for better readability. * From ad1f7f6c4da78ed0941bba7072a893589cac7a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:12:03 +0300 Subject: [PATCH 04/16] Update SideBySide.php --- src/Renderer/Html/SideBySide.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Renderer/Html/SideBySide.php b/src/Renderer/Html/SideBySide.php index 39aaa4a2..46632fcf 100644 --- a/src/Renderer/Html/SideBySide.php +++ b/src/Renderer/Html/SideBySide.php @@ -26,8 +26,26 @@ final class SideBySide extends AbstractHtml protected function renderWoker(Differ $differ): string { $changes = $this->getChanges($differ); + + return $this->baseWoker($changes); + } + + /** + * {@inheritdoc} + */ + protected function arrayRenderWoker(array $differArray): string + { + $changes = $differArray; - if (empty($changes)) { + return $this->baseWoker($changes); + } + + /** + * {@inheritdoc} + */ + protected function baseWoker(array $changes): string + { + if (empty($changes)) { return $this->getResultForIdenticals(); } @@ -51,7 +69,7 @@ protected function renderWoker(Differ $differ): string } return $html . ''; - } + } /** * Renderer the table header. From 503cea19bbc4ce4ed21e5f67966c54daf39cd0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:12:48 +0300 Subject: [PATCH 05/16] Update AbstractText.php --- src/Renderer/Text/AbstractText.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Renderer/Text/AbstractText.php b/src/Renderer/Text/AbstractText.php index d84a19fc..f1c2a2c8 100644 --- a/src/Renderer/Text/AbstractText.php +++ b/src/Renderer/Text/AbstractText.php @@ -20,6 +20,22 @@ abstract class AbstractText extends AbstractRenderer * {@inheritdoc} */ public function getResultForIdenticalsDefault(): string + { + return ''; + } + + /** + * {@inheritdoc} + */ + public function arrayRenderWoker(): string + { + return ''; + } + + /** + * {@inheritdoc} + */ + public function baseWoker(): string { return ''; } From fe222bc1c3b2aa3cf77c37faa93cebcb0a3540cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:18:56 +0300 Subject: [PATCH 06/16] Update Json.php --- src/Renderer/Html/Json.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Renderer/Html/Json.php b/src/Renderer/Html/Json.php index aa5b724f..63b5146a 100644 --- a/src/Renderer/Html/Json.php +++ b/src/Renderer/Html/Json.php @@ -53,7 +53,7 @@ protected function renderWoker(Differ $differ): string /** * {@inheritdoc} */ - public function arrayRenderWoker(): string + public function arrayRenderWoker(array $differArray): string { return ''; } @@ -61,7 +61,7 @@ public function arrayRenderWoker(): string /** * {@inheritdoc} */ - public function baseWoker(): string + public function baseWoker(array $changes): string { return ''; } From 7bb1324d857f611a116bebc6ae8b8d78e8481649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:19:32 +0300 Subject: [PATCH 07/16] Update AbstractText.php --- src/Renderer/Text/AbstractText.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Renderer/Text/AbstractText.php b/src/Renderer/Text/AbstractText.php index f1c2a2c8..e2c8ee94 100644 --- a/src/Renderer/Text/AbstractText.php +++ b/src/Renderer/Text/AbstractText.php @@ -27,7 +27,7 @@ public function getResultForIdenticalsDefault(): string /** * {@inheritdoc} */ - public function arrayRenderWoker(): string + public function arrayRenderWoker(array $differArray): string { return ''; } @@ -35,7 +35,7 @@ public function arrayRenderWoker(): string /** * {@inheritdoc} */ - public function baseWoker(): string + public function baseWoker(array $changes): string { return ''; } From e912c97b5c9f7d552e88ed1bf66f0f1779d4ed61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:25:55 +0300 Subject: [PATCH 08/16] Update AbstractRenderer.php --- src/Renderer/AbstractRenderer.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Renderer/AbstractRenderer.php b/src/Renderer/AbstractRenderer.php index 1297ba9a..2ec6867a 100644 --- a/src/Renderer/AbstractRenderer.php +++ b/src/Renderer/AbstractRenderer.php @@ -140,6 +140,14 @@ final public function render(Differ $differ): string : $this->renderWoker($differ); } + /** + * {@inheritdoc} + */ + final public function renderArray(array $differArray): string + { + return $this->renderArrayWoker($differArray); + } + /** * The real worker for self::render(). * @@ -154,7 +162,7 @@ abstract protected function renderWoker(Differ $differ): string; * * @return string */ - abstract protected function arrayRenderWoker(array $differArray): string; + abstract protected function renderArrayWoker(array $differArray): string; /** * Woker's base function. From 20343c97c755b9ac8b6c6b8b695ad987b6ebff3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:28:18 +0300 Subject: [PATCH 09/16] Update AbstractText.php --- src/Renderer/Text/AbstractText.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Renderer/Text/AbstractText.php b/src/Renderer/Text/AbstractText.php index e2c8ee94..80095cf1 100644 --- a/src/Renderer/Text/AbstractText.php +++ b/src/Renderer/Text/AbstractText.php @@ -27,7 +27,7 @@ public function getResultForIdenticalsDefault(): string /** * {@inheritdoc} */ - public function arrayRenderWoker(array $differArray): string + public function renderArrayWoker(array $differArray): string { return ''; } From 52ed1137ff57f8234f15f843d3f0d17fbb42a868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:30:29 +0300 Subject: [PATCH 10/16] Update RendererInterface.php --- src/Renderer/RendererInterface.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Renderer/RendererInterface.php b/src/Renderer/RendererInterface.php index 40d9ec98..aa77afbe 100644 --- a/src/Renderer/RendererInterface.php +++ b/src/Renderer/RendererInterface.php @@ -22,4 +22,13 @@ public function getResultForIdenticals(): string; * @param Differ $differ the Differ object to be rendered */ public function render(Differ $differ): string; + + /** + * Render the differ array and return the result. + * + * @param array $differArray the Differ array to be rendered + * + * @return string + */ + public function renderArray(array $differArray): string; } From 9f9cbf891b90518b7f6270e9495610b29e79338f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:31:42 +0300 Subject: [PATCH 11/16] Update Inline.php --- src/Renderer/Html/Inline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Renderer/Html/Inline.php b/src/Renderer/Html/Inline.php index b51ab774..9956e557 100644 --- a/src/Renderer/Html/Inline.php +++ b/src/Renderer/Html/Inline.php @@ -33,7 +33,7 @@ protected function renderWoker(Differ $differ): string /** * {@inheritdoc} */ - protected function arrayRenderWoker(array $differArray): string + protected function renderArrayWoker(array $differArray): string { $changes = $differArray; From 3c649437b43ab5f28ece6a55303b200ac0df57ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:32:56 +0300 Subject: [PATCH 12/16] Update Json.php --- src/Renderer/Html/Json.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Renderer/Html/Json.php b/src/Renderer/Html/Json.php index 63b5146a..d48c0ee9 100644 --- a/src/Renderer/Html/Json.php +++ b/src/Renderer/Html/Json.php @@ -53,7 +53,7 @@ protected function renderWoker(Differ $differ): string /** * {@inheritdoc} */ - public function arrayRenderWoker(array $differArray): string + public function renderArrayWoker(array $differArray): string { return ''; } From ed6bb9b4e3fdd1fb52003c92fbd72ac7de974662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:33:18 +0300 Subject: [PATCH 13/16] Update SideBySide.php --- src/Renderer/Html/SideBySide.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Renderer/Html/SideBySide.php b/src/Renderer/Html/SideBySide.php index 46632fcf..da88c00d 100644 --- a/src/Renderer/Html/SideBySide.php +++ b/src/Renderer/Html/SideBySide.php @@ -33,7 +33,7 @@ protected function renderWoker(Differ $differ): string /** * {@inheritdoc} */ - protected function arrayRenderWoker(array $differArray): string + protected function renderArrayWoker(array $differArray): string { $changes = $differArray; From 3b7715107b49ff5483f4ca4853470b8420c0a5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 02:04:23 +0300 Subject: [PATCH 14/16] Update SideBySide.php --- src/Renderer/Html/SideBySide.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Renderer/Html/SideBySide.php b/src/Renderer/Html/SideBySide.php index da88c00d..2b9cc873 100644 --- a/src/Renderer/Html/SideBySide.php +++ b/src/Renderer/Html/SideBySide.php @@ -36,8 +36,8 @@ protected function renderWoker(Differ $differ): string protected function renderArrayWoker(array $differArray): string { $changes = $differArray; - - return $this->baseWoker($changes); + + return $this->baseWoker($changes); } /** From e8828f2c6edca54e860c9bf256c5b6d2101ae60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20=C3=96zbey?= <48382593+the-turk@users.noreply.github.com> Date: Sun, 5 Jan 2020 02:07:55 +0300 Subject: [PATCH 15/16] Update SideBySide.php --- src/Renderer/Html/SideBySide.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Renderer/Html/SideBySide.php b/src/Renderer/Html/SideBySide.php index 2b9cc873..87e92539 100644 --- a/src/Renderer/Html/SideBySide.php +++ b/src/Renderer/Html/SideBySide.php @@ -27,7 +27,7 @@ protected function renderWoker(Differ $differ): string { $changes = $this->getChanges($differ); - return $this->baseWoker($changes); + return $this->baseWoker($changes); } /** @@ -36,8 +36,8 @@ protected function renderWoker(Differ $differ): string protected function renderArrayWoker(array $differArray): string { $changes = $differArray; - - return $this->baseWoker($changes); + + return $this->baseWoker($changes); } /** From 254f22063f68aadd7acfb2c2f486671f04b34ae7 Mon Sep 17 00:00:00 2001 From: hasan-ozbey <48382593+hasan-ozbey@users.noreply.github.com> Date: Sun, 5 Jan 2020 02:17:39 +0300 Subject: [PATCH 16/16] tabs to space --- src/Renderer/AbstractRenderer.php | 4 ++-- src/Renderer/Html/Inline.php | 20 ++++++++++---------- src/Renderer/Html/SideBySide.php | 14 +++++++------- src/Renderer/Text/AbstractText.php | 8 ++++---- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Renderer/AbstractRenderer.php b/src/Renderer/AbstractRenderer.php index 2ec6867a..ae75b778 100644 --- a/src/Renderer/AbstractRenderer.php +++ b/src/Renderer/AbstractRenderer.php @@ -163,8 +163,8 @@ abstract protected function renderWoker(Differ $differ): string; * @return string */ abstract protected function renderArrayWoker(array $differArray): string; - - /** + + /** * Woker's base function. * * @param array $changes the changes array diff --git a/src/Renderer/Html/Inline.php b/src/Renderer/Html/Inline.php index 9956e557..8eef83e5 100644 --- a/src/Renderer/Html/Inline.php +++ b/src/Renderer/Html/Inline.php @@ -26,29 +26,29 @@ final class Inline extends AbstractHtml protected function renderWoker(Differ $differ): string { $changes = $this->getChanges($differ); - - return $this->baseWoker($changes); + + return $this->baseWoker($changes); } - - /** + + /** * {@inheritdoc} */ protected function renderArrayWoker(array $differArray): string { - $changes = $differArray; + $changes = $differArray; return $this->baseWoker($changes); } - - /** + + /** * {@inheritdoc} */ protected function baseWoker(array $changes): string { - if (empty($changes)) { + if (empty($changes)) { return $this->getResultForIdenticals(); } - + $wrapperClasses = \array_merge( $this->options['wrapperClasses'], ['diff', 'diff-html', 'diff-inline'] @@ -69,7 +69,7 @@ protected function baseWoker(array $changes): string } return $html . ''; - } + } /** * Renderer the table header. diff --git a/src/Renderer/Html/SideBySide.php b/src/Renderer/Html/SideBySide.php index 87e92539..3486f604 100644 --- a/src/Renderer/Html/SideBySide.php +++ b/src/Renderer/Html/SideBySide.php @@ -26,11 +26,11 @@ final class SideBySide extends AbstractHtml protected function renderWoker(Differ $differ): string { $changes = $this->getChanges($differ); - + return $this->baseWoker($changes); } - - /** + + /** * {@inheritdoc} */ protected function renderArrayWoker(array $differArray): string @@ -39,13 +39,13 @@ protected function renderArrayWoker(array $differArray): string return $this->baseWoker($changes); } - - /** + + /** * {@inheritdoc} */ protected function baseWoker(array $changes): string { - if (empty($changes)) { + if (empty($changes)) { return $this->getResultForIdenticals(); } @@ -69,7 +69,7 @@ protected function baseWoker(array $changes): string } return $html . ''; - } + } /** * Renderer the table header. diff --git a/src/Renderer/Text/AbstractText.php b/src/Renderer/Text/AbstractText.php index 80095cf1..c146c9fe 100644 --- a/src/Renderer/Text/AbstractText.php +++ b/src/Renderer/Text/AbstractText.php @@ -23,16 +23,16 @@ public function getResultForIdenticalsDefault(): string { return ''; } - - /** + + /** * {@inheritdoc} */ public function renderArrayWoker(array $differArray): string { return ''; } - - /** + + /** * {@inheritdoc} */ public function baseWoker(array $changes): string