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

Unconfigured_Subscription_Service   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A available() 0 3 1
A initialize() 0 3 1
A visitor_can_view_content() 0 3 1
A access_url() 0 3 1
1
<?php
2
/**
3
 * The environment does not have a subscription service available.
4
 * This represents this scenario.
5
 *
6
 * @package Automattic\Jetpack\Extensions\Premium_Content
7
 */
8
9
namespace Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service;
10
11
use function site_url;
12
// phpcs:disable
13
14
/**
15
 * Class Unconfigured_Subscription_Service
16
 *
17
 * @package Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service
18
 */
19
class Unconfigured_Subscription_Service implements Subscription_Service {
20
21
	/**
22
	 * Is always available because it is the fallback.
23
	 *
24
	 * @inheritDoc
25
	 */
26
	public static function available() {
27
		return true;
28
	}
29
30
	/**
31
	 * Function: initialize()
32
	 *
33
	 * @inheritDoc
34
	 */
35
	public function initialize() {
36
		// noop.
37
	}
38
39
	/**
40
	 * No subscription service available, no users can see this content.
41
	 *
42
	 * @param array $valid_plan_ids .
43
	 */
44
	public function visitor_can_view_content( $valid_plan_ids ) {
45
		return false;
46
	}
47
48
	/**
49
	 * The current visitor would like to obtain access. Where do they go?
50
	 *
51
	 * @param string $mode .
52
	 */
53
	public function access_url( $mode = 'subscribe' ) {
54
		return site_url();
55
	}
56
57
}
58
// phpcs:enable
59