Completed
Push — master ( dd842b...72a857 )
by Alexander
03:27
created

helpers.php ➔ transformation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
use Flugg\Responder\Contracts\Responder;
4
use Flugg\Responder\Contracts\SimpleTransformer;
5
use Flugg\Responder\TransformBuilder;
6
7
if (! function_exists('responder')) {
8
9
    /**
10
     * A helper method to resolve the responder service out of the service container.
11
     *
12
     * @return \Flugg\Responder\Contracts\Responder
13
     */
14
    function responder(): Responder
15
    {
16 44
        return app(Responder::class);
17
    }
18
}
19
20
if (! function_exists('transformation')) {
21
22
    /**
23
     * A helper method to transform data without serializing.
24
     *
25
     * @param  mixed                                                          $data
26
     * @param  \Flugg\Responder\Transformers\Transformer|callable|string|null $transformer
27
     * @return \Flugg\Responder\TransformBuilder
28
     */
29
    function transformation($data = null, $transformer = null): TransformBuilder
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
30
    {
31 1
        return app(SimpleTransformer::class)->make($data, $transformer);
32
    }
33
}
34