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

JsonContentHandler::getParsedBody()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
cc 2
eloc 6
nc 2
nop 1
crap 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A JsonContentHandler::isApplicableMimeType() 0 4 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