summaryrefslogtreecommitdiffstats
path: root/admin/survey/minify/vendor/tubalmartin/cssmin/tests/FineDiff/Render/Cli.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/minify/vendor/tubalmartin/cssmin/tests/FineDiff/Render/Cli.php')
-rw-r--r--admin/survey/minify/vendor/tubalmartin/cssmin/tests/FineDiff/Render/Cli.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/admin/survey/minify/vendor/tubalmartin/cssmin/tests/FineDiff/Render/Cli.php b/admin/survey/minify/vendor/tubalmartin/cssmin/tests/FineDiff/Render/Cli.php
new file mode 100644
index 0000000..86dcbba
--- /dev/null
+++ b/admin/survey/minify/vendor/tubalmartin/cssmin/tests/FineDiff/Render/Cli.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace tubalmartin\CssMin\Tests\FineDiff\Render;
+
+use cogpowered\FineDiff\Render\Renderer;
+
+class Cli extends Renderer
+{
+ public function callback($opcode, $from, $from_offset, $from_len)
+ {
+ if ($opcode === 'c') {
+ $text = substr($from, $from_offset, $from_len);
+ } elseif ($opcode === 'd') {
+ $deletion = substr($from, $from_offset, $from_len);
+
+ if (strcspn($deletion, " \n\r") === 0) {
+ $deletion = str_replace(array("\n","\r"), array('\n','\r'), $deletion);
+ }
+
+ $text = "\x1b[97m\x1b[41m".$deletion."\x1b[0m";
+ } else /* if ( $opcode === 'i' ) */ {
+ $text = "\x1b[97m\x1b[42m".substr($from, $from_offset, $from_len)."\x1b[0m";
+ }
+
+ return $text;
+ }
+} \ No newline at end of file