Passed
Push — master ( e3c67b...98eade )
by Fran
08:10
created

ProfilingJsonResponse   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setProfile() 0 2 1
A createFromPrevious() 0 4 1
1
<?php
2
namespace PSFS\base\dto;
3
4
class ProfilingJsonResponse extends JsonResponse {
5
    public $profiling = [];
6
7 1
    public function setProfile(array $profiling) {
8 1
        $this->profiling = $profiling;
9 1
    }
10
11
    /**
12
     * @param JsonResponse $jsonResponse
13
     * @param array $data
14
     * @return array|ProfilingJsonResponse
15
     */
16 1
    public static function createFromPrevious(JsonResponse $jsonResponse, array $data) {
17 1
        $profiling = new ProfilingJsonResponse($jsonResponse->data, $jsonResponse->success, $jsonResponse->total, $jsonResponse->pages, $jsonResponse->message);
18 1
        $profiling->setProfile($data);
19 1
        return $profiling;
20
    }
21
}