Completed
Push — master ( 5c76e6...b6ee5b )
by Oscar
03:07
created

Exporter::export()   C

Complexity

Conditions 8
Paths 8

Size

Total Lines 32
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 32
rs 5.3846
cc 8
eloc 16
nc 8
nop 1
1
<?php
2
3
namespace Psr7Unitesting\Utils;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Psr\Http\Message\RequestInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
use Psr\Http\Message\UriInterface;
9
use Psr\Http\Message\StreamInterface;
10
use Symfony\Component\DomCrawler\Crawler;
11
12
class Exporter
13
{
14
    /**
15
     * @param string $expected
0 ignored issues
show
Bug introduced by
There is no parameter named $expected. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
16
     */
17
    public function export($value)
18
    {
19
        if ($value instanceof ServerRequestInterface) {
20
            return 'ServerRequest instance';
21
        }
22
23
        if ($value instanceof RequestInterface) {
24
            return 'Request instance';
25
        }
26
27
        if ($value instanceof ResponseInterface) {
28
            return 'Response instance';
29
        }
30
31
        if ($value instanceof StreamInterface) {
32
            return 'Stream instance';
33
        }
34
35
        if ($value instanceof UriInterface) {
36
            return 'Uri instance';
37
        }
38
39
        if ($value instanceof Crawler) {
40
            return 'Html content';
41
        }
42
43
        if (is_object($value)) {
44
            return get_class($value);
45
        }
46
47
        return gettype($value);
48
    }
49
}
50