ExceptionThrower   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 4
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A throwException() 0 13 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Marek\OpenWeatherMap\API\Exception;
6
7
class ExceptionThrower
8
{
9
    public static function throwException($statusCode, $message)
10
    {
11
        switch ($statusCode) {
12
            case APIException::FORBIDDEN:
13
                throw new ForbiddenException($message, APIException::FORBIDDEN);
14
            case APIException::UNAUTHORIZED:
15
                throw new UnauthorizedException($message, APIException::UNAUTHORIZED);
16
            case APIException::NOT_FOUND:
17
                throw new NotFoundException($message, APIException::NOT_FOUND);
18
            case APIException::BAD_REQUEST:
19
                throw new BadRequestException($message, APIException::BAD_REQUEST);
20
        }
21
    }
22
}
23