content_types_repository = $content_types_repository; $this->indexable_helper = $indexable_helper; $this->user_helper = $user_helper; $this->enabled_analysis_features_repository = $enabled_analysis_features_repository; $this->endpoints_repository = $endpoints_repository; $this->nonce_repository = $nonce_repository; $this->site_kit_integration_data = $site_kit_integration_data; $this->setup_steps_tracking = $setup_steps_tracking; $this->browser_cache_configuration = $browser_cache_configuration; } /** * Returns a configuration * * @return array|array>>> */ public function get_configuration(): array { $configuration = [ 'contentTypes' => $this->content_types_repository->get_content_types(), 'indexablesEnabled' => $this->indexable_helper->should_index_indexables(), 'displayName' => $this->user_helper->get_current_user_display_name(), 'enabledAnalysisFeatures' => $this->enabled_analysis_features_repository->get_features_by_keys( [ Readability_Analysis::NAME, Keyphrase_Analysis::NAME, ] )->to_array(), 'endpoints' => $this->endpoints_repository->get_all_endpoints()->to_array(), 'nonce' => $this->nonce_repository->get_rest_nonce(), 'setupStepsTracking' => $this->setup_steps_tracking->to_array(), ]; $site_kit_integration_data = $this->site_kit_integration_data->to_array(); if ( ! empty( $site_kit_integration_data ) ) { $configuration ['siteKitConfiguration'] = $site_kit_integration_data; } $browser_cache_configuration = $this->browser_cache_configuration->get_configuration(); if ( ! empty( $browser_cache_configuration ) ) { $configuration ['browserCache'] = $browser_cache_configuration; } return $configuration; } }