Passed
Push — master ( 87c6b6...f17d15 )
by Fran
02:49
created

AdminForm::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
     * AdminForm constructor.
18
     * @throws \PSFS\base\exception\GeneratorException
19
     */
20 1
    public function __construct()
21
    {
22 1
        parent::__construct();
23 1
        $this->setAction(Router::getInstance()->getRoute('admin-setup'));
24 1
        $this->add('username', array(
25 1
            'label' => t('User Alias'),
26 1
            'autocomplete' => 'off',
27 1
        ))->add('password', array(
28 1
            'type' => 'password',
29 1
            'label' => t('Password'),
30 1
            'autocomplete' => 'off',
31 1
        ))->add('profile', array(
32 1
            'type' => 'select',
33 1
            'label' => t("Role"),
34 1
            'value' => sha1('superadmin'),
35 1
            'autocomplete' => 'off',
36 1
            'data' => Security::getProfiles(),
37
        ));
38
        //Apply styling to the form
39 1
        $this->setAttrs(array(
40 1
            "class" => "col-md-6",
41
            "autocomplete" => "off",
42
        ));
43
        //Add action buttons to form
44 1
        $this->addButton('submit');
45 1
    }
46
47
    /**
48
     * Method that returns the form's title
49
     * @return string
50
     */
51
    public function getTitle()
52
    {
53
        return t("Admin user control panel");
54
    }
55
56
    /**
57
     * Method that returns the form's name
58
     * @return string
59
     */
60 1
    public function getName()
61
    {
62 1
        return "admin_setup";
63
    }
64
65
}
66