| 1 |
<?php |
| 2 |
|
| 3 |
namespace HelloPlus\Modules\Admin\Components; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; // Exit if accessed directly. |
| 7 |
} |
| 8 |
|
| 9 |
use HelloPlus\Modules\Admin\Classes\Ajax\Setup_Wizard; |
| 10 |
use HelloPlus\Modules\Admin\Classes\Rest\Onboarding_Settings; |
| 11 |
use HelloPlus\Modules\Admin\Classes\Rest\Whats_New; |
| 12 |
|
| 13 |
class Api_Controller { |
| 14 |
|
| 15 |
protected $endpoints = []; |
| 16 |
|
| 17 |
protected $ajax_classes = []; |
| 18 |
|
| 19 |
public function get_endpoint( string $endpoint ) { |
| 20 |
if ( ! isset( $this->endpoints[ $endpoint ] ) ) { |
| 21 |
throw new \Exception( esc_html__( 'Endpoint not found', 'hello-plus' ) ); |
| 22 |
} |
| 23 |
|
| 24 |
return $this->endpoints[ $endpoint ]; |
| 25 |
} |
| 26 |
|
| 27 |
public function __construct() { |
| 28 |
$this->endpoints['onboarding-settings'] = new Onboarding_Settings(); |
| 29 |
$this->endpoints['whats-new'] = new Whats_New(); |
| 30 |
|
| 31 |
$this->ajax_classes['setup-wizard'] = new Setup_Wizard(); |
| 32 |
} |
| 33 |
} |
| 34 |
|