| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace JFB_Components\Rest_Api; |
| 5 |
|
| 6 |
use Jet_Form_Builder\Classes\Arrayable\Arrayable; |
| 7 |
use JFB_Components\Rest_Api\Traits\Rest_Fetch_Endpoint; |
| 8 |
|
| 9 |
// If this file is called directly, abort. |
| 10 |
if ( ! defined( 'WPINC' ) ) { |
| 11 |
die; |
| 12 |
} |
| 13 |
|
| 14 |
class Rest_Endpoint implements Arrayable { |
| 15 |
|
| 16 |
private $url; |
| 17 |
private $method; |
| 18 |
|
| 19 |
public function __construct( Rest_Fetch_Endpoint $endpoint ) { |
| 20 |
$this->url = $endpoint->get_rest_url(); |
| 21 |
$this->method = $endpoint->get_rest_methods(); |
| 22 |
} |
| 23 |
|
| 24 |
public function to_array(): array { |
| 25 |
return array( |
| 26 |
'url' => $this->url, |
| 27 |
'method' => $this->method, |
| 28 |
); |
| 29 |
} |
| 30 |
|
| 31 |
} |
| 32 |
|