TransitionTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Flows\Transformers;
4
5
use League\Fractal\TransformerAbstract;
6
use Hechoenlaravel\JarvisFoundation\Flows\Transition;
7
8
/**
9
 * Class TransitionTransformer
10
 * @package Hechoenlaravel\JarvisFoundation\Flows\Transformers
11
 */
12
class TransitionTransformer extends TransformerAbstract
13
{
14
    /**
15
     * @param Transition $transition
16
     * @return array
17
     */
18
    public function transform(Transition $transition)
19
    {
20
        return [
21
            'id' => (int) $transition->id,
22
            'from' => $transition->from->transformed()->toArray(),
23
            'to' => $transition->to->transformed()->toArray(),
24
            'created' => $transition->created_at,
25
            'updated' => $transition->updated_at
26
        ];
27
    }
28
}
29