-
Notifications
You must be signed in to change notification settings - Fork 238
Expand file tree
/
Copy pathCustomerDataTrait.php
More file actions
50 lines (46 loc) · 1.13 KB
/
CustomerDataTrait.php
File metadata and controls
50 lines (46 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
declare(strict_types=1);
namespace WP_Rocket\Engine\License\API;
trait CustomerDataTrait {
/**
* Get the customer data
*
* @since 3.20.3
*
* @return array
*/
public function get_customer_data(): array {
return [
'key' => sanitize_key( $this->get_customer_key() ),
'email' => $this->get_customer_email(),
];
}
/**
* Get the customer key.
*
* Retrieves the customer key from options or constant as fallback.
*
* @since 3.20.3
*
* @return string Customer key.
*/
protected function get_customer_key(): string {
return ! empty( $this->options->get( 'consumer_key', '' ) )
? (string) $this->options->get( 'consumer_key', '' )
: (string) rocket_get_constant( 'WP_ROCKET_KEY', '' );
}
/**
* Get the customer email.
*
* Retrieves the customer email from options or constant as fallback.
*
* @since 3.20.3
*
* @return string Customer email.
*/
protected function get_customer_email(): string {
return ! empty( $this->options->get( 'consumer_email', '' ) )
? (string) $this->options->get( 'consumer_email', '' )
: (string) rocket_get_constant( 'WP_ROCKET_EMAIL', '' );
}
}