Passed
Push — master ( 32c740...f58b8c )
by Michael
34s queued 14s
created

ClassXoopsCode   F

Complexity

Total Complexity 62

Size/Duplication

Total Lines 709
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 149
dl 0
loc 709
rs 3.44
c 0
b 0
f 0
wmc 62

34 Methods

Rating   Name   Duplication   Size   Complexity  
A getClassSetSort() 0 3 1
A getClassSetStart() 0 3 1
A getClassInitVar() 0 5 1
A getClassSetLimit() 0 3 1
A getXoopsSimpleForm() 0 10 2
A getClassCriteria() 0 12 4
A getClassXoopsThemeForm() 0 10 2
A getClassXoopsPageNav() 0 10 2
A getInstance() 0 8 2
A getClassSetOrder() 0 3 1
A getClassAdd() 0 3 1
A getClassCriteriaCompo() 0 3 1
A getClassXoopsFormElementTray() 0 3 1
A getClassXoopsFormTextDateSelect() 0 11 2
A getClassXoopsFormSelect() 0 11 4
A getClassXoopsFormTag() 0 10 2
A getClassXoopsFormCheckBox() 0 10 2
A getClassXoopsFormFile() 0 10 2
A getClassXoopsFormButton() 0 10 2
A getClassSetExtra() 0 3 1
A getClassXoopsFormTextArea() 0 11 2
A getClassXoopsFormSelectUser() 0 11 2
A getClassXoopsMakeSelBox() 0 6 1
A getClassXoopsFormEditor() 0 10 2
A getClassAddOption() 0 3 1
A getClassXoopsFormHidden() 0 20 4
A getClassAddOptionArray() 0 3 1
A getClassXoopsFormLabel() 0 15 5
A getClassXoopsFormRadioYN() 0 10 2
A getClassXoopsObjectTree() 0 5 1
A getClassAddElement() 0 3 1
A getClassXoopsFormColorPicker() 0 10 2
A getClassSetDescription() 0 3 1
A getClassXoopsFormText() 0 10 2

How to fix   Complexity   

Complex Class

Complex classes like ClassXoopsCode often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use ClassXoopsCode, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace XoopsModules\Tdmcreate\Files\Classes;
4
5
use XoopsModules\Tdmcreate;
6
7
/*
8
 You may not change or alter any portion of this comment or credits
9
 of supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit authors.
11
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
 */
16
/**
17
 * tdmcreate module.
18
 *
19
 * @copyright       XOOPS Project (https://xoops.org)
20
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
21
 *
22
 * @since           2.5.0
23
 *
24
 * @author          Txmod Xoops http://www.txmodxoops.org
25
 *
26
 */
27
28
/**
29
 * Class ClassXoopsCode.
30
 */
31
class ClassXoopsCode
32
{
33
    /*
34
    *  @static function getInstance
35
    *  @param null
36
    */
37
38
    /**
39
     * @return ClassXoopsCode
40
     */
41
    public static function getInstance()
42
    {
43
        static $instance = false;
44
        if (!$instance) {
45
            $instance = new self();
46
        }
47
48
        return $instance;
49
    }
50
51
    /**
52
     * @public function getClassCriteriaCompo
53
     *
54
     * @param        $var
55
     * @param string $t
56
     *
57
     * @return string
58
     */
59
    public function getClassCriteriaCompo($var, $t = '')
60
    {
61
        return "{$t}\${$var} = new \CriteriaCompo();\n";
62
    }
63
64
    /**
65
     * @public function getClassCriteria
66
     *
67
     * @param        $var
68
     * @param        $param1
69
     * @param string $param2
70
     * @param string $param3
71
     * @param bool   $isParam
72
     * @param string $t
73
     *
74
     * @return string
75
     */
76
    public function getClassCriteria($var, $param1, $param2 = '', $param3 = '', $isParam = false, $t = '')
77
    {
78
        $params = ('' != $param2) ? ', ' . $param2 : '';
79
        $params .= ('' != $param3) ? ', ' . $param3 : '';
80
81
        if (false === $isParam) {
82
            $ret = "{$t}\${$var} = new \Criteria( {$param1}{$params} );\n";
83
        } else {
84
            $ret = "new \Criteria( {$param1}{$params} )";
85
        }
86
87
        return $ret;
88
    }
89
90
    /**
91
     * @public function getClassAdd
92
     *
93
     * @param        $var
94
     * @param        $param
95
     * @param string $t
96
     *
97
     * @return string
98
     */
99
    public function getClassAdd($var, $param, $t = '')
100
    {
101
        return "{$t}\${$var}->add( {$param} );\n";
102
    }
103
104
    /**
105
     * @public function getClassSetStart
106
     *
107
     * @param        $var
108
     * @param        $start
109
     * @param string $t
110
     *
111
     * @return string
112
     */
113
    public function getClassSetStart($var, $start, $t = '')
114
    {
115
        return "{$t}\${$var}->setStart( \${$start} );\n";
116
    }
117
118
    /**
119
     * @public function getClassSetLimit
120
     *
121
     * @param        $var
122
     * @param        $limit
123
     * @param string $t
124
     *
125
     * @return string
126
     */
127
    public function getClassSetLimit($var, $limit, $t = '')
128
    {
129
        return "{$t}\${$var}->setLimit( \${$limit} );\n";
130
    }
131
132
    /**
133
     * @public function getClassAdd
134
     *
135
     * @param        $var
136
     * @param        $sort
137
     * @param string $t
138
     *
139
     * @return string
140
     */
141
    public function getClassSetSort($var, $sort, $t = '')
142
    {
143
        return "{$t}\${$var}->setSort( \${$sort} );\n";
144
    }
145
146
    /**
147
     * @public function getClassAdd
148
     *
149
     * @param        $var
150
     * @param        $order
151
     * @param string $t
152
     *
153
     * @return string
154
     */
155
    public function getClassSetOrder($var, $order, $t = '')
156
    {
157
        return "{$t}\${$var}->setOrder( \${$order} );\n";
158
    }
159
160
    /**
161
     * @public function getClassAdd
162
     *
163
     * @param string $paramLeft
164
     * @param string $paramRight
165
     * @param string $var
166
     * @param string $t
167
     *
168
     * @return string
169
     */
170
    public function getClassInitVar($paramLeft = '', $paramRight = '', $var = 'this', $t = "\t\t")
171
    {
172
        $stuParamRight = mb_strtoupper($paramRight);
173
174
        return "{$t}\${$var}->initVar('{$paramLeft}', XOBJ_DTYPE_{$stuParamRight});\n";
175
    }
176
177
    /**
178
     * @public function getClassXoopsPageNav
179
     *
180
     * @param        $var
181
     * @param        $param1
182
     * @param null   $param2
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param2 is correct as it would always require null to be passed?
Loading history...
183
     * @param null   $param3
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param3 is correct as it would always require null to be passed?
Loading history...
184
     * @param null   $param4
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param4 is correct as it would always require null to be passed?
Loading history...
185
     * @param null   $param5
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param5 is correct as it would always require null to be passed?
Loading history...
186
     * @param bool   $isParam
187
     * @param string $t
188
     *
189
     * @return string
190
     */
191
    public function getClassXoopsPageNav($var, $param1, $param2 = null, $param3 = null, $param4 = null, $param5 = null, $isParam = false, $t = '')
192
    {
193
        $xPageNav = 'new \XoopsPageNav(';
194
        if (false === $isParam) {
195
            $ret = "{$t}\${$var} = {$xPageNav}\${$param1}, \${$param2}, \${$param3}, '{$param4}', {$param5});\n";
196
        } else {
197
            $ret = "{$xPageNav}\${$param1}, \${$param2}, \${$param3}, '{$param4}', {$param5})";
198
        }
199
200
        return $ret;
201
    }
202
203
    /**
204
     * @public function getXoopsSimpleForm
205
     *
206
     * @param string $left
207
     * @param string $element
208
     * @param string $elementsContent
209
     * @param string $caption
210
     * @param string $var
211
     * @param string $filename
212
     * @param string $type
213
     * @param string $t
214
     *
215
     * @return string
216
     */
217
    public function getXoopsSimpleForm($left = '', $element = '', $elementsContent = '', $caption = '', $var = '', $filename = '', $type = 'post', $t = '')
218
    {
219
        $ret = "{$t}\${$left} = new \XoopsSimpleForm({$caption}, '{$var}', '{$filename}.php', '{$type}');\n";
220
        if (!empty($elementsContent)) {
221
            $ret .= $elementsContent;
222
        }
223
        $ret .= "{$t}\${$left}->addElement(\${$element});\n";
224
        $ret .= "{$t}\${$left}->display();\n";
225
226
        return $ret;
227
    }
228
229
    /**
230
     * @public function getClassXoopsThemeForm
231
     *
232
     * @param        $var
233
     * @param        $param1
234
     * @param null   $param2
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param2 is correct as it would always require null to be passed?
Loading history...
235
     * @param null   $param3
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param3 is correct as it would always require null to be passed?
Loading history...
236
     * @param null   $param4
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param4 is correct as it would always require null to be passed?
Loading history...
237
     * @param bool   $isParam
238
     * @param string $t
239
     *
240
     * @return string
241
     */
242
    public function getClassXoopsThemeForm($var, $param1, $param2 = null, $param3 = null, $param4 = null, $isParam = false, $t = "\t\t")
243
    {
244
        $themeForm = 'new \XoopsThemeForm(';
245
        if (false === $isParam) {
246
            $ret = "{$t}\${$var} = {$themeForm}\${$param1}, '{$param2}', \${$param3}, '{$param4}', true);\n";
247
        } else {
248
            $ret = "{$themeForm}\${$param1}, '{$param2}', \${$param3}, '{$param4}', true)";
249
        }
250
251
        return $ret;
252
    }
253
254
    /**
255
     * @public function XoopsFormElementTray
256
     *
257
     * @param        $var
258
     * @param        $param1
259
     * @param string $param2
260
     * @param string $t
261
     *
262
     * @return string
263
     */
264
    public function getClassXoopsFormElementTray($var, $param1, $param2 = '', $t = "\t\t")
265
    {
266
        return "{$t}\${$var} = new \XoopsFormElementTray({$param1}, '{$param2}' );\n";
267
    }
268
269
    /**
270
     * @public function getClassXoopsFormLabel
271
     *
272
     * @param        $var
273
     * @param string $param1
274
     * @param null   $param2
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param2 is correct as it would always require null to be passed?
Loading history...
275
     * @param bool   $isParam
276
     * @param string $t
277
     *
278
     * @return string
279
     */
280
    public function getClassXoopsFormLabel($var, $param1 = '', $param2 = null, $isParam = false, $t = "\t\t", $useParam = false)
281
    {
282
        $label  = 'new \XoopsFormLabel(';
283
        if (false === $useParam) {
284
            $params = null != $param2 ? "{$param1}, {$param2}" : $param1;
0 ignored issues
show
introduced by
The condition null != $param2 is always false.
Loading history...
285
        } else {
286
            $params = null != $param2 ? "{$param1}, \${$param2}" : $param1;
0 ignored issues
show
introduced by
The condition null != $param2 is always false.
Loading history...
287
        }
288
        if (false === $isParam) {
289
            $ret = "{$t}\${$var} = {$label}{$params});\n";
290
        } else {
291
            $ret = "{$label}{$params})";
292
        }
293
294
        return $ret;
295
    }
296
297
    /**
298
     * @public function getClassXoopsFormFile
299
     *
300
     * @param        $var
301
     * @param        $param1
302
     * @param        $param2
303
     * @param        $param3
304
     * @param bool   $isParam
305
     * @param string $t
306
     *
307
     * @return string
308
     */
309
    public function getClassXoopsFormFile($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t")
310
    {
311
        $file = 'new \XoopsFormFile( ';
312
        if (false === $isParam) {
313
            $ret = "{$t}\${$var} = {$file}{$param1}, '{$param2}', {$param3} );\n";
314
        } else {
315
            $ret = "{$file}{$param1}, '{$param2}', {$param3} )";
316
        }
317
318
        return $ret;
319
    }
320
321
    /**
322
     * @public function getClassXoopsFormHidden
323
     *
324
     * @param        $var
325
     * @param        $param1
326
     * @param        $param2
327
     * @param bool   $isForm
328
     * @param bool   $isParam
329
     * @param string $t
330
     *
331
     * @return string
332
     */
333
    public function getClassXoopsFormHidden($var, $param1, $param2, $isForm = false, $isParam = false, $t = "\t\t", $useParam = false)
334
    {
335
        $hidden       = 'new \XoopsFormHidden( ';
336
        $getVarHidden = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true);
337
        $ret          = '';
338
        if (false === $isParam) {
339
            $ret .= "{$t}\${$var} = {$hidden}{$param1}, {$getVarHidden} );\n";
340
        } else {
341
            if (false === $isForm) {
342
                $ret .= "{$hidden}{$param1}, {$param2} )";
343
            } else {
344
                if (false === $useParam) {
345
                    $ret .= "{$hidden}'{$param1}', '{$param2}' )";
346
                } else {
347
                    $ret .= "{$hidden}'{$param1}', \${$param2} )";
348
                }
349
            }
350
        }
351
352
        return $ret;
353
    }
354
355
    /**
356
     * @public function getClassXoopsFormText
357
     *
358
     * @param        $var
359
     * @param        $param1
360
     * @param        $param2
361
     * @param int    $param3
362
     * @param int    $param4
363
     * @param        $param5
364
     * @param bool   $isParam
365
     * @param string $t
366
     *
367
     * @return string
368
     */
369
    public function getClassXoopsFormText($var, $param1, $param2, $param3, $param4, $param5, $isParam = false, $t = "\t\t")
370
    {
371
        $text = 'new \XoopsFormText( ';
372
        if (false === $isParam) {
373
            $ret = "{$t}\${$var} = {$text}{$param1}, '{$param2}', {$param3}, {$param4}, \${$param5} );\n";
374
        } else {
375
            $ret = "{$text}{$param1}, '{$param2}', {$param3}, {$param4}, \${$param5} )";
376
        }
377
378
        return $ret;
379
    }
380
381
    /**
382
     * @public function getClassXoopsFormTextArea
383
     *
384
     * @param        $var
385
     * @param        $param1
386
     * @param        $param2
387
     * @param        $param3
388
     * @param        $param4
389
     * @param bool   $isParam
390
     * @param string $t
391
     *
392
     * @return string
393
     */
394
    public function getClassXoopsFormTextArea($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t")
395
    {
396
        $area           = 'new \XoopsFormTextArea( ';
397
        $getVarTextArea = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param2, true);
398
        if (false === $isParam) {
399
            $ret = "{$t}\${$var} = {$area}{$param1}, '{$param2}', {$getVarTextArea}, {$param3}, {$param4} );\n";
400
        } else {
401
            $ret = "{$area}{$param1}, '{$param2}', {$getVarTextArea}, {$param3}, {$param4} )";
402
        }
403
404
        return $ret;
405
    }
406
407
    /**
408
     * @public function getClassXoopsFormColorPicker
409
     *
410
     * @param        $var
411
     * @param        $param1
412
     * @param        $param2
413
     * @param        $param3
414
     * @param bool   $isParam
415
     * @param string $t
416
     *
417
     * @return string
418
     */
419
    public function getClassXoopsFormColorPicker($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t")
420
    {
421
        $picker = 'new \XoopsFormColorPicker( ';
422
        if (false === $isParam) {
423
            $ret = "{$t}\${$var} = {$picker}{$param1}, '{$param2}', {$param3} );\n";
424
        } else {
425
            $ret = "{$picker}{$param1}, '{$param2}', {$param3} )";
426
        }
427
428
        return $ret;
429
    }
430
431
    /**
432
     * @public function getClassXoopsFormSelectUser
433
     *
434
     * @param        $var
435
     * @param        $param1
436
     * @param        $param2
437
     * @param string $param3
438
     * @param        $param4
439
     * @param bool   $isParam
440
     * @param string $t
441
     *
442
     * @return string
443
     */
444
    public function getClassXoopsFormSelectUser($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t")
445
    {
446
        $user             = 'new \XoopsFormSelectUser( ';
447
        $getVarSelectUser = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true);
448
        if (false === $isParam) {
449
            $ret = "{$t}\${$var} = {$user}{$param1}, '{$param2}', {$param3}, {$getVarSelectUser} );\n";
450
        } else {
451
            $ret = "{$user}{$param1}, '{$param2}', {$param3}, {$getVarSelectUser} )";
452
        }
453
454
        return $ret;
455
    }
456
457
    /**
458
     * @public function getClassXoopsFormTextDateSelect
459
     *
460
     * @param        $var
461
     * @param        $param1
462
     * @param        $param2
463
     * @param string $param3
464
     * @param        $param4
465
     * @param bool   $isParam
466
     * @param string $t
467
     *
468
     * @return string
469
     */
470
    public function getClassXoopsFormTextDateSelect($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t")
471
    {
472
        $tdate                = 'new \XoopsFormTextDateSelect( ';
473
        $getVarTextDateSelect = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param3, true);
474
        if (false === $isParam) {
475
            $ret = "{$t}\${$var} = {$tdate}{$param1}, '{$param2}', '', {$getVarTextDateSelect} );\n";
476
        } else {
477
            $ret = "{$tdate}{$param1}, '{$param2}', '', \${$param4} )";
478
        }
479
480
        return $ret;
481
    }
482
483
    /**
484
     * @public function getClassXoopsFormEditor
485
     *
486
     * @param        $var
487
     * @param        $param1
488
     * @param        $param2
489
     * @param        $param3
490
     * @param bool   $isParam
491
     * @param string $t
492
     *
493
     * @return string
494
     */
495
    public function getClassXoopsFormEditor($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t")
496
    {
497
        $editor = 'new \XoopsFormEditor( ';
498
        if (false === $isParam) {
499
            $ret = "{$t}\${$var} = {$editor}{$param1}, '{$param2}', \${$param3});\n";
500
        } else {
501
            $ret = "{$editor}{$param1}, '{$param2}', \${$param3})";
502
        }
503
504
        return $ret;
505
    }
506
507
    /**
508
     * @public function getClassXoopsFormCheckBox
509
     *
510
     * @param        $var
511
     * @param        $param1
512
     * @param        $param2
513
     * @param        $param3
514
     * @param bool   $isParam
515
     * @param string $t
516
     *
517
     * @return string
518
     */
519
    public function getClassXoopsFormCheckBox($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t")
520
    {
521
        $checkBox = 'new \XoopsFormCheckBox( ';
522
        if (false === $isParam) {
523
            $ret = "{$t}\${$var} = {$checkBox}{$param1}, '{$param2}', {$param3});\n";
524
        } else {
525
            $ret = "{$checkBox}{$param1}, '{$param2}', {$param3})";
526
        }
527
528
        return $ret;
529
    }
530
531
    /**
532
     * @public function getClassXoopsFormRadioYN
533
     *
534
     * @param        $var
535
     * @param        $param1
536
     * @param        $param2
537
     * @param        $param3
538
     * @param bool   $isParam
539
     * @param string $t
540
     *
541
     * @return string
542
     */
543
    public function getClassXoopsFormRadioYN($var, $param1, $param2, $param3, $isParam = false, $t = "\t\t")
544
    {
545
        $radioYN = 'new \XoopsFormRadioYN( ';
546
        if (false === $isParam) {
547
            $ret = "{$t}\${$var} = {$radioYN}{$param1}, '{$param2}', \${$param3});\n";
548
        } else {
549
            $ret = "{$radioYN}{$param1}, '{$param2}', \${$param3})";
550
        }
551
552
        return $ret;
553
    }
554
555
    /**
556
     * @public function getClassXoopsFormSelect
557
     *
558
     * @param        $var
559
     * @param        $param1
560
     * @param        $param2
561
     * @param        $param3
562
     * @param null   $param4
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param4 is correct as it would always require null to be passed?
Loading history...
563
     * @param null   $param5
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $param5 is correct as it would always require null to be passed?
Loading history...
564
     * @param bool   $isParam
565
     * @param string $t
566
     *
567
     * @return string
568
     */
569
    public function getClassXoopsFormSelect($var, $param1, $param2, $param3, $param4 = null, $param5 = null, $isParam = false, $t = "\t\t")
570
    {
571
        $otherParam = null != $param4 ? ", {$param4}" : (null != $param5 ? ", {$param5}" : '');
0 ignored issues
show
introduced by
The condition null != $param4 is always false.
Loading history...
introduced by
The condition null != $param5 is always false.
Loading history...
572
        $select     = 'new \XoopsFormSelect( ';
573
        if (false === $isParam) {
574
            $ret = "{$t}\${$var} = {$select}{$param1}, '{$param2}', \${$param3}{$otherParam});\n";
575
        } else {
576
            $ret = "{$select}{$param1}, '{$param2}', \${$param3}{$otherParam})";
577
        }
578
579
        return $ret;
580
    }
581
582
    /**
583
     * @public function getClassXoopsFormTag
584
     *
585
     * @param        $var
586
     * @param        $param1
587
     * @param        $param2
588
     * @param        $param3
589
     * @param        $param4
590
     * @param int    $param5
591
     * @param bool   $isParam
592
     * @param string $t
593
     *
594
     * @return string
595
     */
596
    public function getClassXoopsFormTag($var, $param1, $param2, $param3, $param4, $param5 = 0, $isParam = false, $t = "\t\t")
597
    {
598
        $tag = 'new \XoopsFormTag( ';
599
        if (false === $isParam) {
600
            $ret = "{$t}\${$var} = {$tag}'{$param1}', {$param2}, {$param3}, \${$param4}, {$param5} );\n";
601
        } else {
602
            $ret = "{$tag}'{$param1}', {$param2}, {$param3}, \${$param4}, {$param5} )";
603
        }
604
605
        return $ret;
606
    }
607
608
    /**
609
     * @public function getClassXoopsFormButton
610
     *
611
     * @param        $var
612
     * @param        $param1
613
     * @param        $param2
614
     * @param        $param3
615
     * @param        $param4
616
     * @param bool   $isParam
617
     * @param string $t
618
     *
619
     * @return string
620
     */
621
    public function getClassXoopsFormButton($var, $param1, $param2, $param3, $param4, $isParam = false, $t = "\t\t")
622
    {
623
        $button = 'new \XoopsFormButton( ';
624
        if (false === $isParam) {
625
            $ret = "{$t}\${$var} = {$button}'{$param1}', '{$param2}', {$param3}, '{$param4}');\n";
626
        } else {
627
            $ret = "{$button}'{$param1}', '{$param2}', {$param3}, '{$param4}')";
628
        }
629
630
        return $ret;
631
    }
632
633
    /**
634
     * @public   function getClassXoopsObjectTree
635
     *
636
     * @param string $var
637
     * @param        $param1
638
     * @param        $param2
639
     * @param        $param3
640
     * @param string $t
641
     *
642
     * @return string
643
     */
644
    public function getClassXoopsObjectTree($var, $param1, $param2, $param3, $t = '')
645
    {
646
        $ret = "{$t}\${$var} = new \XoopsObjectTree(\${$param1}, '{$param2}', '{$param3}');\n";
647
648
        return $ret;
649
    }
650
651
    /**
652
     * @public function getClassXoopsMakeSelBox
653
     *
654
     * @param        $var
655
     * @param        $anchor
656
     * @param        $param1
657
     * @param        $param2
658
     * @param string $param3
659
     * @param        $param4
660
     * @param string $t
661
     *
662
     * @return string
663
     */
664
    public function getClassXoopsMakeSelBox($var, $anchor, $param1, $param2, $param3, $param4, $t = '')
665
    {
666
        $getVar = Tdmcreate\Files\CreateXoopsCode::getInstance()->getXcGetVar('', 'this', $param4, true);
667
        $ret    = "{$t}\${$var} = \${$anchor}->makeSelBox( '{$param1}', '{$param2}', '{$param3}', {$getVar}, true );\n";
668
669
        return $ret;
670
    }
671
672
    /**
673
     * @public function getClassAddOption
674
     *
675
     * @param        $var
676
     * @param        $params
677
     * @param string $t
678
     *
679
     * @return string
680
     */
681
    public function getClassAddOption($var, $params, $t = "\t\t")
682
    {
683
        return "{$t}\${$var}->addOption({$params});\n";
684
    }
685
686
    /**
687
     * @public function getClassAddOptionArray
688
     *
689
     * @param        $var
690
     * @param        $params
691
     * @param string $t
692
     *
693
     * @return string
694
     */
695
    public function getClassAddOptionArray($var, $params, $t = "\t\t")
696
    {
697
        return "{$t}\${$var}->addOptionArray({$params});\n";
698
    }
699
700
    /**
701
     * @public function getClassAddElement
702
     *
703
     * @param string $var
704
     * @param string $params
705
     * @param string $t
706
     *
707
     * @return string
708
     */
709
    public function getClassAddElement($var = '', $params = '', $t = "\t\t")
710
    {
711
        return "{$t}\${$var}->addElement({$params});\n";
712
    }
713
714
    /**
715
     * @public function getClassSetDescription
716
     *
717
     * @param        $var
718
     * @param        $params
719
     * @param string $t
720
     *
721
     * @return string
722
     */
723
    public function getClassSetDescription($var, $params, $t = "\t\t")
724
    {
725
        return "{$t}\${$var}->setDescription({$params});\n";
726
    }
727
728
    /**
729
     * @public function getClassSetExtra
730
     *
731
     * @param        $var
732
     * @param        $params
733
     * @param string $t
734
     *
735
     * @return string
736
     */
737
    public function getClassSetExtra($var, $params, $t = "\t\t")
738
    {
739
        return "{$t}\${$var}->setExtra({$params});\n";
740
    }
741
}
742