settings = $settings; } /** * Module id. * * @since 1.0.0 * * @return string */ public function id(): string { return 'import'; } /** * Module name. * * @since 1.0.0 * * @return string */ public function label(): string { return __( 'Importers', 'elevenrank' ); } /** * Registers the module's hooks. * * @since 1.0.0 * * @return void */ public function boot(): void { add_action( 'rest_api_init', array( $this, 'register_routes' ) ); if ( defined( 'WP_CLI' ) && WP_CLI ) { \WP_CLI::add_command( 'elevenrank import', new Import_Command( $this ) ); } } /** * The sources by id. * * @since 1.0.0 * * @return array */ public function sources(): array { $sources = array(); foreach ( array( new Yoast_Source(), new Rank_Math_Source(), new Aioseo_Source(), new Seopress_Source() ) as $source ) { $sources[ $source->id() ] = $source; } return $sources; } /** * The importer. * * @since 1.0.0 * * @return Importer */ public function importer(): Importer { return new Importer( $this->settings, new Meta_Fields( $this->settings ) ); } /** * Registers the REST routes. * * @since 1.0.0 * * @return void */ public function register_routes(): void { ( new Import_Controller( $this->sources(), $this->importer() ) )->register_routes(); } }