GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 6454e0...6d2daa )
by soheil
02:55
created

StatusValidate::getExceptionMessage()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 49
Code Lines 43

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 43
c 1
b 0
f 0
nc 5
nop 3
dl 0
loc 49
rs 8.9208
1
<?php
2
3
namespace Soheilrt\AdobeConnectClient\Client\Helpers;
4
5
use DomainException;
6
use Soheilrt\AdobeConnectClient\Client\Exceptions\InvalidException;
7
use Soheilrt\AdobeConnectClient\Client\Exceptions\NoAccessException;
8
use Soheilrt\AdobeConnectClient\Client\Exceptions\NoDataException;
9
use Soheilrt\AdobeConnectClient\Client\Exceptions\TooMuchDataException;
10
11
/**
12
 * Validate the status code.
13
 */
14
abstract class StatusValidate
15
{
16
    /**
17
     * Validate the status code and throw an exception if something is wrong.
18
     *
19
     * @param array $status
20
     *
21
     * @throws InvalidException
22
     * @throws NoAccessException
23
     * @throws NoDataException
24
     * @throws TooMuchDataException
25
     * @throws DomainException
26
     */
27
    public static function validate(array $status)
28
    {
29
        switch ($status['code']) {
30
            case 'ok':
31
                return;
32
33
            case 'invalid':
34
                $invalid = $status['invalid'];
35
36
                throw new InvalidException(
37
                    "{$invalid['field']} {$invalid['subcode']}"
38
                );
39
40
            case 'no-access':
41
                throw new NoAccessException($status['subcode']);
42
            case 'no-data':
43
                throw new NoDataException();
44
            case 'too-much-data':
45
                throw new TooMuchDataException();
46
        }
47
48
        throw new DomainException('Status Code is Invalid');
49
    }
50
}
51