Completed
Push — master ( f4a000...5b66b0 )
by Mario
10:06
created

ExceptionThrower   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

1 Method

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