Completed
Pull Request — master (#4)
by Michael
03:28
created

DelegateToCallableAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 27
ccs 0
cts 8
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
1
<?php
2
namespace Equip\Dispatch;
3
4
use Interop\Http\Middleware\DelegateInterface;
5
use Psr\Http\Message\RequestInterface;
6
use Psr\Http\Message\ResponseInterface;
7
8
class DelegateToCallableAdapter implements DelegateInterface
0 ignored issues
show
Bug introduced by
There is one abstract method process in this class; you could implement it, or declare this class as abstract.
Loading history...
9
{
10
    /**
11
     * @var DelegateInterface
12
     */
13
    private $adaptee;
14
15
    /**
16
     * @param DelegateInterface $adaptee
17
     */
18
    public function __construct(DelegateInterface $adaptee)
19
    {
20
        $this->adaptee = $adaptee;
21
    }
22
23
    /**
24
     * Process the request using a delegate.
25
     *
26
     * @param RequestInterface $request
27
     *
28
     * @return ResponseInterface
29
     */
30
    public function __invoke(RequestInterface $request)
31
    {
32
        return $adaptee->process($request);
0 ignored issues
show
Bug introduced by
The variable $adaptee does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
33
    }
34
}
35