TransitionTransformer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 10 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