Passed
Push — dev5 ( 1f3b64...3a6272 )
by Ron
06:33
created

FileLinks   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 38
rs 10
ccs 13
cts 13
cp 1
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 16 4
1
<?php
2
3
namespace App\Http\Resources;
4
5
use App\Customers as Cust;
6
use Carbon\Carbon;
7
use Illuminate\Http\Resources\Json\JsonResource;
8
9
class FileLinks extends JsonResource
10
{
11
    /**
12
     * Transform the resource into an array.
13
     *
14
     * @param  \Illuminate\Http\Request  $request
15
     * @property integer $link_id
16
     * @property integer $user_id
17
     * @property integer $cust_id
18
     * @property string $cust_name
19
     * @property string $link_hash
20
     * @property string $link_name
21
     * @property string $exp_format
22
     * @property string $expired
23
     * @property string $exp_stamp
24
     * @property string $allow_upload
25
     * @property integer $file_count
26
     * @property string $note
27
     * @property string $expire
28
     * @property integer $file_link_files_count
29
     * @return array
30
     */
31 6
    public function toArray($request)
32
    {
33
        // return parent::toArray($request);
34
        return [
35 6
            'link_id'      => $this->link_id,
1 ignored issue
show
Bug Best Practice introduced by
The property link_id does not exist on App\Http\Resources\FileLinks. Since you implemented __get, consider adding a @property annotation.
Loading history...
36 6
            'user_id'      => $this->user_id,
1 ignored issue
show
Bug Best Practice introduced by
The property user_id does not exist on App\Http\Resources\FileLinks. Since you implemented __get, consider adding a @property annotation.
Loading history...
37 6
            'cust_id'      => $this->cust_id,
1 ignored issue
show
Bug Best Practice introduced by
The property cust_id does not exist on App\Http\Resources\FileLinks. Since you implemented __get, consider adding a @property annotation.
Loading history...
38 6
            'cust_name'    => $this->cust_id ? Cust::find($this->cust_id)->name : 'None',
1 ignored issue
show
Bug introduced by
The property name does not seem to exist on App\Customers. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
39 6
            'link_hash'    => $this->link_hash,
1 ignored issue
show
Bug Best Practice introduced by
The property link_hash does not exist on App\Http\Resources\FileLinks. Since you implemented __get, consider adding a @property annotation.
Loading history...
40 6
            'link_name'    => $this->link_name,
1 ignored issue
show
Bug Best Practice introduced by
The property link_name does not exist on App\Http\Resources\FileLinks. Since you implemented __get, consider adding a @property annotation.
Loading history...
41 6
            'exp_format'   => Carbon::parse($this->expire)->format('M d, Y'),
1 ignored issue
show
Bug Best Practice introduced by
The property expire does not exist on App\Http\Resources\FileLinks. Since you implemented __get, consider adding a @property annotation.
Loading history...
42 6
            'expired'      => $this->expire < Carbon::now() ? 1 : 0,
43 6
            'exp_stamp'    => Carbon::parse($this->expire)->format('Y-m-d'),
44 6
            'allow_upload' => $this->allow_upload,
1 ignored issue
show
Bug Best Practice introduced by
The property allow_upload does not exist on App\Http\Resources\FileLinks. Since you implemented __get, consider adding a @property annotation.
Loading history...
45 6
            'file_count'   => isset($this->file_link_files_count) ? $this->file_link_files_count : 0,
1 ignored issue
show
Bug Best Practice introduced by
The property file_link_files_count does not exist on App\Http\Resources\FileLinks. Since you implemented __get, consider adding a @property annotation.
Loading history...
46 6
            'note'         => $this->note
1 ignored issue
show
Bug Best Practice introduced by
The property note does not exist on App\Http\Resources\FileLinks. Since you implemented __get, consider adding a @property annotation.
Loading history...
47
        ];
48
    }
49
}
50