RuleController::getMany()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Loadsman\LaravelPlugin\Modules\Rule;
4
5
use Loadsman\PHP\DTO\Rule;
6
use Loadsman\PHP\Http\Response;
7
use Loadsman\PHP\Transformers\RuleTransformer;
8
9
class RuleController extends \Illuminate\Routing\Controller
10
{
11
    public function getMany()
12
    {
13
        $rules = app(RuleRepository::class)->getAll();
14
15
        $transformer = new RuleTransformer();
16
        $data = array_map(function (Rule $rule) use ($transformer) {
17
            return $transformer->transform($rule);
18
        }, $rules);
19
20
        return (new Response($data))->toArray();
21
    }
22
}