dolibarr
21.0.0-alpha
Main Page
Related Pages
Topics
Classes
Files
File List
File Members
dolibarr_dev
htdocs
debugbar
class
DataCollector
DolConfigCollector.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16
*/
17
24
use DebugBar\DataCollector\ConfigCollector;
25
30
class
DolConfigCollector
extends
ConfigCollector
31
{
37
public
function
getWidgets
()
38
{
39
global $langs;
40
41
return
array(
42
$langs->transnoentities(
'Config'
) => array(
43
"icon"
=>
"gear"
,
44
"widget"
=>
"PhpDebugBar.Widgets.VariableListWidget"
,
45
"map"
=> $this->getName(),
46
"default"
=>
"{}"
47
)
48
);
49
}
50
56
public
function
collect
()
57
{
58
$this->data = $this->
getConfig
();
59
60
return
parent::collect();
61
}
62
68
protected
function
getConfig
()
69
{
70
global $conf, $user;
71
72
// Get constants
73
$const = get_defined_constants(
true
);
74
75
$config = array(
76
'Dolibarr'
=> array(
77
'const'
=> $const[
'user'
],
78
'$conf'
=> $this->
objectToArray
($conf),
79
'$user'
=> $this->
objectToArray
($user)
80
),
81
'PHP'
=> array(
82
'version'
=> PHP_VERSION,
83
'interface'
=> PHP_SAPI,
84
'os'
=> PHP_OS
85
)
86
);
87
88
return
$config;
89
}
90
91
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
98
protected
function
objectToArray
($obj)
99
{
100
// phpcs:enable
101
$arr = array();
102
$_arr = is_object($obj) ? get_object_vars($obj) : $obj;
103
foreach
($_arr as $key => $val) {
104
$val = (is_array($val) || is_object($val)) ? $this->
objectToArray
($val) : $val;
105
$arr[$key] = $val;
106
}
107
108
return
$arr;
109
}
110
}
DolConfigCollector
DolConfigCollector class.
Definition
DolConfigCollector.php:31
DolConfigCollector\collect
collect()
Return collected data.
Definition
DolConfigCollector.php:56
DolConfigCollector\getWidgets
getWidgets()
Return widget settings.
Definition
DolConfigCollector.php:37
DolConfigCollector\objectToArray
objectToArray($obj)
Convert an object to array.
Definition
DolConfigCollector.php:98
DolConfigCollector\getConfig
getConfig()
Returns an array with config data.
Definition
DolConfigCollector.php:68
Generated on Fri Nov 1 2024 01:00:29 for
dolibarr
by Doxygen 1.11.0