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