Completed
Branch job-vuejs (8df734)
by Adam
17:32
created

FirmWithBenefits   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 10 2
1
<?php
2
3
namespace Coyote\Http\Transformers;
4
5
use Coyote\Firm;
6
use League\Fractal\TransformerAbstract;
7
8
class FirmWithBenefits extends TransformerAbstract
9
{
10
    /**
11
     * @param Firm $firm
12
     * @return array
13
     */
14
    public function transform(Firm $firm): array
15
    {
16
        $data = array_except($firm->toArray(), ['benefits']);
17
18
        return array_merge($data, [
19
            'thumbnail' => $firm->logo->getFilename() ? (string) $firm->logo->url() : cdn('img/logo-gray.png'),
20
            'logo' => $firm->getOriginal('logo'),
21
            'benefits' => $firm->benefits->pluck('name')->toArray()
0 ignored issues
show
Bug introduced by
The method pluck cannot be called on $firm->benefits (of type array<integer,object<Coyote\Firm\Benefit>>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
22
        ]);
23
    }
24
}
25