2024.8.23
Loading...
Searching...
No Matches
class.tools.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2024 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Author: Bear
6
* Website: https://bearsampp.com
7
* Github: https://github.com/Bearsampp
8
*/
9
10
/**
11
* Class Tools
12
*
13
* This class manages various tool modules in the Bearsampp application.
14
* It provides methods to retrieve and update the configuration of these tools.
15
*/
16
class
Tools
17
{
18
/**
19
* The type of the tools.
20
*/
21
const
TYPE
=
'tools'
;
22
23
/**
24
* @var ToolComposer|null The Composer tool instance.
25
*/
26
private
$composer
;
27
28
/**
29
* @var ToolConsoleZ|null The ConsoleZ tool instance.
30
*/
31
private
$consolez
;
32
33
/**
34
* @var ToolGhostscript|null The Ghostscript tool instance.
35
*/
36
private
$ghostscript
;
37
38
/**
39
* @var ToolGit|null The Git tool instance.
40
*/
41
private
$git
;
42
43
/**
44
* @var ToolNgrok|null The Ngrok tool instance.
45
*/
46
private
$ngrok
;
47
48
/**
49
* @var ToolPerl|null The Perl tool instance.
50
*/
51
private
$perl
;
52
53
/**
54
* @var ToolPython|null The Python tool instance.
55
*/
56
private
$python
;
57
58
/**
59
* @var ToolRuby|null The Ruby tool instance.
60
*/
61
private
$ruby
;
62
63
/**
64
* @var ToolXdc|null The Xdc tool instance.
65
*/
66
private
$xdc
;
67
68
/**
69
* @var ToolYarn|null The Yarn tool instance.
70
*/
71
private
$yarn
;
72
73
/**
74
* Constructor for the Tools class.
75
*/
76
public
function
__construct
()
77
{
78
}
79
80
/**
81
* Updates the configuration of all tools.
82
*/
83
public
function
update
()
84
{
85
Util::logInfo
(
'Update tools config'
);
86
foreach
($this->
getAll
() as $tool) {
87
$tool->update();
88
}
89
}
90
91
/**
92
* Retrieves all tool instances.
93
*
94
* @return array An array of all tool instances.
95
*/
96
public
function
getAll
()
97
{
98
return
array(
99
$this->
getComposer
(),
100
$this->
getConsoleZ
(),
101
$this->
getGhostscript
(),
102
$this->
getGit
(),
103
$this->
getNgrok
(),
104
$this->
getPerl
(),
105
$this->
getPython
(),
106
$this->
getRuby
(),
107
$this->
getXdc
(),
108
$this->
getYarn
(),
109
);
110
}
111
112
/**
113
* Retrieves the Composer tool instance.
114
*
115
* @return ToolComposer The Composer tool instance.
116
*/
117
public
function
getComposer
()
118
{
119
if
($this->composer ==
null
) {
120
$this->composer =
new
ToolComposer
(
'composer'
, self::TYPE);
121
}
122
return
$this->composer
;
123
}
124
125
/**
126
* Retrieves the ConsoleZ tool instance.
127
*
128
* @return ToolConsoleZ The ConsoleZ tool instance.
129
*/
130
public
function
getConsoleZ
()
131
{
132
if
($this->consolez ==
null
) {
133
$this->consolez =
new
ToolConsoleZ
(
'consolez'
, self::TYPE);
134
}
135
return
$this->consolez
;
136
}
137
138
/**
139
* Retrieves the Ghostscript tool instance.
140
*
141
* @return ToolGhostscript The Ghostscript tool instance.
142
*/
143
public
function
getGhostscript
()
144
{
145
if
($this->ghostscript ==
null
) {
146
$this->ghostscript =
new
ToolGhostscript
(
'ghostscript'
, self::TYPE);
147
}
148
return
$this->ghostscript
;
149
}
150
151
/**
152
* Retrieves the Git tool instance.
153
*
154
* @return ToolGit The Git tool instance.
155
*/
156
public
function
getGit
()
157
{
158
if
($this->git ==
null
) {
159
$this->git =
new
ToolGit
(
'git'
, self::TYPE);
160
}
161
return
$this->git
;
162
}
163
164
/**
165
* Retrieves the Git GUI tool instance.
166
*
167
* @return ToolGit The Git GUI tool instance.
168
*/
169
public
function
getGitGui
()
170
{
171
if
($this->git ==
null
) {
172
$this->git =
new
ToolGit
(
'git-gui'
, self::TYPE);
173
}
174
return
$this->git
;
175
}
176
177
/**
178
* Retrieves the Ngrok tool instance.
179
*
180
* @return ToolNgrok The Ngrok tool instance.
181
*/
182
public
function
getNgrok
()
183
{
184
if
($this->ngrok ==
null
) {
185
$this->ngrok =
new
ToolNgrok
(
'ngrok'
, self::TYPE);
186
}
187
return
$this->ngrok
;
188
}
189
190
/**
191
* Retrieves the Perl tool instance.
192
*
193
* @return ToolPerl The Perl tool instance.
194
*/
195
public
function
getPerl
()
196
{
197
if
($this->perl ==
null
) {
198
$this->perl =
new
ToolPerl
(
'perl'
, self::TYPE);
199
}
200
return
$this->perl
;
201
}
202
203
/**
204
* Retrieves the Python tool instance.
205
*
206
* @return ToolPython The Python tool instance.
207
*/
208
public
function
getPython
()
209
{
210
if
($this->python ==
null
) {
211
$this->python =
new
ToolPython
(
'python'
, self::TYPE);
212
}
213
return
$this->python
;
214
}
215
216
/**
217
* Retrieves the Ruby tool instance.
218
*
219
* @return ToolRuby The Ruby tool instance.
220
*/
221
public
function
getRuby
()
222
{
223
if
($this->ruby ==
null
) {
224
$this->ruby =
new
ToolRuby
(
'ruby'
, self::TYPE);
225
}
226
return
$this->ruby
;
227
}
228
229
/**
230
* Retrieves the Xdc tool instance.
231
*
232
* @return ToolXdc The Xdc tool instance.
233
*/
234
public
function
getXdc
()
235
{
236
if
($this->xdc ==
null
) {
237
$this->xdc =
new
ToolXdc
(
'xdc'
, self::TYPE);
238
}
239
return
$this->xdc
;
240
}
241
242
/**
243
* Retrieves the Yarn tool instance.
244
*
245
* @return ToolYarn The Yarn tool instance.
246
*/
247
public
function
getYarn
()
248
{
249
if
($this->yarn ==
null
) {
250
$this->yarn =
new
ToolYarn
(
'yarn'
, self::TYPE);
251
}
252
return
$this->yarn
;
253
}
254
}
ToolComposer
Definition
class.tool.composer.php:17
ToolConsoleZ
Definition
class.tool.consolez.php:17
ToolGhostscript
Definition
class.tool.ghostscript.php:18
ToolGit
Definition
class.tool.git.php:17
ToolNgrok
Definition
class.tool.ngrok.php:18
ToolPerl
Definition
class.tool.perl.php:17
ToolPython
Definition
class.tool.python.php:18
ToolRuby
Definition
class.tool.ruby.php:19
ToolXdc
Definition
class.tool.xdc.php:19
ToolYarn
Definition
class.tool.yarn.php:18
Tools
Definition
class.tools.php:17
Tools\$ruby
$ruby
Definition
class.tools.php:61
Tools\getRuby
getRuby()
Definition
class.tools.php:221
Tools\$git
$git
Definition
class.tools.php:41
Tools\getNgrok
getNgrok()
Definition
class.tools.php:182
Tools\getComposer
getComposer()
Definition
class.tools.php:117
Tools\$ghostscript
$ghostscript
Definition
class.tools.php:36
Tools\getConsoleZ
getConsoleZ()
Definition
class.tools.php:130
Tools\$ngrok
$ngrok
Definition
class.tools.php:46
Tools\TYPE
const TYPE
Definition
class.tools.php:21
Tools\getGit
getGit()
Definition
class.tools.php:156
Tools\getGhostscript
getGhostscript()
Definition
class.tools.php:143
Tools\getAll
getAll()
Definition
class.tools.php:96
Tools\getXdc
getXdc()
Definition
class.tools.php:234
Tools\$python
$python
Definition
class.tools.php:56
Tools\getPerl
getPerl()
Definition
class.tools.php:195
Tools\$perl
$perl
Definition
class.tools.php:51
Tools\__construct
__construct()
Definition
class.tools.php:76
Tools\$yarn
$yarn
Definition
class.tools.php:71
Tools\update
update()
Definition
class.tools.php:83
Tools\$consolez
$consolez
Definition
class.tools.php:31
Tools\getYarn
getYarn()
Definition
class.tools.php:247
Tools\$composer
$composer
Definition
class.tools.php:26
Tools\getPython
getPython()
Definition
class.tools.php:208
Tools\$xdc
$xdc
Definition
class.tools.php:66
Tools\getGitGui
getGitGui()
Definition
class.tools.php:169
Util\logInfo
static logInfo($data, $file=null)
Definition
class.util.php:778
Bearsampp-development
sandbox
core
classes
tools
class.tools.php
Generated by
1.11.0