RequestTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Statistics\Transformers\Adminarea;
6
7
use Rinvex\Support\Traits\Escaper;
8
use Rinvex\Statistics\Models\Request;
9
use League\Fractal\TransformerAbstract;
10
11
class RequestTransformer extends TransformerAbstract
12
{
13
    use Escaper;
14
15
    /**
16
     * @return array
17
     */
18
    public function transform(Request $request): array
19
    {
20
        return $this->escape([
21
            'user' => (string) $request->user,
22
            'session_id' => (string) $request->session_id,
23
            'status_code' => (string) $request->status_code,
24
            'method' => (string) $request->method,
25
            'protocol_version' => (string) $request->protocol_version,
26
            'referer' => (string) $request->referer,
27
            'language' => (string) $request->language,
28
            'is_no_cache' => (bool) $request->is_no_cache,
29
            'wants_json' => (bool) $request->wants_json,
30
            'is_secure' => (bool) $request->is_secure,
31
            'is_json' => (bool) $request->is_json,
32
            'is_ajax' => (bool) $request->is_ajax,
33
            'is_pjax' => (bool) $request->is_pjax,
34
            'created_at' => (string) $request->created_at,
35
        ]);
36
    }
37
}
38