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

Exporter   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 38
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C export() 0 32 8
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