RequestTransformer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 14
ccs 2
cts 2
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Laravel Throttle.
7
 *
8
 * (c) Graham Campbell <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace GrahamCampbell\Throttle\Transformers;
15
16
use GrahamCampbell\Throttle\Data;
17
18
/**
19
 * This is the request transformer class.
20
 *
21
 * @author Graham Campbell <[email protected]>
22
 */
23
class RequestTransformer implements TransformerInterface
24
{
25
    /**
26
     * Transform the data into a new data instance.
27
     *
28
     * @param \Illuminate\Http\Request $data
29
     * @param int                      $limit
30
     * @param int                      $time
31
     *
32
     * @return \GrahamCampbell\Throttle\Data
33
     */
34 84
    public function transform($data, int $limit = 10, int $time = 60)
35
    {
36 84
        return new Data((string) $data->getClientIp(), (string) $data->path(), (int) $limit, (int) $time);
37
    }
38
}
39