Completed
Push — master ( bf8f23...c9e25b )
by Tomas
04:17
created

TextApiResponse::getCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Tomaj\NetteApi\Response;
4
5
use Nette\Application\Responses\TextResponse;
6
7
class TextApiResponse extends TextResponse
8
{
9
    /**
10
     * @var integer
11
     */
12
    private $code;
13
14
    /**
15
     * Create TextApiResponse
16
     * This class only wrap JsonResponse from Nette and add possibility
17
     * to setup response code and automaticaly set content type
18
     *
19
     * @param integer $code
20
     * @param mixed $data
21
     */
22
    public function __construct($code, $data)
23
    {
24
        parent::__construct($data);
25
        $this->code = $code;
26
    }
27
28
    /**
29
     * Return api response http code
30
     *
31
     * @return integer
32
     */
33
    public function getCode()
34
    {
35
        return $this->code;
36
    }
37
}
38