Profile   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 36
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addDefaultButtons() 0 9 1
A addCanLogin() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Form\Factory;
6
7
use AbterPhp\Admin\Domain\Entities\User as Entity;
8
use AbterPhp\Framework\Constant\Html5;
9
use AbterPhp\Framework\Form\Element\Input;
10
use AbterPhp\Framework\Form\Extra\DefaultButtons;
11
use AbterPhp\Framework\Html\Helper\Attributes;
12
13
class Profile extends User
14
{
15
    /**
16
     * @param Entity $entity
17
     *
18
     * @return $this
19
     */
20
    protected function addCanLogin(Entity $entity): User
21
    {
22
        $this->form[] = new Input(
23
            'can_login',
24
            'can_login',
25
            '1',
26
            [],
27
            Attributes::fromArray([Html5::ATTR_TYPE => [Input::TYPE_HIDDEN]])
28
        );
29
30
        return $this;
31
    }
32
33
    /**
34
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
35
     *
36
     * @param string $showUrl
37
     *
38
     * @return Base
39
     */
40
    protected function addDefaultButtons(string $showUrl): Base
41
    {
42
        $buttons = new DefaultButtons();
43
44
        $buttons->addSave();
45
46
        $this->form[] = $buttons;
47
48
        return $this;
49
    }
50
}
51