RequestTransformer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

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