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

ExceptionThrower::throwException()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
rs 8.8571
c 1
b 0
f 0
cc 5
eloc 10
nc 5
nop 2
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