SmartFormAutocompleteElement::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
nc 8
nop 2
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
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 SmartFormAutocompleteElement
17
 * @package XoopsModules\Smartobject\Form\Elements
18
 */
19
class SmartFormAutocompleteElement extends Smartobject\Form\Elements\SmartAutocompleteElement
20
{
21
    /**
22
     * SmartFormAutocompleteElement constructor.
23
     * @param string $object
24
     * @param string $key
25
     */
26
    public function __construct($object, $key)
27
    {
28
        $var            = $object->vars[$key];
29
        $control        = $object->controls[$key];
30
        $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255);
31
32
        $form_size = isset($control['size']) ? $control['size'] : 50;
33
        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...
34
    }
35
}
36