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