Completed
Pull Request — master (#144)
by Michael
03:13
created

ClassXoopsCode   D

Complexity

Total Complexity 59

Size/Duplication

Total Lines 701
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 143
dl 0
loc 701
rs 4.08
c 0
b 0
f 0
wmc 59

34 Methods

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

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