Completed
Push — master ( 82cd1d...312098 )
by Nikolas
163:59 queued 138:22
created

IndexResource   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A respond() 0 8 2
A doGet() 0 8 1
1
<?php
2
namespace rtens\domin\delivery\web\adapters\curir\root;
3
4
use rtens\domin\delivery\web\adapters\curir\CurirBreadCrumbsTrail;
5
use rtens\domin\delivery\web\adapters\curir\CurirParameterReader;
6
use rtens\domin\delivery\web\resources\ActionListResource;
7
use rtens\domin\delivery\web\WebApplication;
8
use watoki\curir\Container;
9
use watoki\curir\cookie\CookieStore;
10
use watoki\curir\delivery\WebRequest;
11
use watoki\deli\Path;
12
use watoki\deli\Request;
13
14
class IndexResource extends Container {
15
16
    /**
17
     * @param Request|WebRequest $request
18
     * @return \watoki\curir\delivery\WebResponse
19
     */
20
    public function respond(Request $request) {
21
        if (!$this->isContainerTarget($request)) {
22
            $request = $request
23
                ->withTarget(Path::fromString('execute'))
24
                ->withArgument(ExecuteResource::ACTION_ARG, $request->getTarget()->toString());
25
        }
26
        return parent::respond($request);
27
    }
28
29
    /**
30
     * @param WebRequest $request <-
31
     * @param WebApplication $app <-
32
     * @param CookieStore $cookies <-
33
     * @return string
34
     */
35
    public function doGet(WebRequest $request, WebApplication $app, CookieStore $cookies) {
36
        $app->prepare();
37
38
        $crumbs = new CurirBreadCrumbsTrail(new CurirParameterReader($request), $cookies);
39
        $actionList = new ActionListResource($app, $crumbs);
40
41
        return $actionList->handleGet();
42
    }
43
}