Image   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 10 1
1
<?php
2
3
namespace Faithgen\Testimonies\Http\Resources;
4
5
use FaithGen\SDK\Helpers\ImageHelper;
6
use Illuminate\Http\Resources\Json\JsonResource;
7
use InnoFlash\LaraStart\Helper;
8
9
class Image extends JsonResource
10
{
11
    /**
12
     * Transform the resource into an array.
13
     *
14
     * @param \Illuminate\Http\Request $request
15
     * @return array
16
     */
17
    public function toArray($request)
18
    {
19
        return [
20
            'id' => $this->id,
21
            'caption' => $this->caption,
22
            'comments_count' => $this->comments()->count(),
23
            'date' => Helper::getDates($this->created_at),
24
            'avatar' => ImageHelper::getImage('testimonies', $this->resource, config('faithgen-sdk.ministries-server')),
25
        ];
26
    }
27
}
28