SmartFormTextElement   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 5
1
<?php namespace XoopsModules\Smartobject\Form\Elements;
2
3
/**
4
 * Contains the SmartObjectControl class
5
 *
6
 * @license    GNU
7
 * @author     marcan <[email protected]>
8
 * @link       http://smartfactory.ca The SmartFactory
9
 * @package    SmartObject
10
 * @subpackage SmartObjectForm
11
 */
12
13
use XoopsModules\Smartobject;
14
15
/**
16
 * Class SmartFormTextElement
17
 * @package XoopsModules\Smartobject\Form\Elements
18
 */
19
class SmartFormTextElement extends \XoopsFormText
20
{
21
    /**
22
     * SmartFormTextElement constructor.
23
     * @param string $object
24
     * @param string $key
25
     */
26
    public function __construct($object, $key)
27
    {
28
        $var = $object->vars[$key];
29
30
        if (isset($object->controls[$key])) {
31
            $control        = $object->controls[$key];
32
            $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255);
33
            $form_size      = isset($control['size']) ? $control['size'] : 50;
34
        } else {
35
            $form_maxlength = 255;
36
            $form_size      = 50;
37
        }
38
39
        parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e'));
0 ignored issues
show
Bug introduced by
The method getVar cannot be called on $object (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
40
    }
41
}
42