Skip to content

Commit 018b1dc

Browse files
committed
Moved kint settings to their own config file and added a number of additional ones.
1 parent 89fd3d3 commit 018b1dc

3 files changed

Lines changed: 91 additions & 16 deletions

File tree

app/Config/App.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,4 @@ class App extends BaseConfig
265265
| - http://www.w3.org/TR/CSP/
266266
*/
267267
public $CSPEnabled = false;
268-
269-
/*
270-
|--------------------------------------------------------------------------
271-
| Kint
272-
|--------------------------------------------------------------------------
273-
|
274-
| Kint Related configuration
275-
|
276-
*/
277-
public $kintRendererTheme = 'aante-light.css';
278-
public $kintRendererFolder = false;
279-
280268
}

app/Config/Kint.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php namespace Config;
2+
3+
use Kint\Renderer\Renderer;
4+
use CodeIgniter\Config\BaseConfig;
5+
6+
class Kint extends BaseConfig
7+
{
8+
/*
9+
|--------------------------------------------------------------------------
10+
| Kint
11+
|--------------------------------------------------------------------------
12+
|
13+
| We use Kint's RichRenderer and CLIRenderer. This area contains options
14+
| that you can set to customize how Kint works for you.
15+
|
16+
| For details on these settings, see Kint's docs:
17+
| https://kint-php.github.io/kint/
18+
|
19+
*/
20+
21+
/*
22+
|--------------------------------------------------------------------------
23+
| Global Settings
24+
|--------------------------------------------------------------------------
25+
*/
26+
27+
public $plugins = null;
28+
29+
public $maxDepth = 6;
30+
31+
public $displayCalledFrom = true;
32+
33+
public $expanded = false;
34+
35+
/*
36+
|--------------------------------------------------------------------------
37+
| RichRenderer Settings
38+
|--------------------------------------------------------------------------
39+
*/
40+
public $richTheme = 'aante-light.css';
41+
42+
public $richFolder = false;
43+
44+
public $richSort = Renderer::SORT_FULL;
45+
46+
public $richObjectPlugins = null;
47+
48+
public $richTabPlugins = null;
49+
50+
/*
51+
|--------------------------------------------------------------------------
52+
| CLI Settings
53+
|--------------------------------------------------------------------------
54+
*/
55+
public $cliColors = true;
56+
57+
public $cliForceUTF8 = false;
58+
59+
public $cliDetectWidth = true;
60+
61+
public $cliMinWidth = 40;
62+
}

system/CodeIgniter.php

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,36 @@ protected function initializeKint()
224224
require_once SYSTEMPATH . 'ThirdParty/Kint/init.php';
225225
}
226226

227-
//Set the kint theme
228-
\Kint\Renderer\RichRenderer::$theme = $this->config->kintRendererTheme;
227+
/**
228+
* Config\Kint
229+
*/
230+
$config = config('Config\Kint');
229231

230-
//Render kint in place instead of toolbar
231-
\Kint\Renderer\RichRenderer::$folder = $this->config->kintRendererFolder;
232+
\Kint::$max_depth = $config->maxDepth;
233+
\Kint::$display_called_from = $config->displayCalledFrom;
234+
\Kint::$expanded = $config->expanded;
235+
236+
if (! empty($config->plugins) && is_array($config->plugins))
237+
{
238+
\Kint::$plugins = $config->plugins;
239+
}
240+
241+
\Kint\Renderer\RichRenderer::$theme = $config->richTheme;
242+
\Kint\Renderer\RichRenderer::$folder = $config->richFolder;
243+
\Kint\Renderer\RichRenderer::$sort = $config->richSort;
244+
if (! empty($config->richObjectPlugins) && is_array($config->richObjectPlugins))
245+
{
246+
\Kint\Renderer\RichRenderer::$object_plugins = $config->richObjectPlugins;
247+
}
248+
if (! empty($config->richTabPlugins) && is_array($config->richTabPlugins))
249+
{
250+
\Kint\Renderer\RichRenderer::$tab_plugins = $config->richTabPlugins;
251+
}
252+
253+
\Kint\Renderer\CliRenderer::$cli_colors = $config->cliColors;
254+
\Kint\Renderer\CliRenderer::$force_utf8 = $config->cliForceUTF8;
255+
\Kint\Renderer\CliRenderer::$detect_width = $config->cliDetectWidth;
256+
\Kint\Renderer\CliRenderer::$min_terminal_width = $config->cliMinWidth;
232257
}
233258

234259
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)