EnrollmentTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
ccs 0
cts 15
cp 0
rs 9.4285
cc 1
eloc 11
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Scool\EnrollmentMobile\Transformers;
4
5
use League\Fractal\TransformerAbstract;
6
use Scool\EnrollmentMobile\Models\Enrollment;
7
8
/**
9
 * Class EnrollmentTransformer
10
 * @package namespace App\Transformers;
11
 */
12
class EnrollmentTransformer extends TransformerAbstract
13
{
14
15
    /**
16
     * Transform the \Enrollment entity
17
     * @param \Enrollment $model
18
     *
19
     * @return array
20
     */
21
    public function transform(Enrollment $model)
22
    {
23
        return [
24
            'id'         => (int) $model->id,
25
26
            /* place your other model properties here */
27
28
            'name'      => $model->id,
29
            'validated' => (bool)$model->validated,
30
            'finished' => (bool)$model->finished,
31
            'study_id' => (int)$model->study_id,
32
            'course_id' => (int)$model->course_id,
33
            'classroom_id' => (int)$model->classroom_id,
34
35
36
            'created_at' => $model->created_at,
37
            'updated_at' => $model->updated_at
38
        ];
39
    }
40
}
41