PluginProbe
Flexible Subscriptions / trunk
Flexible Subscriptions vtrunk
1.8.4 1.8.3 1.8.2 1.8.1 1.8.0 1.7.19 1.7.18 1.7.17 1.7.16 1.7.15 1.7.14 1.7.13 1.7.12 1.7.11 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.3.0 All 61 releases
flexible-subscriptions / src / Compatibility / CompatibilityLoader.php

CompatibilityLoader.php in Flexible Subscriptions trunk, at src/Compatibility/CompatibilityLoader.php

34 lines 880 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WPDesk\FlexibleSubscriptions\Compatibility;
6
7 use WPDesk\FlexibleSubscriptions\Vendor\Psr\Container\ContainerInterface;
8 use WPDesk\FlexibleSubscriptions\Vendor\WPDesk\Init\Plugin\Plugin;
9
10 class CompatibilityLoader {
11
12 private Plugin $plugin;
13
14 private ContainerInterface $container;
15
16 public function __construct( Plugin $plugin, ContainerInterface $container ) {
17 $this->plugin = $plugin;
18 $this->container = $container;
19 }
20
21 public function load( string $plugin ): void {
22 if ( $plugin === 'woocommerce-subscriptions' ) {
23 $compat_path = $this->plugin->get_path( "/compat/$plugin/index.php" );
24 if ( file_exists( $compat_path ) ) {
25 $__fsb_compatibility_container = $this->container;
26 require_once $compat_path;
27 }
28 return;
29 }
30
31 throw new \RuntimeException( "Couldn't find compatibility layer for $plugin" );
32 }
33 }
34