Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
50.00% |
3 / 6 |
|
50.00% |
3 / 6 |
CRAP | |
0.00% |
0 / 1 |
| License_Response | |
50.00% |
3 / 6 |
|
50.00% |
3 / 6 |
10.50 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| get_status | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| get_slug | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| get_expires | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| get_license | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| get_domain | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | // { |
| 4 | // "status": "active", |
| 5 | // "slug": "a-plugin", |
| 6 | // "expires": "2025-05-27 00:00:00", |
| 7 | // "license": { |
| 8 | // "valid_slug": true, |
| 9 | // "exists": true, |
| 10 | // "deleted": false, |
| 11 | // "current_version": null, |
| 12 | // "error_message": null, |
| 13 | // "order": { |
| 14 | // "refunds": null, |
| 15 | // "customer_id": null |
| 16 | // } |
| 17 | // }, |
| 18 | // "domain": { |
| 19 | // "domain": "", |
| 20 | // "slug": "a-plugin", |
| 21 | // "status": "active", |
| 22 | // "date_time": 1716840810, |
| 23 | // "version": null, |
| 24 | // "environment": "staging" |
| 25 | // } |
| 26 | // } |
| 27 | |
| 28 | namespace BrianHenryIE\WP_Plugin_Updater\Integrations\SLSWC\Model; |
| 29 | |
| 30 | use DateTimeImmutable; |
| 31 | |
| 32 | class License_Response { |
| 33 | |
| 34 | public function __construct( |
| 35 | protected string $status, |
| 36 | protected string $slug, |
| 37 | protected string $expires, |
| 38 | protected License $license, |
| 39 | protected Domain $domain |
| 40 | ) { |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * active|deactivated |
| 45 | */ |
| 46 | public function get_status(): string { |
| 47 | return $this->status; |
| 48 | } |
| 49 | |
| 50 | public function get_slug(): string { |
| 51 | return $this->slug; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * 2025-05-27 00:00:00 |
| 56 | */ |
| 57 | public function get_expires(): \DateTimeInterface { |
| 58 | return DateTimeImmutable::createFromFormat( 'Y-m-d H:i:s', $this->expires ); |
| 59 | } |
| 60 | |
| 61 | public function get_license(): License { |
| 62 | return $this->license; |
| 63 | } |
| 64 | |
| 65 | public function get_domain(): Domain { |
| 66 | return $this->domain; |
| 67 | } |
| 68 | } |