Completed
Pull Request — master (#22)
by Adam
02:38
created

JsonContentHandler::throwException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Equip\Handler;
4
5
use Equip\Exception\HttpException;
6
use Relay\Middleware\JsonContentHandler as AbstractHandler;
7
8
/**
9
 * @deprecated 1.4.0 Switched to Relay.Middleware
10
 */
11 3
class JsonContentHandler extends AbstractHandler
12
{
13 3
    /**
14
     * @inheritDoc
15
     */
16
    public function __construct($assoc = true, $maxDepth = 512, $options = 0)
17
    {
18
        return parent::__construct($assoc, $maxDepth, $options);
19 2
    }
20
21 2
    /**
22
     * @inheritDoc
23 2
     */
24 1
    protected function isApplicableMimeType($mime)
25 1
    {
26
        return preg_match('~^application/([a-z.]+\+)?json($|;)~', $mime);
27
    }
28 1
29
    /**
30
     * @inheritDoc
31
     */
32
    protected function throwException($message)
33
    {
34
        throw HttpException::badRequest($message);
35
    }
36
}
37