Completed
Push — master ( 4a8d0f...5fbf19 )
by Konstantinos
04:38
created

MapController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 33
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A listAction() 0 15 2
A createAction() 0 4 1
A editAction() 0 4 1
A deleteAction() 0 4 1
1
<?php
2
3
class MapController extends CRUDController
4
{
5
    public function listAction(Map $map = null)
6
    {
7
        if ($map === null) {
8
            $qb = $this->getQueryBuilder();
9
10
            $maps = $qb->sortBy('name')
11
                ->getModels();
12
        } else {
13
            $maps = array($map);
14
        }
15
16
        return array(
17
            "maps" => $maps
18
        );
19
    }
20
21
    public function createAction(Player $me)
22
    {
23
        return $this->create($me);
24
    }
25
26
    public function editAction(Player $me, Map $map)
27
    {
28
        return $this->edit($map, $me, "map");
29
    }
30
31
    public function deleteAction(Player $me, Map $map)
32
    {
33
        return $this->delete($map, $me);
34
    }
35
}
36