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

ProfilingJsonResponse::createFromPrevious()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 4
cts 4
cp 1
crap 1
rs 10
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
}