1717 "\GGrach\BitrixDebugger\Cache\RuntimeCache " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Cache/RuntimeCache.php " ,
1818 "\GGrach\BitrixDebugger\Validator\ShowModeDebuggerValidator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Validator/ShowModeDebuggerValidator.php " ,
1919 "\GGrach\BitrixDebugger\Representer\DebugBarRepresenter " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Representer/DebugBarRepresenter.php " ,
20-
21-
2220 "\GGrach\Writer\FileWriter " => $ ggrachDebuggerRootPath . "/src/Writer/FileWriter.php " ,
2321 "\GGrach\Writer\Contract\WritableContract " => $ ggrachDebuggerRootPath . "/src/Writer/Contract/WritableContract.php "
2422]);
@@ -45,10 +43,9 @@ function GD() {
4543 return $ GD ;
4644}
4745
48-
4946Asset::getInstance ()->addJs ($ ggrachDebuggerRootPath . "/assets/DebugBar/js/initializer.js " );
5047Asset::getInstance ()->addCss ($ ggrachDebuggerRootPath . '/assets/DebugBar/themes/general.css ' );
51- Asset::getInstance ()->addCss ($ ggrachDebuggerRootPath . '/assets/DebugBar/themes/ ' . $ ggrachDebugBarConfigurator ->getColorTheme (). '/theme.css ' );
48+ Asset::getInstance ()->addCss ($ ggrachDebuggerRootPath . '/assets/DebugBar/themes/ ' . $ ggrachDebugBarConfigurator ->getColorTheme () . '/theme.css ' );
5249
5350/**
5451 * Пример дебага:
@@ -68,5 +65,100 @@ function GD() {
6865include 'inizializer_alias.php ' ;
6966
7067if (\GGrach \BitrixDebugger \Validator \ShowModeDebuggerValidator::needShowInDebugBar ($ GD )) {
68+
69+ function ggrach_highlight_data ($ data = []) {
70+
71+ $ viewResult = '' ;
72+
73+ $ need_hide_blocks = true ;
74+
75+ $ ppr = function ($ in , $ opened , $ margin = 5 ) use (&$ ppr , $ need_hide_blocks ) {
76+
77+ $ viewRes = '' ;
78+
79+ if (!\is_object ($ in ) && !\is_array ($ in )) {
80+ return $ in ;
81+ }
82+
83+ if ($ need_hide_blocks == true )
84+ $ opened = '' ;
85+
86+ foreach ($ in as $ key => $ value ) {
87+ if (\is_object ($ value ) || \is_array ($ value )) {
88+ $ viewRes .= '<details style="margin-left: ' . $ margin . 'px" ' . $ opened . '> ' ;
89+ $ viewRes .= '<summary style="cursor: pointer; margin-top: 5px; margin-bottom: 5px; text-decoration: underline;"> ' ;
90+ $ viewRes .= (is_object ($ value )) ? $ key . ' { ' . count ((array ) $ value ) . '} ' : $ key . ' [ ' . count ($ value ) . '] ' ;
91+ $ viewRes .= '</summary> ' ;
92+ $ viewRes .= $ ppr ($ value , $ opened , $ margin + 5 );
93+ $ viewRes .= '</details> ' ;
94+ } else {
95+ switch (gettype ($ value )) {
96+ case 'string ' :
97+ $ bgc = 'red ' ;
98+
99+ if (\strlen ($ value ) > 500 ) {
100+ $ value = '[Очень длинная строка] ' ;
101+ }
102+
103+ break ;
104+ case 'integer ' :
105+ $ bgc = 'green ' ;
106+ break ;
107+ }
108+ $ viewRes .= '<div style="margin-left: ' . $ margin . 'px"> ' . $ key . ' : <span style="color: ' . $ bgc . '"> ' . $ value . '</span> <span style="color: blue;">( ' . gettype ($ value ) . ')</span></div> ' ;
109+ }
110+ }
111+
112+ return $ viewRes ;
113+ };
114+
115+ $ pp = function ($ in , $ opened = true ) use ($ ppr ) {
116+
117+ $ view = '' ;
118+
119+ if ($ opened ) {
120+ $ opened = ' open ' ;
121+ }
122+
123+
124+ $ view .= '<div> ' ;
125+
126+ if (is_object ($ in ) or is_array ($ in )) {
127+ $ view .= '<details ' . $ opened . '> ' ;
128+ $ view .= '<summary style="cursor: pointer; margin-top: 5px; margin-bottom: 5px; text-decoration: underline;"> ' ;
129+ $ view .= (is_object ($ in )) ? 'Object { ' . count ((array ) $ in ) . '} ' : 'Array [ ' . count ($ in ) . '] ' ;
130+ $ view .= '</summary> ' ;
131+ $ view .= $ ppr ($ in , $ opened );
132+ $ view .= '</details> ' ;
133+ } else {
134+ switch (gettype ($ in )) {
135+ case 'string ' :
136+ $ bgc = 'red ' ;
137+
138+ if (\strlen ($ in ) > 500 ) {
139+ $ in = '[Очень длинная строка] ' ;
140+ }
141+
142+ break ;
143+ case 'integer ' :
144+ $ bgc = 'green ' ;
145+ break ;
146+ }
147+
148+ $ view .= '<div style="margin-left: 0px"><span style="color: ' . $ bgc . '"> ' . $ in . '</span> <span style="color: blue;">( ' . gettype ($ in ) . ')</span></div> ' ;
149+ }
150+
151+
152+ $ view .= '</div> ' ;
153+
154+
155+ return $ view ;
156+ };
157+
158+ $ viewResult .= $ pp ($ data , !$ need_hide_blocks );
159+
160+ return $ viewResult ;
161+ }
162+
71163 include 'events.php ' ;
72164}
0 commit comments