| Conditions | 9 |
| Paths | 256 |
| Total Lines | 38 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 9.7555 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | 1 | public function toJson() |
|
| 36 | { |
||
| 37 | 1 | $json = []; |
|
| 38 | |||
| 39 | 1 | if (! empty($this->registrationIds)) { |
|
| 40 | 1 | $json['registration_ids'] = $this->registrationIds; |
|
| 41 | } |
||
| 42 | |||
| 43 | 1 | if ($this->collapseKey) { |
|
| 44 | 1 | $json['collapse_key'] = $this->collapseKey; |
|
| 45 | } |
||
| 46 | |||
| 47 | 1 | if (! empty($this->data)) { |
|
| 48 | 1 | $json['data'] = $this->data; |
|
| 49 | } |
||
| 50 | |||
| 51 | 1 | if (! empty($this->notification)) { |
|
| 52 | 1 | $json['notification'] = $this->notification; |
|
| 53 | } |
||
| 54 | |||
| 55 | 1 | if ($this->delayWhileIdle) { |
|
| 56 | $json['delay_while_idle'] = $this->delayWhileIdle; |
||
| 57 | } |
||
| 58 | |||
| 59 | 1 | if ($this->timeToLive != 2419200) { |
|
| 60 | $json['time_to_live'] = $this->timeToLive; |
||
| 61 | } |
||
| 62 | |||
| 63 | 1 | if ($this->restrictedPackageName) { |
|
| 64 | $json['restricted_package_name'] = $this->restrictedPackageName; |
||
| 65 | } |
||
| 66 | |||
| 67 | 1 | if ($this->dryRun) { |
|
| 68 | $json['dry_run'] = $this->dryRun; |
||
| 69 | } |
||
| 70 | |||
| 71 | 1 | return Json::encode($json); |
|
| 72 | } |
||
| 73 | } |
||
| 74 |