settings = new Settings(); $this->factory = new ClientFactory( $this->settings ); $this->catalog = new CertificateCatalog( $this->factory, $this->settings ); $this->mappings = new MappingRepository(); $this->queue = new Queue(); $this->worker = new Worker( $this->factory, $this->queue, new AttributeMapper() ); $this->issuance = new IssuanceService( $this->mappings, $this->queue ); $this->integrations = new Registry(); } /** * Prevent cloning of the singleton. * * @return void */ private function __clone() {} /** * Boot the plugin: register hooks and load translations. * * @return void */ public function boot(): void { if ( $this->booted ) { return; } $this->booted = true; add_action( Install::CRON_HOOK, array( $this->worker, 'run' ) ); ( new Admin( $this->settings, $this->factory, $this->catalog, $this->mappings, $this->queue, $this->integrations ) )->register(); ( new Wallet( $this->settings, $this->factory ) )->register(); ( new Shortcodes( $this->settings, $this->factory ) )->register(); $this->integrations->registerAll( array( $this->issuance, 'handle' ) ); if ( defined( 'WP_CLI' ) && WP_CLI ) { \WP_CLI::add_command( 'verifycate', new Cli\Commands( $this ) ); } } /** * Settings. * * @return Settings */ public function settings(): Settings { return $this->settings; } /** * API client factory. * * @return ClientFactory */ public function factory(): ClientFactory { return $this->factory; } /** * Certificate catalogue. * * @return CertificateCatalog */ public function catalog(): CertificateCatalog { return $this->catalog; } /** * Mapping repository. * * @return MappingRepository */ public function mappings(): MappingRepository { return $this->mappings; } /** * Issuance queue. * * @return Queue */ public function queue(): Queue { return $this->queue; } /** * Queue worker. * * @return Worker */ public function worker(): Worker { return $this->worker; } /** * Issuance routing. * * @return IssuanceService */ public function issuance(): IssuanceService { return $this->issuance; } /** * Integration registry. * * @return Registry */ public function integrations(): Registry { return $this->integrations; } }