Completed
Push — master ( 7d4b49...c115fe )
by Andreas
26:15 queued 26:15
created

midcom_response_json::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @package midcom
4
 * @author CONTENT CONTROL http://www.contentcontrol-berlin.de/
5
 * @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/
6
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
7
 */
8
9
/**
10
 * Wrapper for HTTP responses
11
 *
12
 * @deprecated use Symfony\Component\HttpFoundation\JsonResponse instead
13
 * @package midcom
14
 */
15
class midcom_response_json extends midcom_response
16
{
17
    public function __construct(array $data = [])
18
    {
19
        parent::__construct();
20
        $this->_data = $data;
21
        $this->headers->set('Content-Type', 'application/json; charset=' . $this->encoding);
22
    }
23
24
    /**
25
     * Sends the response to the client and shuts down the environment
26
     */
27
    public function sendContent()
28
    {
29
        $exporter = new midcom_helper_exporter_json();
30
        echo $exporter->array2data($this->_data);
31
    }
32
}
33