@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | namespace WooCommerce\RestApi; |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) { |
|
| 12 | +if (file_exists(__DIR__ . '/../vendor/autoload.php')) { |
|
| 13 | 13 | require __DIR__ . '/../vendor/autoload.php'; |
| 14 | 14 | } else { |
| 15 | - wp_die( 'WooCommerce Rest API build required' ); |
|
| 15 | + wp_die('WooCommerce Rest API build required'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | use WooCommerce\RestApi\Utilities\SingletonTrait; |
@@ -34,17 +34,17 @@ discard block |
||
| 34 | 34 | * Hook into WordPress ready to init the REST API as needed. |
| 35 | 35 | */ |
| 36 | 36 | public function init() { |
| 37 | - add_action( 'rest_api_init', array( $this, 'register_rest_routes' ), 10 ); |
|
| 37 | + add_action('rest_api_init', array($this, 'register_rest_routes'), 10); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Register REST API routes. |
| 42 | 42 | */ |
| 43 | 43 | public function register_rest_routes() { |
| 44 | - foreach ( $this->get_rest_namespaces() as $namespace => $controllers ) { |
|
| 45 | - foreach ( $controllers as $controller_name => $controller_class ) { |
|
| 46 | - $this->controllers[ $namespace ][ $controller_name ] = new $controller_class(); |
|
| 47 | - $this->controllers[ $namespace ][ $controller_name ]->register_routes(); |
|
| 44 | + foreach ($this->get_rest_namespaces() as $namespace => $controllers) { |
|
| 45 | + foreach ($controllers as $controller_name => $controller_class) { |
|
| 46 | + $this->controllers[$namespace][$controller_name] = new $controller_class(); |
|
| 47 | + $this->controllers[$namespace][$controller_name]->register_routes(); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | } |