container = $container; $this->controllers = $controllers; } /** * {@inheritdoc} */ public function register(): void { add_action( 'rest_api_init', array( $this, 'register_routes' ) ); } /** * Registers the routes of all controllers. * * @since 0.1.0 * * @return void */ public function register_routes(): void { foreach ( $this->controllers as $id ) { $this->container->get( $id )->register_routes(); } } }