Completed
Push — master ( b405b6...821ce4 )
by Woody
04:35
created

JsonContentHandler::throwException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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