Passed
Push — master ( c4e8d5...9061ac )
by Eric
02:13
created

StatusCodeCategories::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Utility - Collection of various PHP utility functions.
7
 *
8
 * @author    Eric Sizemore <[email protected]>
9
 * @version   2.0.0
10
 * @copyright (C) 2017 - 2024 Eric Sizemore
11
 * @license   The MIT License (MIT)
12
 *
13
 * Copyright (C) 2017 - 2024 Eric Sizemore <https://www.secondversion.com>.
14
 *
15
 * Permission is hereby granted, free of charge, to any person obtaining a copy
16
 * of this software and associated documentation files (the "Software"), to
17
 * deal in the Software without restriction, including without limitation the
18
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
19
 * sell copies of the Software, and to permit persons to whom the Software is
20
 * furnished to do so, subject to the following conditions:
21
 *
22
 * The above copyright notice and this permission notice shall be included in
23
 * all copies or substantial portions of the Software.
24
 *
25
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31
 * THE SOFTWARE.
32
 */
33
34
/**
35
 * Esi\Utility\Enums\Http is a fork of Crell/EnumTools (https://github.com/Crell/EnumTools)
36
 * which is also licensed under the MIT license.
37
 *      Crell/EnumTools Copyright 2021 Larry Garfield<[email protected]>
38
 *
39
 * For changes made in Esi\Utility\Enums\Http compared to the original Crell/EnumTools, see CHANGELOG.md#2.0.0
40
 */
41
42
namespace Esi\Utility\Enums\Http;
43
44
/**
45
 * Enum of the types/categories of HTTP Status Codes.
46
 *
47
 * @since 2.0.0
48
 */
49
enum StatusCodeCategories: string
50
{
51
    case Informational = 'Informational';
52
    case Success = 'Success';
53
    case Redirection = 'Redirection';
54
    case ClientError = 'Client Error';
55
    case ServerError = 'Server Error';
56
    case Unknown = 'Unknown';
57
58
    /**
59
     * Returns the value of a given case.
60
     *  eg: Methods::Redirection->getValue() // Redirection
61
     *
62
     * @return string Value
63
     */
64 1
    public function getValue(): string
65
    {
66 1
        return $this->value;
67
    }
68
69
    /**
70
     * Returns the name of a given case.
71
     *  eg: StatusCodeCategories::ServerError->getName() // ServerError
72
     *
73
     * @return string Case name
74
     */
75 1
    public function getName(): string
76
    {
77 1
        return $this->name;
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on Esi\Utility\Enums\Http\StatusCodeCategories. Did you maybe forget to declare it?
Loading history...
78
    }
79
}
80