Test Failed
Push — master ( cc821f...fdc4d2 )
by Fran
09:36 queued 04:02
created

AdminForm   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 8.69%

Importance

Changes 0
Metric Value
dl 0
loc 51
ccs 2
cts 23
cp 0.0869
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTitle() 0 4 1
A getName() 0 4 1
B __construct() 0 25 1
1
<?php
2
3
namespace PSFS\base\config;
4
5
use PSFS\base\Router;
6
use PSFS\base\Security;
7
use PSFS\base\types\Form;
8
9
/**
10
 * Class AdminForm
11
 * @package PSFS\base\config
12
 */
13
class AdminForm extends Form
14
{
15
16
    /**
17
     * @throws \PSFS\base\exception\RouterException
18
     */
19 1
    public function __construct()
20
    {
21 1
        $this->setAction(Router::getInstance()->getRoute('admin-setup'));
22
        $this->add('username', array(
23
            'label' => _('User Alias'),
24
            'autocomplete' => 'off',
25
        ))->add('password', array(
26
            'type' => 'password',
27
            'label' => _('Password'),
28
            'autocomplete' => 'off',
29
        ))->add('profile', array(
30
            'type' => 'select',
31
            'label' => _("Role"),
32
            'value' => sha1('superadmin'),
33
            'autocomplete' => 'off',
34
            'data' => Security::getProfiles(),
35
        ));
36
        //Apply styling to the form
37
        $this->setAttrs(array(
38
            "class" => "col-md-6",
39
            "autocomplete" => "off",
40
        ));
41
        //Add action buttons to form
42
        $this->addButton('submit');
43
    }
44
45
    /**
46
     * Method that returns the form's title
47
     * @return string
48
     */
49
    public function getTitle()
50
    {
51
        return _("Admin user control panel");
52
    }
53
54
    /**
55
     * Method that returns the form's name
56
     * @return string
57
     */
58
    public function getName()
59
    {
60
        return "admin_setup";
61
    }
62
63
}
64