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

WPCOM_Token_Subscription_Service   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A available() 0 4 2
A get_site_id() 0 3 1
A get_key() 0 4 2
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