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

JsonContentHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isApplicableMimeType() 0 4 1
A __construct() 0 4 1
A throwException() 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 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