Completed
Push — master ( f70cfa...e600bd )
by Korotkov
05:02 queued 03:38
created

ContainerResponseTrait::jsonResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/**
6
 * @author    : Korotkov Danila <[email protected]>
7
 * @copyright Copyright (c) 2017, Korotkov Danila
8
 * @license   http://www.gnu.org/licenses/gpl.html GNU GPLv3.0
9
 */
10
11
namespace Rudra;
12
13
/**
14
 * Class ContainerResponseTrait
15
 *
16
 * @package Rudra
17
 */
18
trait ContainerResponseTrait
19
{
20
21
    /**
22
     * @param array $data
23
     *
24
     * @return string
25
     */
26
    public function jsonResponse(array $data): string
27
    {
28
        header('Content-Type: application/json');
29
30
        return json_encode($data);
31
    }
32
}
33