MinsidaController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 31
c 0
b 0
f 0
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A indexActionPost() 0 17 3
A indexActionGet() 0 7 1
1
<?php
2
3
namespace KW\Inlagg;
4
5
use Anax\Commons\ContainerInjectableInterface;
6
use Anax\Commons\ContainerInjectableTrait;
7
8
class MinsidaController implements ContainerInjectableInterface
9
{
10
    use ContainerInjectableTrait;
11
12
    public function indexActionGet()
13
    {
14
        $page = $this->di->get("page");
15
        $page->add("anax/v2/minsida/minsida", [
16
            ]);
17
        return $page->render([
18
            "title"=>"Min sida"
19
        ]);
20
    }
21
22
    public function indexActionPost()
23
    {
24
        $typ = $this->di->get("request")->getPost("knapp");
25
        $inloggaren = new Inloggaren($this->di);
26
27
        if ($typ == "Spara nytt lösenord") {
28
            $losenord = $this->di->get("request")->getPost("losenord");
29
            $inloggaren->uppdateraInlogg("losenord", MD5($losenord));
30
        }
31
32
        if ($typ == "Spara ny epostadress") {
33
            $epost = $this->di->get("request")->getPost("epost");
34
            $inloggaren->uppdateraInlogg("email", $epost);
35
            $this->di->session->set("email", $epost);
0 ignored issues
show
Bug introduced by
Accessing session on the interface Psr\Container\ContainerInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
36
        }
37
38
        return $this->di->get("response")->redirect("minsida")->send();
39
    }
40
}
41