File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed
lib/jblond/Diff/Renderer/Text Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ standard formats including:
15
15
* Side by Side HTML
16
16
* Unified HTML
17
17
* Unified Commandline colored output
18
+ * JSON
18
19
19
20
The logic behind the core of the diff engine (ie, the sequence matcher) is
20
21
primarily based on the Python difflib package. The reason for doing so is
@@ -147,9 +148,9 @@ at [jQuery-Merge-for-php-diff](https://github.com/DigiLive/jQuery-Merge-for-php-
147
148
148
149
Contributors since I forked the repo.
149
150
150
- * maxxer
151
- * Creris
152
- * jfcherng
151
+ * [ maxxer] ( https://github.com/maxxer )
152
+ * [ Creris] ( https://github.com/Creris )
153
+ * [ jfcherng] ( https://github.com/jfcherng )
153
154
* [ DigiLive] ( https://github.com/DigiLive )
154
155
155
156
### License (BSD License)
Original file line number Diff line number Diff line change 22
22
*/
23
23
class Json extends MainRendererAbstract
24
24
{
25
+
26
+ /**
27
+ * @var array Associative array containing the default options available for this renderer and their default
28
+ * value.
29
+ */
30
+ private $ subOptions = [
31
+ 'json ' => JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE
32
+ ];
33
+
34
+ /**
35
+ * InlineCli constructor.
36
+ *
37
+ * @param array $options Custom defined options for the InlineCli diff renderer.
38
+ *
39
+ * @see Json::$subOptions
40
+ */
41
+ public function __construct (array $ options = [])
42
+ {
43
+ parent ::__construct ($ this ->subOptions );
44
+ $ this ->setOptions ($ options );
45
+ }
46
+
25
47
/**
26
48
* @return false|string
27
49
*/
@@ -33,7 +55,7 @@ public function render()
33
55
foreach ($ opCodes as $ key => $ group ) {
34
56
$ return [] = $ this ->toArray ($ group );
35
57
}
36
- return json_encode ($ return , JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE );
58
+ return json_encode ($ return , $ this -> options [ ' json ' ] );
37
59
}
38
60
39
61
/**
You can’t perform that action at this time.
0 commit comments