InvalidHeaderValueException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidHeaderName() 0 4 1
A invalidValue() 0 4 1
1
<?php
2
/*
3
 * This file is part of the Borobudur-Http package.
4
 *
5
 * (c) Hexacodelabs <http://hexacodelabs.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Borobudur\Http\Header\Exception;
12
13
use Borobudur\Http\Exception\InvalidArgumentException;
14
15
/**
16
 * @author      Iqbal Maulana <[email protected]>
17
 * @created     7/19/15
18
 */
19
class InvalidHeaderValueException extends InvalidArgumentException
20
{
21
    /**
22
     * Exception that header given with invalid name.
23
     *
24
     * @param string $fieldName
25
     * @param string $givenFieldName
26
     *
27
     * @return InvalidHeaderValueException
28
     */
29
    public static function invalidHeaderName($fieldName, $givenFieldName)
30
    {
31
        return new self(sprintf('Given header "%s" is not match with "%s".', $givenFieldName, $fieldName));
32
    }
33
34
    /**
35
     * Exception for invalid header value.
36
     *
37
     * @param string $value
38
     *
39
     * @return InvalidHeaderValueException
40
     */
41
    public static function invalidValue($value)
42
    {
43
        return new self(sprintf('Value "%s" is not valid for header value.', $value));
44
    }
45
}
46