ScheduleTransformer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 32
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A transformResource() 0 13 1
A buildTimes() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 29.10.18
6
 * Time: 09:38.
7
 */
8
9
namespace Modules\Schedule\Transformers;
10
11
use Foundation\Abstracts\Transformers\Transformer;
12
use Foundation\Exceptions\Exception;
13
use Modules\Schedule\Entities\Schedule;
14
use Modules\User\Transformers\UserTransformer;
15
16
class ScheduleTransformer extends Transformer
17
{
18
    public $available = [
19
        'user' => UserTransformer::class,
20
    ];
21
22
    /**
23
     * Transform the resource into an array.
24
     *
25
     * @throws Exception
26
     *
27
     * @return array
28
     */
29
    public function transformResource(Schedule $schedule)
30
    {
31
        return [
32
            'id' => $schedule->id,
33
            'alias' => $schedule->alias,
0 ignored issues
show
Bug introduced by
The property alias does not seem to exist on Modules\Schedule\Entities\Schedule. 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...
34
            'timezone' => $schedule->timezone,
0 ignored issues
show
Bug introduced by
The property timezone does not seem to exist on Modules\Schedule\Entities\Schedule. 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...
35
            'week_days' => $schedule->week_days,
0 ignored issues
show
Bug introduced by
The property week_days does not seem to exist on Modules\Schedule\Entities\Schedule. 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...
36
            'exceptions' => $schedule->exceptions,
0 ignored issues
show
Bug introduced by
The property exceptions does not seem to exist on Modules\Schedule\Entities\Schedule. 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...
37
            'randomize' => $schedule->randomize,
0 ignored issues
show
Bug introduced by
The property randomize does not seem to exist on Modules\Schedule\Entities\Schedule. 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...
38
            'times' => $schedule->times, //$this->buildTimes($schedule->week_days),
0 ignored issues
show
Bug introduced by
The property times does not exist on Modules\Schedule\Entities\Schedule. Did you mean timestamps?
Loading history...
39
            'accounts' => [],
40
            'created_at' => $schedule->created_at,
41
            'updated_at' => $schedule->updated_at,
42
        ];
43
    }
44
45
    public function buildTimes($weekDays): array
0 ignored issues
show
Unused Code introduced by
The parameter $weekDays is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

45
    public function buildTimes(/** @scrutinizer ignore-unused */ $weekDays): array

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
46
    {
47
        return [];
48
    }
49
}
50