SmartFormSetPasswordElement   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
1
<?php namespace XoopsModules\Smartobject\Form\Elements;
2
/**
3
 * Contains the set password tray class
4
 *
5
 * @license    GNU
6
 * @author     marcan <[email protected]>
7
 * @link       http://smartfactory.ca The SmartFactory
8
 * @package    SmartObject
9
 * @subpackage SmartObjectForm
10
 */
11
12
use XoopsModules\Smartobject;
13
14
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
15
16
/**
17
 * Class SmartFormSetPasswordElement
18
 * @package XoopsModules\Smartobject\Form\Elements
19
 */
20
class SmartFormSetPasswordElement extends \XoopsFormElementTray
21
{
22
    /**
23
     * Size of the field.
24
     * @var int
25
     * @access  private
26
     */
27
    public $_size;
28
29
    /**
30
     * Maximum length of the text
31
     * @var int
32
     * @access  private
33
     */
34
    public $_maxlength;
35
36
    /**
37
     * Initial content of the field.
38
     * @var string
39
     * @access  private
40
     */
41
    public $_value;
42
43
    /**
44
     * Constructor
45
     *
46
     * @param string $object
47
     * @param string $key
48
     * @internal param string $caption Caption
49
     * @internal param string $name "name" attribute
50
     * @internal param int $size Size of the field
51
     * @internal param int $maxlength Maximum length of the text
52
     * @internal param int $value Initial value of the field.
53
     *                          <b>Warning:</b> this is readable in cleartext in the page's source!
54
     */
55
    public function __construct($object, $key)
56
    {
57
        $var     = $object->vars[$key];
58
        $control = $object->controls[$key];
0 ignored issues
show
Unused Code introduced by
$control is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
59
60
        parent::__construct($var['form_caption'] . '<br>' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray');
61
62
        $password_box1 = new \XoopsFormPassword('', $key . '1', 10, 32);
63
        $this->addElement($password_box1);
64
65
        $password_box2 = new \XoopsFormPassword('', $key . '2', 10, 32);
66
        $this->addElement($password_box2);
67
    }
68
}
69