| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | function __construct() { |
||
|
|
|||
| 18 | |||
| 19 | $this->endpoint = '/jsonld'; |
||
| 20 | |||
| 21 | // PHP 5.3 compatibility as `$this` cannot be used in closures. |
||
| 22 | $that = $this; |
||
| 23 | |||
| 24 | add_action( 'rest_api_init', function () use ( $that ) { |
||
| 25 | register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, $that->endpoint, array( |
||
| 26 | 'methods' => 'GET', |
||
| 27 | 'callback' => array( $that, 'context_data' ), |
||
| 28 | ) ); |
||
| 29 | } ); |
||
| 30 | |||
| 31 | } |
||
| 32 | |||
| 53 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.