InvalidHeaderValueException::invalidValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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