ApiVersionPlugin   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

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