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