Completed
Push — master ( a8c051...1e2ea2 )
by Delete
02:24
created

InvalidArgumentException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 12 1
1
<?php
2
namespace Crossjoin\Json\Exception;
3
4
/**
5
 * Class InvalidArgumentException
6
 *
7
 * @package Crossjoin\Json\Exception
8
 * @author Christoph Ziegenberg <[email protected]>
9
 */
10
class InvalidArgumentException extends \InvalidArgumentException implements JsonException
11
{
12
    /** @noinspection MoreThanThreeArgumentsInspection */
13
    /**
14
     * @param string $expectedType
15
     * @param string $argumentName
16
     * @param mixed $currentValue
17
     * @param int $code
18
     *
19
     * @return InvalidArgumentException
20
     */
21
    public static function getInstance($expectedType, $argumentName, $currentValue, $code = 0)
22
    {
23
        return new self(
24
            sprintf(
25
                "%s expected for argument '%s'. Got '%s'.",
26
                ucfirst(strtolower($expectedType)),
27
                $argumentName,
28
                gettype($currentValue)
29
            ),
30
            $code
31
        );
32
    }
33
}
34