Completed
Push — master ( 6b6722...4f7843 )
by Restu
15:29
created

Response   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setContent() 0 9 2
1
<?php
2
namespace JayaCode\Framework\Core\Http;
3
4
use Symfony\Component\HttpFoundation\Response as BaseResponse;
5
6
class Response extends BaseResponse
7
{
8
    /**
9
     * if content is an array, then convert to json
10
     * @param mixed $content
11
     * @return BaseResponse
12
     */
13
    public function setContent($content)
14
    {
15
        if (is_array($content)) {
16
            $this->headers->set('Content-Type', 'application/json');
17
            $content = json_encode($content);
18
        }
19
20
        return parent::setContent($content);
21
    }
22
}
23