ByPuid::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 17
rs 9.9332
c 0
b 0
f 0
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\Transformers\WorklogTransformer;
7
use \League\Fractal\Manager as FractalManager;
8
use \League\Fractal\Resource\Collection;
9
10
class ByPuid {
11
12
    public static function execute(Parameters $params, Daemon $daemon) {
13
14
        $puid = $params->get('puid');
15
16
        $manager = new Manager(
17
            $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

17
            $daemon->/** @scrutinizer ignore-call */ 
18
                     getConfiguration(),
Loading history...
18
            $daemon->getLogger(),
19
            $daemon->getEvents()
20
        );
21
22
        $data = $manager->get(['parent_uid' => $puid]);
23
24
        $resource = new Collection($data, new WorklogTransformer);
25
        $fractal = new FractalManager();
26
        $data = $fractal->createData($resource)->toArray();
27
28
        return $data['data'];
29
30
    }
31
32
}
33