Completed
Push — master ( 398989...6954b4 )
by Tobias
29:12 queued 04:09
created

HistoryTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 6
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A addFailure() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright (C) 2013 Mailgun
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license. See the LICENSE file for details.
10
 */
11
12
namespace Mailgun\HttpClient\Plugin;
13
14
use Http\Client\Exception;
15
use Psr\Http\Client\ClientExceptionInterface;
16
use Psr\Http\Message\RequestInterface;
17
18
/*
19
 * Below is a some code to make the History plugin compatible with both 1.x and 2.x of php-client/client-common
20
 */
21
if (\class_exists(\Http\Client\Common\HttpMethodsClientInterface::class)) {
22
    /**
23
     * @internal code for php-http/client-common:2.x
24
     */
25
    trait HistoryTrait
26
    {
27
        public function addFailure(RequestInterface $request, ClientExceptionInterface $exception)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $exception is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
        {
29
        }
30
    }
31
} else {
32
    /**
33
     * @internal code for php-http/client-common:1.x
34
     */
35
    trait HistoryTrait
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type Mailgun\HttpClient\Plugin\HistoryTrait has been defined more than once; this definition is ignored, only the first definition in this file (L25-30) is considered.

This check looks for classes that have been defined more than once in the same file.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
36
    {
37
        public function addFailure(RequestInterface $request, Exception $exception)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $exception is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
        {
39
        }
40
    }
41
}
42