Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| Unconfigured_Subscription_Service | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| available | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| initialize | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| visitor_can_view_content | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| is_current_user_pending_subscriber | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| access_url | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 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 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit( 0 ); |
| 15 | } |
| 16 | |
| 17 | // phpcs:disable |
| 18 | |
| 19 | /** |
| 20 | * Class Unconfigured_Subscription_Service |
| 21 | * |
| 22 | * @package Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service |
| 23 | */ |
| 24 | class Unconfigured_Subscription_Service implements Subscription_Service { |
| 25 | |
| 26 | /** |
| 27 | * Is always available because it is the fallback. |
| 28 | * |
| 29 | * @inheritDoc |
| 30 | */ |
| 31 | public static function available() { |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Function: initialize() |
| 37 | * |
| 38 | * @inheritDoc |
| 39 | */ |
| 40 | public function initialize() { |
| 41 | // noop. |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * No subscription service available, no users can see this content. |
| 46 | * |
| 47 | * @param array $valid_plan_ids . |
| 48 | * @param string $access_level . |
| 49 | */ |
| 50 | public function visitor_can_view_content( $valid_plan_ids, $access_level ) { |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * is the current user a pending subscriber for the current site? |
| 56 | * |
| 57 | * @return bool |
| 58 | */ |
| 59 | public function is_current_user_pending_subscriber(): bool |
| 60 | { |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * The current visitor would like to obtain access. Where do they go? |
| 66 | * |
| 67 | * @param string $mode . |
| 68 | */ |
| 69 | public function access_url( $mode = 'subscribe' ) { |
| 70 | return site_url(); |
| 71 | } |
| 72 | |
| 73 | } |
| 74 | // phpcs:enable |