ResponseCodes   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMessage() 0 4 1
1
<?php
2
3
namespace Thepixeldeveloper\Mondo\Http;
4
5
/**
6
 * Class ResponseCodes
7
 *
8
 * @package Thepixeldeveloper\Mondo\Http
9
 */
10
class ResponseCodes
11
{
12
    /**
13
     * Http status code to message map.
14
     *
15
     * @var array
16
     */
17
    protected $messages = [
18
        200 => 'All is well.',
19
        400 => 'Your request has missing arguments or is malformed.',
20
        401 => 'Your request is not authenticated.',
21
        403 => 'Your request is authenticated but has insufficient permissions.',
22
        405 => 'You are using an incorrect HTTP verb. Double check whether it should be POST/GET/DELETE/etc.',
23
        404 => 'The endpoint requested does not exist.',
24
        406 => 'Your application does not accept the content format returned according to the Accept headers sent in the request.',
25
        429 => 'Your application is exceeding its rate limit. Back off, buddy. :p',
26
        500 => 'Something is wrong on our end. Whoopsie.',
27
        504 => 'Something has timed out on our end. Whoopsie.',
28
    ];
29
30
    /**
31
     * Message for a given response code.
32
     *
33
     * @param integer $responseCode HTTP response code.
34
     *
35
     * @return string
36
     */
37
    public function getMessage($responseCode)
38
    {
39
        return $this->messages[$responseCode];
40
    }
41
}
42