Completed
Push — master ( 527bb5...aca9c3 )
by César
05:15
created

XmlResponse   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 25
loc 25
c 0
b 0
f 0
wmc 1
lcom 1
cbo 4
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 10 10 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Preetender\Routing\Response;
4
5
/**
6
 * Class XmlResponse
7
 * @package Preetender\Routing\Response
8
 */
9 View Code Duplication
class XmlResponse extends BaseResponse
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    /**
12
     * Inform headers for xml requests
13
     *
14
     * @var array
15
     */
16
    protected $headers = [];
17
18
    /**
19
     * Format and return to requester
20
     *
21
     * @return mixed
22
     */
23
    public function render()
24
    {
25
26
        $data_format = $this->wrapped->render();
27
28
        $this->response->setContent($data_format);
29
        $this->response->headers->add($this->headers);
30
        $this->response->prepare($this->request);
31
        $this->response->send();
32
    }
33
}