Completed
Pull Request — 6.x (#123)
by
unknown
06:55
created

ServerRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 6
c 4
b 0
f 0
dl 0
loc 16
ccs 5
cts 6
cp 0.8333
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createRequest() 0 10 2
1
<?php
2
3
namespace SMartins\PassportMultiauth\Facades;
4
5
use Nyholm\Psr7\Factory\Psr17Factory;
6
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
7
use Symfony\Component\HttpFoundation\Request;
8
9
class ServerRequest
10
{
11
    /**
12
     * @param Request $symfonyRequest
13
     * @return \Psr\Http\Message\RequestInterface|\Psr\Http\Message\ServerRequestInterface
14
     */
15 14
    public static function createRequest(Request $symfonyRequest)
16
    {
17 14
        if (class_exists(PsrHttpFactory::class)) {
18 14
            $psr17Factory = new Psr17Factory;
19
20 14
            return (new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory))
21 14
                ->createRequest($symfonyRequest);
22
        }
23
24
        throw new Exception('Unable to resolve PSR request. Please install symfony/psr-http-message-bridge and nyholm/psr7.');
0 ignored issues
show
Bug introduced by
The type SMartins\PassportMultiauth\Facades\Exception was not found. Did you mean Exception? If so, make sure to prefix the type with \.
Loading history...
25
    }
26
}
27