ApiVersionPlugin::handleRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace SafeCrow\Plugin;
4
5
use Http\Client\Common\Plugin;
6
use Http\Promise\Promise;
7
use Psr\Http\Message\RequestInterface;
8
9
/**
10
 * Class ApiVersionPlugin
11
 * @package SafeCrow\Plugin
12
 */
13
class ApiVersionPlugin implements Plugin
14
{
15
    /**
16
     * @param RequestInterface $request
17
     * @param callable         $next
18
     * @param callable         $first
19
     * @return Promise
20
     */
21
    public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
22
    {
23
        return $next($request->withUri($request->getUri()->withPath('/api/v3'.$request->getUri()->getPath())));
24
    }
25
}
26