Passed
Pull Request — 6.x (#123)
by
unknown
28:24
created

ServerRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 62.5%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 8
c 3
b 0
f 0
dl 0
loc 21
ccs 5
cts 8
cp 0.625
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A createRequest() 0 14 3
1
<?php
2
3
namespace SMartins\PassportMultiauth\Facades;
4
5
use Nyholm\Psr7\Factory\Psr17Factory;
6
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
0 ignored issues
show
Bug introduced by
The type Symfony\Bridge\PsrHttpMe...actory\DiactorosFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
8
use Symfony\Component\HttpFoundation\Request;
9
10
class ServerRequest
11
{
12
    /**
13
     * @todo Switch deprecated DiactorosFactory by PsrHttpFactory
14
     * @param Request $symfonyRequest
15
     * @return \Psr\Http\Message\RequestInterface|\Psr\Http\Message\ServerRequestInterface|\Zend\Diactoros\ServerRequest
0 ignored issues
show
Bug introduced by
The type Zend\Diactoros\ServerRequest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
     */
17 14
    public static function createRequest(Request $symfonyRequest)
18
    {
19 14
        if (class_exists(PsrHttpFactory::class)) {
20 14
            $psr17Factory = new Psr17Factory;
21
22 14
            return (new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory))
23 14
                ->createRequest($symfonyRequest);
24
        }
25
26
        if (class_exists(DiactorosFactory::class)) {
27
            return (new DiactorosFactory)->createRequest($symfonyRequest);
28
        }
29
30
        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...
31
    }
32
}
33