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