GetList   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 27 2
1
<?php namespace Comodojo\Extender\Socket\Commands\Worklog;
2
3
use \Comodojo\Daemon\Daemon;
4
use \Comodojo\RpcServer\Request\Parameters;
5
use \Comodojo\Extender\Worklog\Manager;
6
use \Comodojo\Extender\Socket\Messages\Worklog\Filter;
7
use \Comodojo\Extender\Transformers\WorklogTransformer;
8
use \League\Fractal\Manager as FractalManager;
9
use \League\Fractal\Resource\Collection;
10
11
class GetList {
12
13
    public static function execute(Parameters $params, Daemon $daemon) {
14
15
        $filter = $params->get('filter');
16
17
        $manager = new Manager(
18
            $daemon->getConfiguration(),
0 ignored issues
show
Bug introduced by
The method getConfiguration() does not exist on Comodojo\Daemon\Daemon. It seems like you code against a sub-type of Comodojo\Daemon\Daemon such as Comodojo\Extender\ExtenderDaemon. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
            $daemon->/** @scrutinizer ignore-call */ 
19
                     getConfiguration(),
Loading history...
19
            $daemon->getLogger(),
20
            $daemon->getEvents()
21
        );
22
23
        if ( empty($filter) ) {
24
            $data = $manager->get();
25
        } else {
26
            $f = Filter::createFromExport($filter);
27
            $data = $manager->get(
28
                [],
29
                $f->getLimit(),
30
                $f->getOffset(),
31
                $f->getReverse()
32
            );
33
        }
34
35
        $resource = new Collection($data, new WorklogTransformer);
36
        $fractal = new FractalManager();
37
        $data = $fractal->createData($resource)->toArray();
38
39
        return $data['data'];
40
41
    }
42
43
}
44