resolve( Settings_Storage::class ) ); } public function plugin(): Plugin { return new Plugin( $this->resolve( Options_Storage::class ), $this->resolve( Settings_Storage::class ) ); } public function cache_flusher(): Cache_Flusher { return new Cache_Flusher( $this->resolve( Logger::class ), $this->cache_cleaners() ); } public function usage_report(): Usage_Report { return new Usage_Report( $this->resolve( Logger::class ), $this->resolve( Plugin::class ), $this->resolve( Plugin_Meta::class ), $this->resolve( Settings_Storage::class ), $this->resolve( State_Report::class ), $this->settings_storages() ); } public function plugin_translations(): Plugin_Translations { $plugin_meta = $this->resolve( Plugin_Meta::class ); $lang_relative_paths = array( 'acf-views' => 'lang' ); return new Plugin_Translations( $plugin_meta, $lang_relative_paths ); } public function plugin_environment(): Plugin_Environment { $storages = $this->settings_storages(); $file_systems = array_map( fn( $storage ) => $storage->get_file_system(), $storages ); return new Plugin_Environment( $this->resolve( Templates_Environment::class ), $this->resolve( State_Report::class ), $this->resolve( Usage_Report::class ), $this->resolve( Settings_Storage::class ), $this->resolve( Plugin_Meta::class ), $this->resolve( Post_Selections_Pre_Built_Tab::class ), $file_systems, $storages ); } /** * @return array{Layout_Settings_Storage,Selection_Settings_Storage} */ protected function settings_storages(): array { return array( $this->resolve( Layout_Settings_Storage::class ), $this->resolve( Selection_Settings_Storage::class ), ); } /** * @return array */ protected function cache_cleaners(): array { $cache_cleaners = array( // Redis - upgrades may have had direct DB changes. 'wpdb' => 'wp_cache_flush', ); // Opcache - upgrades may have had FS changes (e.g. theme template updates). if ( function_exists( 'opcache_reset' ) ) { $cache_cleaners['opcache'] = 'opcache_reset'; } return $cache_cleaners; } }