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:
1515* Side by Side HTML
1616* Unified HTML
1717* Unified Commandline colored output
18+ * JSON
1819
1920The logic behind the core of the diff engine (ie, the sequence matcher) is
2021primarily 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-
147148
148149Contributors since I forked the repo.
149150
150- * maxxer
151- * Creris
152- * jfcherng
151+ * [ maxxer] ( https://github.com/maxxer )
152+ * [ Creris] ( https://github.com/Creris )
153+ * [ jfcherng] ( https://github.com/jfcherng )
153154* [ DigiLive] ( https://github.com/DigiLive )
154155
155156### License (BSD License)
Original file line number Diff line number Diff line change 2222 */
2323class Json extends MainRendererAbstract
2424{
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+
2547 /**
2648 * @return false|string
2749 */
@@ -33,7 +55,7 @@ public function render()
3355 foreach ($ opCodes as $ key => $ group ) {
3456 $ return [] = $ this ->toArray ($ group );
3557 }
36- return json_encode ($ return , JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE );
58+ return json_encode ($ return , $ this -> options [ ' json ' ] );
3759 }
3860
3961 /**
You can’t perform that action at this time.
0 commit comments