Completed
Push — add/product-ratings-to-search ( 91683c...b05261 )
by
unknown
344:08 queued 334:42
created

WPCOM_Token_Subscription_Service::available()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * A paywall that exchanges JWT tokens from WordPress.com to allow
4
 * a current visitor to view content that has been deemed "Premium content".
5
 *
6
 * @package Automattic\Jetpack\Extensions\Premium_Content
7
 */
8
9
namespace Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service;
10
11
/**
12
 * Class WPCOM_Token_Subscription_Service
13
 *
14
 * @package Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service
15
 */
16
class WPCOM_Token_Subscription_Service extends Token_Subscription_Service {
17
18
	/**
19
	 * Is available()
20
	 *
21
	 * @inheritDoc
22
	 */
23
	public static function available() {
24
	 // phpcs:ignore ImportDetection.Imports.RequireImports.Symbol
25
		return defined( 'IS_WPCOM' ) && IS_WPCOM === true;
26
	}
27
28
	/**
29
	 * Is get_site_id()
30
	 *
31
	 * @inheritDoc
32
	 */
33
	public function get_site_id() {
34
		return get_current_blog_id();
35
	}
36
37
	/**
38
	 * Is get_key()
39
	 *
40
	 * @inheritDoc
41
	 */
42
	public function get_key() {
43
	 // phpcs:ignore ImportDetection.Imports.RequireImports.Symbol
44
		return defined( 'EARN_JWT_SIGNING_KEY' ) ? EARN_JWT_SIGNING_KEY : false;
45
	}
46
}
47