Completed
Push — master ( 450f6c...ad56b7 )
by Stefan
05:07
created

InvalidArgument   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A payloadMustBeArray() 0 6 1
A payloadAndBodyFormatNotCompatible() 0 6 1
1
<?php
2
3
namespace Gemz\HttpClient\Exceptions;
4
5
use InvalidArgumentException;
6
7
final class InvalidArgument extends InvalidArgumentException
8
{
9
    /**
10
     * @return InvalidArgument
11
     */
12
    public static function payloadMustBeArray(): InvalidArgument
13
    {
14
        return new static(
15
            "Payload must be an array when content-type is application/json, " .
16
            "multipart/form-data or application/x-www-form-urlencoded");
17
    }
18
19
    /**
20
     * @param string $bodyFormat
21
     *
22
     * @return InvalidArgument
23
     */
24
    public static function payloadAndBodyFormatNotCompatible(string $bodyFormat): self
0 ignored issues
show
Unused Code introduced by
The parameter $bodyFormat 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...
25
    {
26
        return new static(
27
            "The body format and the payload are not compatiblePayload must be an array when content-type is application/json, " .
28
            "multipart/form-data or application/x-www-form-urlencoded");
29
    }
30
}
31