Conditions | 5 |
Paths | 16 |
Total Lines | 37 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 23 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
29 | 1 | public function toArray(): array |
|
30 | { |
||
31 | 1 | $request = []; |
|
32 | |||
33 | 1 | if ($this->description) { |
|
34 | 1 | $request[] = [ |
|
35 | 1 | 'op' => 'replace', |
|
36 | 1 | 'path' => '/description', |
|
37 | 1 | 'value' => $this->description |
|
38 | ]; |
||
39 | } |
||
40 | |||
41 | 1 | if ($this->category) { |
|
42 | 1 | $request[] = [ |
|
43 | 1 | 'op' => 'replace', |
|
44 | 1 | 'path' => '/category', |
|
45 | 1 | 'value' => $this->category |
|
46 | ]; |
||
47 | } |
||
48 | |||
49 | 1 | if ($this->imageUrl) { |
|
50 | 1 | $request[] = [ |
|
51 | 1 | 'op' => 'replace', |
|
52 | 1 | 'path' => '/image_url', |
|
53 | 1 | 'value' => $this->imageUrl |
|
54 | ]; |
||
55 | } |
||
56 | |||
57 | 1 | if ($this->homeUrl) { |
|
58 | 1 | $request[] = [ |
|
59 | 1 | 'op' => 'replace', |
|
60 | 1 | 'path' => '/home_url', |
|
61 | 1 | 'value' => $this->homeUrl |
|
62 | ]; |
||
63 | } |
||
64 | |||
65 | 1 | return $request; |
|
66 | } |
||
68 |