From 6c757db244369ffe16ad87c51a278e4da2444849 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 29 Jan 2019 12:55:15 -0500 Subject: [PATCH] Use static class property when fetching from containers. --- .../AbstractIlsAndUserActionFactory.php | 8 ++--- .../AbstractRelaisActionFactory.php | 6 ++-- .../AjaxHandler/CommentRecordFactory.php | 11 ++++--- .../DeleteRecordCommentFactory.php | 8 ++--- .../VuFind/AjaxHandler/DoiLookupFactory.php | 5 +-- .../AjaxHandler/GetACSuggestionsFactory.php | 4 +-- .../AjaxHandler/GetFacetDataFactory.php | 6 ++-- .../AjaxHandler/GetIlsStatusFactory.php | 4 +-- .../AjaxHandler/GetItemStatusesFactory.php | 8 ++--- .../GetRecordCommentsAsHTMLFactory.php | 2 +- .../AjaxHandler/GetRecordDetailsFactory.php | 4 +-- .../AjaxHandler/GetRecordTagsFactory.php | 6 ++-- .../AjaxHandler/GetResolverLinksFactory.php | 6 ++-- .../AjaxHandler/GetSaveStatusesFactory.php | 4 +-- .../AjaxHandler/GetSideFacetsFactory.php | 10 +++--- .../VuFind/AjaxHandler/GetVisDataFactory.php | 4 +-- .../VuFind/AjaxHandler/KeepAliveFactory.php | 4 ++- .../VuFind/AjaxHandler/RecommendFactory.php | 7 ++-- .../AjaxHandler/SystemStatusFactory.php | 10 +++--- .../VuFind/AjaxHandler/TagRecordFactory.php | 6 ++-- .../VuFind/Auth/ILSAuthenticatorFactory.php | 6 ++-- .../VuFind/src/VuFind/Auth/ManagerFactory.php | 16 ++++++---- .../src/VuFind/Autocomplete/EdsFactory.php | 2 +- .../src/VuFind/Autocomplete/SolrFactory.php | 2 +- .../VuFind/Autocomplete/SuggesterFactory.php | 6 ++-- module/VuFind/src/VuFind/Bootstrapper.php | 14 ++++---- .../src/VuFind/Cache/ManagerFactory.php | 4 +-- module/VuFind/src/VuFind/CartFactory.php | 7 ++-- .../AbstractILSChannelProviderFactory.php | 4 +-- .../ChannelProvider/ChannelLoaderFactory.php | 10 +++--- .../ChannelProvider/RouterInitializer.php | 6 ++-- .../Config/AccountCapabilitiesFactory.php | 4 +-- .../src/VuFind/Config/YamlReaderFactory.php | 2 +- .../src/VuFind/Connection/RelaisFactory.php | 6 ++-- .../Connection/WorldCatUtilsFactory.php | 5 +-- .../VuFind/Content/AbstractAmazonFactory.php | 5 +-- .../Content/AbstractSyndeticsFactory.php | 3 +- .../VuFind/Content/Covers/BrowZineFactory.php | 3 +- module/VuFind/src/VuFind/Content/Factory.php | 3 +- .../Content/Reviews/BooksiteFactory.php | 3 +- .../ContentBlock/BlockLoaderFactory.php | 6 ++-- .../VuFind/ContentBlock/ChannelsFactory.php | 2 +- .../VuFind/ContentBlock/FacetListFactory.php | 4 +-- .../src/VuFind/Controller/AbstractBase.php | 32 +++++++++++-------- .../AbstractBaseWithConfigFactory.php | 3 +- .../src/VuFind/Controller/AbstractRecord.php | 17 +++++----- .../src/VuFind/Controller/AbstractSearch.php | 30 +++++++++-------- .../VuFind/Controller/AbstractSolrSearch.php | 4 +-- .../Controller/AjaxControllerFactory.php | 2 +- .../src/VuFind/Controller/AlmaController.php | 2 +- .../Controller/AlphabrowseController.php | 2 +- .../VuFind/Controller/AuthorController.php | 2 +- .../VuFind/Controller/AuthorityController.php | 4 +-- .../VuFind/Controller/BrowseController.php | 2 +- .../src/VuFind/Controller/CartController.php | 6 ++-- .../Controller/CartControllerFactory.php | 2 +- .../Controller/ChannelsControllerFactory.php | 2 +- .../Controller/CollectionController.php | 2 +- .../Controller/CollectionsController.php | 6 ++-- .../VuFind/Controller/CombinedController.php | 22 +++++++------ .../VuFind/Controller/ContentController.php | 4 +-- .../Controller/CoverControllerFactory.php | 6 ++-- .../src/VuFind/Controller/EITController.php | 2 +- .../VuFind/Controller/EITrecordController.php | 2 +- .../src/VuFind/Controller/EdsController.php | 2 +- .../VuFind/Controller/EdsrecordController.php | 2 +- .../Controller/ExternalAuthController.php | 4 +-- .../VuFind/Controller/FeedbackController.php | 4 +-- .../VuFind/Controller/HierarchyController.php | 8 ++--- .../src/VuFind/Controller/HoldsTrait.php | 2 +- .../VuFind/Controller/ILLRequestsTrait.php | 2 +- .../Controller/IndexControllerFactory.php | 5 +-- .../VuFind/Controller/InstallController.php | 13 ++++---- .../VuFind/Controller/LibGuidesController.php | 2 +- .../Controller/MyResearchController.php | 23 +++++++------ .../src/VuFind/Controller/OaiController.php | 11 ++++--- .../src/VuFind/Controller/PrimoController.php | 2 +- .../Controller/PrimorecordController.php | 2 +- .../Controller/QRCodeControllerFactory.php | 4 +-- .../VuFind/Controller/RecordController.php | 2 +- .../VuFind/Controller/Search2Controller.php | 2 +- .../Controller/Search2recordController.php | 2 +- .../VuFind/Controller/SearchController.php | 12 ++++--- ...ShibbolethLogoutNotificationController.php | 3 +- .../StorageRetrievalRequestsTrait.php | 2 +- .../VuFind/Controller/SummonController.php | 4 +-- .../Controller/SummonrecordController.php | 2 +- .../VuFind/Controller/UpgradeController.php | 13 ++++---- .../Controller/UpgradeControllerFactory.php | 4 +-- .../VuFind/Controller/WorldcatController.php | 2 +- .../Controller/WorldcatrecordController.php | 2 +- .../VuFind/Cookie/CookieManagerFactory.php | 3 +- .../src/VuFind/Cover/CachingProxyFactory.php | 6 ++-- .../src/VuFind/Cover/GeneratorFactory.php | 4 +-- .../VuFind/src/VuFind/Cover/LoaderFactory.php | 15 +++++---- .../VuFind/src/VuFind/Crypt/HMACFactory.php | 3 +- .../src/VuFind/Db/Row/RowGatewayFactory.php | 2 +- .../VuFind/src/VuFind/Db/Row/UserFactory.php | 5 +-- .../src/VuFind/Db/Row/UserListFactory.php | 2 +- .../Db/Table/CaseSensitiveTagsFactory.php | 3 +- .../src/VuFind/Db/Table/GatewayFactory.php | 6 ++-- .../src/VuFind/Db/Table/ResourceFactory.php | 4 +-- .../src/VuFind/Db/Table/UserFactory.php | 5 +-- .../src/VuFind/Db/Table/UserListFactory.php | 2 +- .../src/VuFind/DoiLinker/BrowZineFactory.php | 3 +- module/VuFind/src/VuFind/ExportFactory.php | 4 +-- .../Favorites/FavoritesServiceFactory.php | 4 +-- module/VuFind/src/VuFind/Form/FormFactory.php | 4 +-- .../GeoFeatures/AbstractConfigFactory.php | 4 ++- .../Driver/ConfigurationBasedFactory.php | 6 ++-- .../Hierarchy/TreeDataSource/SolrFactory.php | 11 ++++--- .../Hierarchy/TreeRenderer/JSTreeFactory.php | 3 +- .../src/VuFind/ILS/ConnectionFactory.php | 11 ++++--- .../src/VuFind/ILS/Driver/AlephFactory.php | 4 ++- .../src/VuFind/ILS/Driver/AlmaFactory.php | 6 ++-- .../src/VuFind/ILS/Driver/DemoFactory.php | 4 +-- .../Driver/DriverWithDateConverterFactory.php | 4 +-- .../src/VuFind/ILS/Driver/FolioFactory.php | 2 +- .../VuFind/ILS/Driver/MultiBackendFactory.php | 6 ++-- .../src/VuFind/ILS/Driver/NoILSFactory.php | 2 +- .../src/VuFind/ILS/Driver/PAIAFactory.php | 2 +- .../VuFind/ILS/Driver/SierraRestFactory.php | 2 +- .../src/VuFind/ILS/Driver/SymphonyFactory.php | 4 +-- .../ILS/Driver/VoyagerRestfulFactory.php | 2 +- .../src/VuFind/ILS/HoldSettingsFactory.php | 3 +- .../src/VuFind/ILS/Logic/LogicFactory.php | 8 ++--- .../VuFind/src/VuFind/Log/LoggerFactory.php | 9 +++--- module/VuFind/src/VuFind/Mailer/Factory.php | 3 +- .../src/VuFind/QRCode/LoaderFactory.php | 4 +-- .../VuFind/src/VuFind/Record/CacheFactory.php | 6 ++-- .../Record/FallbackLoader/SummonFactory.php | 4 +-- .../src/VuFind/Record/LoaderFactory.php | 8 ++--- .../src/VuFind/Record/RouterFactory.php | 4 +-- .../RecordDriver/AbstractBaseFactory.php | 3 +- .../RecordDriver/IlsAwareDelegatorFactory.php | 9 +++--- .../RecordDriver/NameBasedConfigFactory.php | 3 +- .../src/VuFind/RecordDriver/PluginManager.php | 2 +- .../RecordDriver/SolrDefaultFactory.php | 2 +- ...SolrDefaultWithoutSearchServiceFactory.php | 3 +- .../VuFind/RecordDriver/SolrWebFactory.php | 3 +- .../src/VuFind/RecordDriver/SummonFactory.php | 2 +- .../src/VuFind/RecordTab/PreviewFactory.php | 2 +- .../src/VuFind/Related/SimilarFactory.php | 2 +- .../Resolver/Driver/AbstractBaseFactory.php | 3 +- .../Driver/DriverWithHttpClientFactory.php | 2 +- .../Role/DynamicRoleProviderFactory.php | 2 +- .../Role/PermissionDeniedManagerFactory.php | 6 ++-- .../VuFind/Role/PermissionManagerFactory.php | 4 +-- module/VuFind/src/VuFind/SMS/Factory.php | 10 +++--- .../VuFind/Search/Base/FacetCacheFactory.php | 7 ++-- .../src/VuFind/Search/EDS/OptionsFactory.php | 5 +-- .../Factory/AbstractSolrBackendFactory.php | 14 ++++---- .../Search/Factory/BrowZineBackendFactory.php | 10 +++--- .../Search/Factory/EITBackendFactory.php | 16 +++++----- .../Search/Factory/EdsBackendFactory.php | 22 ++++++++----- .../Factory/LibGuidesBackendFactory.php | 10 +++--- .../Search/Factory/Pazpar2BackendFactory.php | 12 ++++--- .../Search/Factory/PrimoBackendFactory.php | 14 +++++--- .../Search/Factory/SolrAuthBackendFactory.php | 3 +- .../Factory/SolrDefaultBackendFactory.php | 3 +- .../Factory/SolrReservesBackendFactory.php | 3 +- .../Search/Factory/SolrWebBackendFactory.php | 3 +- .../Search/Factory/SummonBackendFactory.php | 13 +++++--- .../Search/Factory/WorldCatBackendFactory.php | 18 +++++------ .../Search/Favorites/ResultsFactory.php | 2 +- .../src/VuFind/Search/HistoryFactory.php | 7 ++-- .../src/VuFind/Search/MemoryFactory.php | 2 +- .../VuFind/Search/Options/OptionsFactory.php | 2 +- .../VuFind/Search/Options/PluginFactory.php | 2 +- .../VuFind/Search/Params/ParamsFactory.php | 4 +-- .../VuFind/Search/Params/PluginFactory.php | 4 +-- .../VuFind/Search/Results/PluginFactory.php | 6 ++-- .../VuFind/Search/Results/ResultsFactory.php | 6 ++-- .../VuFind/Search/Search2/ResultsFactory.php | 3 +- .../src/VuFind/Search/SearchRunnerFactory.php | 2 +- .../VuFind/Search/SearchTabsHelperFactory.php | 5 +-- .../Search/Solr/DeduplicationListener.php | 2 +- .../VuFind/Search/Solr/FacetCacheFactory.php | 4 +-- .../Search/Solr/HierarchicalFacetListener.php | 4 +-- .../src/VuFind/Search/Solr/ParamsFactory.php | 3 +- .../src/VuFind/Search/Solr/ResultsFactory.php | 3 +- .../src/VuFind/Search/Tags/ResultsFactory.php | 2 +- .../VuFind/Service/DateConverterFactory.php | 3 +- .../src/VuFind/Service/ReCaptchaFactory.php | 8 +++-- .../Service/ServiceWithConfigIniFactory.php | 3 +- .../ServiceManager/ServiceInitializer.php | 14 ++++---- .../src/VuFind/Session/ManagerFactory.php | 10 +++--- .../VuFind/Session/SecureDelegatorFactory.php | 6 ++-- .../VuFind/src/VuFind/Solr/WriterFactory.php | 5 +-- module/VuFind/src/VuFind/TagsFactory.php | 3 +- .../src/VuFind/Validator/CsrfFactory.php | 5 +-- .../Helper/Bootstrap3/LayoutClassFactory.php | 3 +- .../Root/AccountCapabilitiesFactory.php | 2 +- .../View/Helper/Root/AddThisFactory.php | 3 +- .../VuFind/View/Helper/Root/AuthFactory.php | 4 +-- .../View/Helper/Root/AuthorNotesFactory.php | 4 +-- .../VuFind/View/Helper/Root/CartFactory.php | 2 +- .../View/Helper/Root/CitationFactory.php | 2 +- .../VuFind/View/Helper/Root/ConfigFactory.php | 4 ++- .../View/Helper/Root/ContentLoaderFactory.php | 2 +- .../View/Helper/Root/DateTimeFactory.php | 2 +- .../VuFind/View/Helper/Root/DoiFactory.php | 3 +- .../VuFind/View/Helper/Root/ExportFactory.php | 2 +- .../View/Helper/Root/FeedbackFactory.php | 3 +- .../View/Helper/Root/FlashmessagesFactory.php | 2 +- .../View/Helper/Root/GeoCoordsFactory.php | 2 +- .../Helper/Root/GoogleAnalyticsFactory.php | 3 +- .../View/Helper/Root/HelpTextFactory.php | 2 +- .../View/Helper/Root/HistoryLabelFactory.php | 3 +- .../VuFind/View/Helper/Root/IlsFactory.php | 2 +- .../View/Helper/Root/KeepAliveFactory.php | 3 +- .../View/Helper/Root/OpenUrlFactory.php | 5 +-- .../View/Helper/Root/PermissionFactory.php | 4 +-- .../VuFind/View/Helper/Root/PiwikFactory.php | 3 +- .../View/Helper/Root/ProxyUrlFactory.php | 3 +- .../View/Helper/Root/RecaptchaFactory.php | 4 +-- .../VuFind/View/Helper/Root/RecordFactory.php | 5 +-- .../View/Helper/Root/RecordLinkFactory.php | 2 +- .../VuFind/View/Helper/Root/RelaisFactory.php | 3 +- .../View/Helper/Root/RelatedFactory.php | 6 ++-- .../Helper/Root/SafeMoneyFormatFactory.php | 3 +- .../View/Helper/Root/SearchBoxFactory.php | 4 +-- .../View/Helper/Root/SearchMemoryFactory.php | 2 +- .../View/Helper/Root/SearchOptionsFactory.php | 2 +- .../View/Helper/Root/SearchParamsFactory.php | 2 +- .../View/Helper/Root/SearchTabsFactory.php | 4 +-- .../View/Helper/Root/SyndeticsPlusFactory.php | 3 +- .../View/Helper/Root/SystemEmailFactory.php | 3 +- .../View/Helper/Root/UserListFactory.php | 4 +-- .../View/Helper/Root/UserTagsFactory.php | 2 +- .../VuFind/src/VuFind/XSLT/Import/VuFind.php | 4 +-- module/VuFind/src/VuFind/XSLT/Importer.php | 2 +- .../src/VuFindTest/Unit/AjaxHandlerTest.php | 2 +- .../VuFind/src/VuFindTest/Unit/DbTestCase.php | 4 +-- .../VuFind/src/VuFindTest/Unit/TestCase.php | 8 +++-- .../src/VuFindTest/Auth/ILSTest.php | 2 +- .../VuFindTest/Connection/SolrAuthTest.php | 2 +- .../src/VuFindTest/Connection/SolrTest.php | 8 ++--- .../View/Helper/Root/ResultFeedTest.php | 4 +-- .../Config/SearchSpecsReaderTest.php | 4 +-- .../Recommend/RandomRecommendTest.php | 10 +++--- .../src/VuFindTest/Search/Base/ParamsTest.php | 2 +- .../Search/Solr/SpellingProcessorTest.php | 6 ++-- .../VuFindAdmin/Controller/AbstractAdmin.php | 2 +- .../Controller/AdminController.php | 2 +- .../Controller/ConfigController.php | 2 +- .../Controller/MaintenanceController.php | 4 +-- .../src/VuFindApi/Controller/ApiTrait.php | 3 +- .../Controller/SearchApiController.php | 6 ++-- .../Formatter/RecordFormatterFactory.php | 2 +- .../VuFindConsole/Controller/AbstractBase.php | 7 ++-- .../Controller/CompileController.php | 2 +- .../Controller/GenerateController.php | 8 +++-- .../Controller/HarvestController.php | 2 +- .../Controller/ImportController.php | 5 +-- .../Controller/UtilController.php | 25 ++++++++------- .../Controller/DevtoolsController.php | 5 +-- .../src/VuFindTheme/Initializer.php | 19 ++++++----- 258 files changed, 740 insertions(+), 593 deletions(-) diff --git a/module/VuFind/src/VuFind/AjaxHandler/AbstractIlsAndUserActionFactory.php b/module/VuFind/src/VuFind/AjaxHandler/AbstractIlsAndUserActionFactory.php index 19b2b2c6c3a..c3f04c2ff31 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/AbstractIlsAndUserActionFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/AbstractIlsAndUserActionFactory.php @@ -61,10 +61,10 @@ class AbstractIlsAndUserActionFactory array $options = null ) { return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\ILS\Connection'), - $container->get('VuFind\Auth\ILSAuthenticator'), - $container->get('VuFind\Auth\Manager')->isLoggedIn(), + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\ILS\Connection::class), + $container->get(\VuFind\Auth\ILSAuthenticator::class), + $container->get(\VuFind\Auth\Manager::class)->isLoggedIn(), ...($options ?: []) ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/AbstractRelaisActionFactory.php b/module/VuFind/src/VuFind/AjaxHandler/AbstractRelaisActionFactory.php index 7191dedc770..b4b7d987edd 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/AbstractRelaisActionFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/AbstractRelaisActionFactory.php @@ -63,10 +63,10 @@ class AbstractRelaisActionFactory if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $user = $container->get('VuFind\Auth\Manager')->isLoggedIn(); + $user = $container->get(\VuFind\Auth\Manager::class)->isLoggedIn(); return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\Connection\Relais'), + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\Connection\Relais::class), $user ?: null ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/CommentRecordFactory.php b/module/VuFind/src/VuFind/AjaxHandler/CommentRecordFactory.php index 2e9e9b1d1c2..3eb2ebca3ed 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/CommentRecordFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/CommentRecordFactory.php @@ -62,13 +62,14 @@ class CommentRecordFactory implements \Zend\ServiceManager\Factory\FactoryInterf if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $tablePluginManager = $container->get('VuFind\Db\Table\PluginManager'); + $tablePluginManager = $container->get(\VuFind\Db\Table\PluginManager::class); $controllerPluginManager = $container->get('ControllerPluginManager'); - $capabilities = $container->get('VuFind\Config\AccountCapabilities'); + $capabilities = $container->get(\VuFind\Config\AccountCapabilities::class); return new $requestedName( - $tablePluginManager->get('VuFind\Db\Table\Resource'), - $controllerPluginManager->get('VuFind\Controller\Plugin\Recaptcha'), - $container->get('VuFind\Auth\Manager')->isLoggedIn(), + $tablePluginManager->get(\VuFind\Db\Table\Resource::class), + $controllerPluginManager + ->get(\VuFind\Controller\Plugin\Recaptcha::class), + $container->get(\VuFind\Auth\Manager::class)->isLoggedIn(), $capabilities->getCommentSetting() !== 'disabled' ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/DeleteRecordCommentFactory.php b/module/VuFind/src/VuFind/AjaxHandler/DeleteRecordCommentFactory.php index 95cadcf5e32..3ec532e9246 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/DeleteRecordCommentFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/DeleteRecordCommentFactory.php @@ -63,11 +63,11 @@ class DeleteRecordCommentFactory if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $tablePluginManager = $container->get('VuFind\Db\Table\PluginManager'); - $capabilities = $container->get('VuFind\Config\AccountCapabilities'); + $tablePluginManager = $container->get(\VuFind\Db\Table\PluginManager::class); + $capabilities = $container->get(\VuFind\Config\AccountCapabilities::class); return new $requestedName( - $tablePluginManager->get('VuFind\Db\Table\Comments'), - $container->get('VuFind\Auth\Manager')->isLoggedIn(), + $tablePluginManager->get(\VuFind\Db\Table\Comments::class), + $container->get(\VuFind\Auth\Manager::class)->isLoggedIn(), $capabilities->getCommentSetting() !== 'disabled' ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/DoiLookupFactory.php b/module/VuFind/src/VuFind/AjaxHandler/DoiLookupFactory.php index fb41749f91e..d7a1b30c812 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/DoiLookupFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/DoiLookupFactory.php @@ -62,8 +62,9 @@ class DoiLookupFactory implements \Zend\ServiceManager\Factory\FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); - $pluginManager = $container->get('VuFind\DoiLinker\PluginManager'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); + $pluginManager = $container->get(\VuFind\DoiLinker\PluginManager::class); return new $requestedName($pluginManager, $config->DOI->resolver ?? null); } } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetACSuggestionsFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetACSuggestionsFactory.php index d00b91d9a7b..6006304bbbf 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetACSuggestionsFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetACSuggestionsFactory.php @@ -64,8 +64,8 @@ class GetACSuggestionsFactory implements throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\Autocomplete\Suggester') + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\Autocomplete\Suggester::class) ); } } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetFacetDataFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetFacetDataFactory.php index 3517a19930b..63fabc1d84b 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetFacetDataFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetFacetDataFactory.php @@ -63,9 +63,9 @@ class GetFacetDataFactory implements \Zend\ServiceManager\Factory\FactoryInterfa throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\Search\Solr\HierarchicalFacetHelper'), - $container->get('VuFind\Search\Results\PluginManager') + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\Search\Solr\HierarchicalFacetHelper::class), + $container->get(\VuFind\Search\Results\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetIlsStatusFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetIlsStatusFactory.php index 75547b84c56..8409ebec5a7 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetIlsStatusFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetIlsStatusFactory.php @@ -63,8 +63,8 @@ class GetIlsStatusFactory implements \Zend\ServiceManager\Factory\FactoryInterfa throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\ILS\Connection'), + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\ILS\Connection::class), $container->get('ViewRenderer') ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetItemStatusesFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetItemStatusesFactory.php index f0f50fc838b..ceb821a0d9a 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetItemStatusesFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetItemStatusesFactory.php @@ -63,11 +63,11 @@ class GetItemStatusesFactory implements \Zend\ServiceManager\Factory\FactoryInte throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\Config\PluginManager')->get('config'), - $container->get('VuFind\ILS\Connection'), + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\ILS\Connection::class), $container->get('ViewRenderer'), - $container->get('VuFind\ILS\Logic\Holds') + $container->get(\VuFind\ILS\Logic\Holds::class) ); } } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetRecordCommentsAsHTMLFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetRecordCommentsAsHTMLFactory.php index aa5cad433b0..2d59fa021fa 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetRecordCommentsAsHTMLFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetRecordCommentsAsHTMLFactory.php @@ -64,7 +64,7 @@ class GetRecordCommentsAsHTMLFactory throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Record\Loader'), + $container->get(\VuFind\Record\Loader::class), $container->get('ViewRenderer') ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetRecordDetailsFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetRecordDetailsFactory.php index 1174242c9ab..361884e127f 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetRecordDetailsFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetRecordDetailsFactory.php @@ -66,8 +66,8 @@ class GetRecordDetailsFactory return new $requestedName( $container->get('Config'), $container->get('Request'), - $container->get('VuFind\Record\Loader'), - $container->get('VuFind\RecordTab\PluginManager'), + $container->get(\VuFind\Record\Loader::class), + $container->get(\VuFind\RecordTab\PluginManager::class), $container->get('ViewRenderer') ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetRecordTagsFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetRecordTagsFactory.php index 8e4d746e203..b643a7596ff 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetRecordTagsFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetRecordTagsFactory.php @@ -62,10 +62,10 @@ class GetRecordTagsFactory implements \Zend\ServiceManager\Factory\FactoryInterf if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $tablePluginManager = $container->get('VuFind\Db\Table\PluginManager'); + $tablePluginManager = $container->get(\VuFind\Db\Table\PluginManager::class); return new $requestedName( - $tablePluginManager->get('VuFind\Db\Table\Tags'), - $container->get('VuFind\Auth\Manager')->isLoggedIn(), + $tablePluginManager->get(\VuFind\Db\Table\Tags::class), + $container->get(\VuFind\Auth\Manager::class)->isLoggedIn(), $container->get('ViewRenderer') ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetResolverLinksFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetResolverLinksFactory.php index fc5072f68e4..55d1f52103b 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetResolverLinksFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetResolverLinksFactory.php @@ -64,10 +64,10 @@ class GetResolverLinksFactory throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\Resolver\Driver\PluginManager'), + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\Resolver\Driver\PluginManager::class), $container->get('ViewRenderer'), - $container->get('VuFind\Config\PluginManager')->get('config') + $container->get(\VuFind\Config\PluginManager::class)->get('config') ); } } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetSaveStatusesFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetSaveStatusesFactory.php index 7429b256508..cdad3bdcff3 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetSaveStatusesFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetSaveStatusesFactory.php @@ -63,8 +63,8 @@ class GetSaveStatusesFactory implements \Zend\ServiceManager\Factory\FactoryInte throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\Auth\Manager')->isLoggedIn(), + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\Auth\Manager::class)->isLoggedIn(), $container->get('ControllerPluginManager')->get('url') ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetSideFacetsFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetSideFacetsFactory.php index 9ea6a726bd5..420747730f5 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetSideFacetsFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetSideFacetsFactory.php @@ -63,11 +63,11 @@ class GetSideFacetsFactory implements \Zend\ServiceManager\Factory\FactoryInterf throw new \Exception('Unexpected options passed to factory.'); } $result = new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\Recommend\PluginManager'), - $container->get('VuFind\SearchRunner'), - $container->get('VuFind\Search\Solr\HierarchicalFacetHelper'), - $container->get('VuFind\Config\PluginManager')->get('facets'), + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\Recommend\PluginManager::class), + $container->get(\VuFind\SearchRunner::class), + $container->get(\VuFind\Search\Solr\HierarchicalFacetHelper::class), + $container->get(\VuFind\Config\PluginManager::class)->get('facets'), $container->get('ViewRenderer') ); return $result; diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetVisDataFactory.php b/module/VuFind/src/VuFind/AjaxHandler/GetVisDataFactory.php index 8835cf458ab..ab528e3c55a 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetVisDataFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetVisDataFactory.php @@ -63,8 +63,8 @@ class GetVisDataFactory implements \Zend\ServiceManager\Factory\FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\Search\Results\PluginManager')->get('Solr') + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\Search\Results\PluginManager::class)->get('Solr') ); } } diff --git a/module/VuFind/src/VuFind/AjaxHandler/KeepAliveFactory.php b/module/VuFind/src/VuFind/AjaxHandler/KeepAliveFactory.php index e229b158bfe..824a091815d 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/KeepAliveFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/KeepAliveFactory.php @@ -62,6 +62,8 @@ class KeepAliveFactory implements \Zend\ServiceManager\Factory\FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - return new $requestedName($container->get('Zend\Session\SessionManager')); + return new $requestedName( + $container->get(\Zend\Session\SessionManager::class) + ); } } diff --git a/module/VuFind/src/VuFind/AjaxHandler/RecommendFactory.php b/module/VuFind/src/VuFind/AjaxHandler/RecommendFactory.php index b445a47cee8..06a0de3a6b0 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/RecommendFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/RecommendFactory.php @@ -28,6 +28,7 @@ namespace VuFind\AjaxHandler; use Interop\Container\ContainerInterface; +use VuFind\Search\Results\PluginManager as ResultsManager; /** * Factory for Recommend AJAX handler. @@ -63,9 +64,9 @@ class RecommendFactory implements \Zend\ServiceManager\Factory\FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Session\Settings'), - $container->get('VuFind\Recommend\PluginManager'), - $container->get('VuFind\Search\Results\PluginManager')->get('Solr'), + $container->get(\VuFind\Session\Settings::class), + $container->get(\VuFind\Recommend\PluginManager::class), + $container->get(ResultsManager::class)->get('Solr'), $container->get('ViewRenderer') ); } diff --git a/module/VuFind/src/VuFind/AjaxHandler/SystemStatusFactory.php b/module/VuFind/src/VuFind/AjaxHandler/SystemStatusFactory.php index d8f08e00f31..fbe8e953a5e 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/SystemStatusFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/SystemStatusFactory.php @@ -62,12 +62,12 @@ class SystemStatusFactory implements \Zend\ServiceManager\Factory\FactoryInterfa if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $tablePluginManager = $container->get('VuFind\Db\Table\PluginManager'); + $tablePluginManager = $container->get(\VuFind\Db\Table\PluginManager::class); return new $requestedName( - $container->get('Zend\Session\SessionManager'), - $container->get('VuFind\Search\Results\PluginManager'), - $container->get('VuFind\Config\PluginManager')->get('config'), - $tablePluginManager->get('VuFind\Db\Table\Session') + $container->get(\Zend\Session\SessionManager::class), + $container->get(\VuFind\Search\Results\PluginManager::class), + $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $tablePluginManager->get(\VuFind\Db\Table\Session::class) ); } } diff --git a/module/VuFind/src/VuFind/AjaxHandler/TagRecordFactory.php b/module/VuFind/src/VuFind/AjaxHandler/TagRecordFactory.php index 97a1e947396..8f75dddafb5 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/TagRecordFactory.php +++ b/module/VuFind/src/VuFind/AjaxHandler/TagRecordFactory.php @@ -63,9 +63,9 @@ class TagRecordFactory implements \Zend\ServiceManager\Factory\FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Record\Loader'), - $container->get('VuFind\Tags'), - $container->get('VuFind\Auth\Manager')->isLoggedIn() + $container->get(\VuFind\Record\Loader::class), + $container->get(\VuFind\Tags::class), + $container->get(\VuFind\Auth\Manager::class)->isLoggedIn() ); } } diff --git a/module/VuFind/src/VuFind/Auth/ILSAuthenticatorFactory.php b/module/VuFind/src/VuFind/Auth/ILSAuthenticatorFactory.php index 68c7f1faa35..7b7e64cd48e 100644 --- a/module/VuFind/src/VuFind/Auth/ILSAuthenticatorFactory.php +++ b/module/VuFind/src/VuFind/Auth/ILSAuthenticatorFactory.php @@ -68,14 +68,14 @@ class ILSAuthenticatorFactory implements FactoryInterface // actually utilized. $callback = function (& $wrapped, $proxy) use ($container, $requestedName) { // Generate wrapped object: - $auth = $container->get('VuFind\Auth\Manager'); - $catalog = $container->get('VuFind\ILS\Connection'); + $auth = $container->get(\VuFind\Auth\Manager::class); + $catalog = $container->get(\VuFind\ILS\Connection::class); $wrapped = new $requestedName($auth, $catalog); // Indicate that initialization is complete to avoid reinitialization: $proxy->setProxyInitializer(null); }; - $cfg = $container->get('ProxyManager\Configuration'); + $cfg = $container->get(\ProxyManager\Configuration::class); $factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory($cfg); return $factory->createProxy($requestedName, $callback); } diff --git a/module/VuFind/src/VuFind/Auth/ManagerFactory.php b/module/VuFind/src/VuFind/Auth/ManagerFactory.php index 9b1436cb86e..6e6f90a09f3 100644 --- a/module/VuFind/src/VuFind/Auth/ManagerFactory.php +++ b/module/VuFind/src/VuFind/Auth/ManagerFactory.php @@ -62,11 +62,12 @@ class ManagerFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } // Set up configuration: - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); try { // Check if the catalog wants to hide the login link, and override // the configuration if necessary. - $catalog = $container->get('VuFind\ILS\Connection'); + $catalog = $container->get(\VuFind\ILS\Connection::class); if ($catalog->loginIsHidden()) { $config = new \Zend\Config\Config($config->toArray(), true); $config->Authentication->hideLogin = true; @@ -80,11 +81,12 @@ class ManagerFactory implements FactoryInterface } // Load remaining dependencies: - $userTable = $container->get('VuFind\Db\Table\PluginManager')->get('user'); - $sessionManager = $container->get('Zend\Session\SessionManager'); - $pm = $container->get('VuFind\Auth\PluginManager'); - $cookies = $container->get('VuFind\Cookie\CookieManager'); - $csrf = $container->get('VuFind\Validator\Csrf'); + $userTable = $container->get(\VuFind\Db\Table\PluginManager::class) + ->get('user'); + $sessionManager = $container->get(\Zend\Session\SessionManager::class); + $pm = $container->get(\VuFind\Auth\PluginManager::class); + $cookies = $container->get(\VuFind\Cookie\CookieManager::class); + $csrf = $container->get(\VuFind\Validator\Csrf::class); // Build the object and make sure account credentials haven't expired: $manager = new $requestedName( diff --git a/module/VuFind/src/VuFind/Autocomplete/EdsFactory.php b/module/VuFind/src/VuFind/Autocomplete/EdsFactory.php index 1dbe0ef91e0..bbc6f65c413 100644 --- a/module/VuFind/src/VuFind/Autocomplete/EdsFactory.php +++ b/module/VuFind/src/VuFind/Autocomplete/EdsFactory.php @@ -62,7 +62,7 @@ class EdsFactory implements \Zend\ServiceManager\Factory\FactoryInterface array $options = null ) { return new $requestedName( - $container->get('VuFind\Search\BackendManager')->get('EDS') + $container->get(\VuFind\Search\BackendManager::class)->get('EDS') ); } } diff --git a/module/VuFind/src/VuFind/Autocomplete/SolrFactory.php b/module/VuFind/src/VuFind/Autocomplete/SolrFactory.php index cb6d44c1b76..fea358c9fd7 100644 --- a/module/VuFind/src/VuFind/Autocomplete/SolrFactory.php +++ b/module/VuFind/src/VuFind/Autocomplete/SolrFactory.php @@ -62,7 +62,7 @@ class SolrFactory implements \Zend\ServiceManager\Factory\FactoryInterface array $options = null ) { return new $requestedName( - $container->get('VuFind\Search\Results\PluginManager') + $container->get(\VuFind\Search\Results\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/Autocomplete/SuggesterFactory.php b/module/VuFind/src/VuFind/Autocomplete/SuggesterFactory.php index 98e85ed0c85..8c467489a7d 100644 --- a/module/VuFind/src/VuFind/Autocomplete/SuggesterFactory.php +++ b/module/VuFind/src/VuFind/Autocomplete/SuggesterFactory.php @@ -60,9 +60,9 @@ class SuggesterFactory implements \Zend\ServiceManager\Factory\FactoryInterface array $options = null ) { return new $requestedName( - $container->get('VuFind\Autocomplete\PluginManager'), - $container->get('VuFind\Config\PluginManager'), - $container->get('VuFind\Search\Options\PluginManager') + $container->get(\VuFind\Autocomplete\PluginManager::class), + $container->get(\VuFind\Config\PluginManager::class), + $container->get(\VuFind\Search\Options\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/Bootstrapper.php b/module/VuFind/src/VuFind/Bootstrapper.php index 32b15d513ff..af24bdf96c3 100644 --- a/module/VuFind/src/VuFind/Bootstrapper.php +++ b/module/VuFind/src/VuFind/Bootstrapper.php @@ -100,7 +100,7 @@ class Bootstrapper // Create the configuration manager: $app = $this->event->getApplication(); $sm = $app->getServiceManager(); - $this->config = $sm->get('VuFind\Config\PluginManager')->get('config'); + $this->config = $sm->get(\VuFind\Config\PluginManager::class)->get('config'); } /** @@ -119,9 +119,9 @@ class Bootstrapper $sm = $app->getServiceManager(); $debugOverride = $sm->get('Request')->getQuery()->get('debug'); if ($debugOverride) { - $auth = $sm->get('ZfcRbac\Service\AuthorizationService'); + $auth = $sm->get(\ZfcRbac\Service\AuthorizationService::class); if ($auth->isGranted('access.DebugMode')) { - $logger = $sm->get('VuFind\Log\Logger'); + $logger = $sm->get(\VuFind\Log\Logger::class); $logger->addDebugWriter($debugOverride); } } @@ -321,7 +321,7 @@ class Bootstrapper if (($language = $request->getPost()->get('mylang', false)) || ($language = $request->getQuery()->get('lng', false)) ) { - $cookieManager = $sm->get('VuFind\Cookie\CookieManager'); + $cookieManager = $sm->get(\VuFind\Cookie\CookieManager::class); $cookieManager->set('language', $language); } elseif (!empty($request->getCookie()->language)) { $language = $request->getCookie()->language; @@ -335,7 +335,7 @@ class Bootstrapper $language = $config->Site->language; } try { - $translator = $sm->get('Zend\Mvc\I18n\Translator'); + $translator = $sm->get(\Zend\Mvc\I18n\Translator::class); $translator->setLocale($language) ->addTranslationFile('ExtendedIni', null, 'default', $language); foreach ($this->getTextDomains() as $domain) { @@ -430,7 +430,7 @@ class Bootstrapper protected function initSearch() { $sm = $this->event->getApplication()->getServiceManager(); - $bm = $sm->get('VuFind\Search\BackendManager'); + $bm = $sm->get(\VuFind\Search\BackendManager::class); $events = $sm->get('SharedEventManager'); $events->attach('VuFindSearch', 'resolve', [$bm, 'onResolve']); } @@ -445,7 +445,7 @@ class Bootstrapper $callback = function ($event) { $sm = $event->getApplication()->getServiceManager(); if ($sm->has('VuFind\Log\Logger')) { - $log = $sm->get('VuFind\Log\Logger'); + $log = $sm->get(\VuFind\Log\Logger::class); if (is_callable([$log, 'logException'])) { $exception = $event->getParam('exception'); // Console request does not include server, diff --git a/module/VuFind/src/VuFind/Cache/ManagerFactory.php b/module/VuFind/src/VuFind/Cache/ManagerFactory.php index 317ca426c20..b1c384bcb8a 100644 --- a/module/VuFind/src/VuFind/Cache/ManagerFactory.php +++ b/module/VuFind/src/VuFind/Cache/ManagerFactory.php @@ -62,8 +62,8 @@ class ManagerFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Config\PluginManager')->get('config'), - $container->get('VuFind\Config\PluginManager')->get('searches') + $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\PluginManager::class)->get('searches') ); } } diff --git a/module/VuFind/src/VuFind/CartFactory.php b/module/VuFind/src/VuFind/CartFactory.php index a4c76e307ae..a686cb8ce55 100644 --- a/module/VuFind/src/VuFind/CartFactory.php +++ b/module/VuFind/src/VuFind/CartFactory.php @@ -61,7 +61,8 @@ class CartFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $active = isset($config->Site->showBookBag) ? (bool)$config->Site->showBookBag : false; $size = isset($config->Site->bookBagMaxSize) @@ -69,8 +70,8 @@ class CartFactory implements FactoryInterface $activeInSearch = isset($config->Site->bookbagTogglesInSearch) ? $config->Site->bookbagTogglesInSearch : true; return new $requestedName( - $container->get('VuFind\Record\Loader'), - $container->get('VuFind\Cookie\CookieManager'), + $container->get(\VuFind\Record\Loader::class), + $container->get(\VuFind\Cookie\CookieManager::class), $size, $active, $activeInSearch ); } diff --git a/module/VuFind/src/VuFind/ChannelProvider/AbstractILSChannelProviderFactory.php b/module/VuFind/src/VuFind/ChannelProvider/AbstractILSChannelProviderFactory.php index b3d942f941d..9920417b5c1 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/AbstractILSChannelProviderFactory.php +++ b/module/VuFind/src/VuFind/ChannelProvider/AbstractILSChannelProviderFactory.php @@ -62,8 +62,8 @@ class AbstractILSChannelProviderFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory!'); } return new $requestedName( - $container->get('VuFindSearch\Service'), - $container->get('VuFind\ILS\Connection') + $container->get(\VuFindSearch\Service::class), + $container->get(\VuFind\ILS\Connection::class) ); } } diff --git a/module/VuFind/src/VuFind/ChannelProvider/ChannelLoaderFactory.php b/module/VuFind/src/VuFind/ChannelProvider/ChannelLoaderFactory.php index b969c763b8b..d471c905f5c 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/ChannelLoaderFactory.php +++ b/module/VuFind/src/VuFind/ChannelProvider/ChannelLoaderFactory.php @@ -62,11 +62,11 @@ class ChannelLoaderFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory!'); } return new $requestedName( - $container->get('VuFind\Config\PluginManager')->get('channels'), - $container->get('VuFind\Cache\Manager'), - $container->get('VuFind\ChannelProvider\PluginManager'), - $container->get('VuFind\Search\SearchRunner'), - $container->get('VuFind\Record\Loader') + $container->get(\VuFind\Config\PluginManager::class)->get('channels'), + $container->get(\VuFind\Cache\Manager::class), + $container->get(\VuFind\ChannelProvider\PluginManager::class), + $container->get(\VuFind\Search\SearchRunner::class), + $container->get(\VuFind\Record\Loader::class) ); } } diff --git a/module/VuFind/src/VuFind/ChannelProvider/RouterInitializer.php b/module/VuFind/src/VuFind/ChannelProvider/RouterInitializer.php index 264a9e059b5..5c1704a1663 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/RouterInitializer.php +++ b/module/VuFind/src/VuFind/ChannelProvider/RouterInitializer.php @@ -52,8 +52,10 @@ class RouterInitializer implements InitializerInterface public function __invoke(ContainerInterface $container, $instance) { if ($instance instanceof AbstractChannelProvider) { - $instance->setCoverRouter($container->get('VuFind\Cover\Router')); - $instance->setRecordRouter($container->get('VuFind\Record\Router')); + $instance->setCoverRouter($container->get(\VuFind\Cover\Router::class)); + $instance->setRecordRouter( + $container->get(\VuFind\Record\Router::class) + ); } return $instance; } diff --git a/module/VuFind/src/VuFind/Config/AccountCapabilitiesFactory.php b/module/VuFind/src/VuFind/Config/AccountCapabilitiesFactory.php index 85c82ba345e..a32ca572092 100644 --- a/module/VuFind/src/VuFind/Config/AccountCapabilitiesFactory.php +++ b/module/VuFind/src/VuFind/Config/AccountCapabilitiesFactory.php @@ -62,8 +62,8 @@ class AccountCapabilitiesFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Config\PluginManager')->get('config'), - $container->get('VuFind\Auth\Manager') + $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Auth\Manager::class) ); } } diff --git a/module/VuFind/src/VuFind/Config/YamlReaderFactory.php b/module/VuFind/src/VuFind/Config/YamlReaderFactory.php index aa7c306e533..0e60f795be9 100644 --- a/module/VuFind/src/VuFind/Config/YamlReaderFactory.php +++ b/module/VuFind/src/VuFind/Config/YamlReaderFactory.php @@ -61,6 +61,6 @@ class YamlReaderFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\Cache\Manager')); + return new $requestedName($container->get(\VuFind\Cache\Manager::class)); } } diff --git a/module/VuFind/src/VuFind/Connection/RelaisFactory.php b/module/VuFind/src/VuFind/Connection/RelaisFactory.php index 13101eac959..03633ac9d93 100644 --- a/module/VuFind/src/VuFind/Connection/RelaisFactory.php +++ b/module/VuFind/src/VuFind/Connection/RelaisFactory.php @@ -61,9 +61,11 @@ class RelaisFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $url = $config->Relais->authenticateurl ?? null; - $client = $container->get('VuFindHttp\HttpService')->createClient($url); + $client = $container->get(\VuFindHttp\HttpService::class) + ->createClient($url); $client->setOptions(['timeout' => $config->Relais->timeout ?? 500]); return new $requestedName($client, $config->Relais ?? null); } diff --git a/module/VuFind/src/VuFind/Connection/WorldCatUtilsFactory.php b/module/VuFind/src/VuFind/Connection/WorldCatUtilsFactory.php index b38f8f6a435..dab9367fa5a 100644 --- a/module/VuFind/src/VuFind/Connection/WorldCatUtilsFactory.php +++ b/module/VuFind/src/VuFind/Connection/WorldCatUtilsFactory.php @@ -61,8 +61,9 @@ class WorldCatUtilsFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); - $client = $container->get('VuFindHttp\HttpService')->createClient(); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); + $client = $container->get(\VuFindHttp\HttpService::class)->createClient(); $ip = $container->get('Request')->getServer()->get('SERVER_ADDR'); return new $requestedName( isset($config->WorldCat) ? $config->WorldCat : null, diff --git a/module/VuFind/src/VuFind/Content/AbstractAmazonFactory.php b/module/VuFind/src/VuFind/Content/AbstractAmazonFactory.php index b094fba6277..ef30257554b 100644 --- a/module/VuFind/src/VuFind/Content/AbstractAmazonFactory.php +++ b/module/VuFind/src/VuFind/Content/AbstractAmazonFactory.php @@ -60,12 +60,13 @@ class AbstractAmazonFactory implements \Zend\ServiceManager\Factory\FactoryInter if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $associate = isset($config->Content->amazonassociate) ? $config->Content->amazonassociate : null; $secret = isset($config->Content->amazonsecret) ? $config->Content->amazonsecret : null; - $label = $container->get('Zend\Mvc\I18n\Translator')->translate( + $label = $container->get(\Zend\Mvc\I18n\Translator::class)->translate( 'Supplied by Amazon' ); return new $requestedName($associate, $secret, $label); diff --git a/module/VuFind/src/VuFind/Content/AbstractSyndeticsFactory.php b/module/VuFind/src/VuFind/Content/AbstractSyndeticsFactory.php index 3abb04f083c..d90b6857a1e 100644 --- a/module/VuFind/src/VuFind/Content/AbstractSyndeticsFactory.php +++ b/module/VuFind/src/VuFind/Content/AbstractSyndeticsFactory.php @@ -61,7 +61,8 @@ class AbstractSyndeticsFactory implements FactoryInterface if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); // Special case: if the class name ends in Plus, we need to strip off // the "Plus" and instead configure the base Syndetics class into "plus" diff --git a/module/VuFind/src/VuFind/Content/Covers/BrowZineFactory.php b/module/VuFind/src/VuFind/Content/Covers/BrowZineFactory.php index 8545902e064..fb96b4c3d2e 100644 --- a/module/VuFind/src/VuFind/Content/Covers/BrowZineFactory.php +++ b/module/VuFind/src/VuFind/Content/Covers/BrowZineFactory.php @@ -62,7 +62,8 @@ class BrowZineFactory implements \Zend\ServiceManager\Factory\FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $backend = $container->get('VuFind\Search\BackendManager')->get('BrowZine'); + $backend = $container->get(\VuFind\Search\BackendManager::class) + ->get('BrowZine'); return new $requestedName($backend->getConnector()); } } diff --git a/module/VuFind/src/VuFind/Content/Factory.php b/module/VuFind/src/VuFind/Content/Factory.php index b9c44e30e95..05b5502e07e 100644 --- a/module/VuFind/src/VuFind/Content/Factory.php +++ b/module/VuFind/src/VuFind/Content/Factory.php @@ -95,7 +95,8 @@ class Factory implements \Zend\ServiceManager\Factory\FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } $pm = $container->get($this->getPluginManagerServiceName($requestedName)); - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $setting = $this->getConfigSettingName($requestedName); $providers = $config->Content->$setting ?? ''; return new Loader($pm, $providers); diff --git a/module/VuFind/src/VuFind/Content/Reviews/BooksiteFactory.php b/module/VuFind/src/VuFind/Content/Reviews/BooksiteFactory.php index c2363e1846b..237c100dee4 100644 --- a/module/VuFind/src/VuFind/Content/Reviews/BooksiteFactory.php +++ b/module/VuFind/src/VuFind/Content/Reviews/BooksiteFactory.php @@ -60,7 +60,8 @@ class BooksiteFactory implements \Zend\ServiceManager\Factory\FactoryInterface if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $url = isset($config->Booksite->url) ? $config->Booksite->url : 'https://api.booksite.com'; if (!isset($config->Booksite->key)) { diff --git a/module/VuFind/src/VuFind/ContentBlock/BlockLoaderFactory.php b/module/VuFind/src/VuFind/ContentBlock/BlockLoaderFactory.php index 4ad84522ef7..9ce5f51b0f0 100644 --- a/module/VuFind/src/VuFind/ContentBlock/BlockLoaderFactory.php +++ b/module/VuFind/src/VuFind/ContentBlock/BlockLoaderFactory.php @@ -62,9 +62,9 @@ class BlockLoaderFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Search\Options\PluginManager'), - $container->get('VuFind\Config\PluginManager'), - $container->get('VuFind\ContentBlock\PluginManager') + $container->get(\VuFind\Search\Options\PluginManager::class), + $container->get(\VuFind\Config\PluginManager::class), + $container->get(\VuFind\ContentBlock\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/ContentBlock/ChannelsFactory.php b/module/VuFind/src/VuFind/ContentBlock/ChannelsFactory.php index 39cb267cc2d..2d102fd85bd 100644 --- a/module/VuFind/src/VuFind/ContentBlock/ChannelsFactory.php +++ b/module/VuFind/src/VuFind/ContentBlock/ChannelsFactory.php @@ -63,7 +63,7 @@ class ChannelsFactory implements FactoryInterface } return new $requestedName( $container->get('Request'), - $container->get('VuFind\ChannelProvider\ChannelLoader') + $container->get(\VuFind\ChannelProvider\ChannelLoader::class) ); } } diff --git a/module/VuFind/src/VuFind/ContentBlock/FacetListFactory.php b/module/VuFind/src/VuFind/ContentBlock/FacetListFactory.php index 573fd4dc9f6..1fa54226fe0 100644 --- a/module/VuFind/src/VuFind/ContentBlock/FacetListFactory.php +++ b/module/VuFind/src/VuFind/ContentBlock/FacetListFactory.php @@ -61,8 +61,8 @@ class FacetListFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $fcpm = $container->get('VuFind\Search\FacetCache\PluginManager'); - $cm = $container->get('VuFind\Config\PluginManager'); + $fcpm = $container->get(\VuFind\Search\FacetCache\PluginManager::class); + $cm = $container->get(\VuFind\Config\PluginManager::class); return new $requestedName($fcpm, $cm); } } diff --git a/module/VuFind/src/VuFind/Controller/AbstractBase.php b/module/VuFind/src/VuFind/Controller/AbstractBase.php index 1b617ab1c69..fdc729f9a73 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractBase.php +++ b/module/VuFind/src/VuFind/Controller/AbstractBase.php @@ -218,7 +218,7 @@ class AbstractBase extends AbstractActionController */ protected function getAuthManager() { - return $this->serviceLocator->get('VuFind\Auth\Manager'); + return $this->serviceLocator->get(\VuFind\Auth\Manager::class); } /** @@ -231,7 +231,7 @@ class AbstractBase extends AbstractActionController protected function getAuthorizationService() { return $this->serviceLocator - ->get('ZfcRbac\Service\AuthorizationService'); + ->get(\ZfcRbac\Service\AuthorizationService::class); } /** @@ -241,7 +241,7 @@ class AbstractBase extends AbstractActionController */ protected function getILSAuthenticator() { - return $this->serviceLocator->get('VuFind\Auth\ILSAuthenticator'); + return $this->serviceLocator->get(\VuFind\Auth\ILSAuthenticator::class); } /** @@ -368,7 +368,8 @@ class AbstractBase extends AbstractActionController */ public function getConfig($id = 'config') { - return $this->serviceLocator->get('VuFind\Config\PluginManager')->get($id); + return $this->serviceLocator->get(\VuFind\Config\PluginManager::class) + ->get($id); } /** @@ -378,7 +379,7 @@ class AbstractBase extends AbstractActionController */ public function getILS() { - return $this->serviceLocator->get('VuFind\ILS\Connection'); + return $this->serviceLocator->get(\VuFind\ILS\Connection::class); } /** @@ -388,7 +389,7 @@ class AbstractBase extends AbstractActionController */ public function getRecordLoader() { - return $this->serviceLocator->get('VuFind\Record\Loader'); + return $this->serviceLocator->get(\VuFind\Record\Loader::class); } /** @@ -398,7 +399,7 @@ class AbstractBase extends AbstractActionController */ public function getRecordCache() { - return $this->serviceLocator->get('VuFind\Record\Cache'); + return $this->serviceLocator->get(\VuFind\Record\Cache::class); } /** @@ -408,7 +409,7 @@ class AbstractBase extends AbstractActionController */ public function getRecordRouter() { - return $this->serviceLocator->get('VuFind\Record\Router'); + return $this->serviceLocator->get(\VuFind\Record\Router::class); } /** @@ -420,7 +421,7 @@ class AbstractBase extends AbstractActionController */ public function getTable($table) { - return $this->serviceLocator->get('VuFind\Db\Table\PluginManager') + return $this->serviceLocator->get(\VuFind\Db\Table\PluginManager::class) ->get($table); } @@ -531,7 +532,7 @@ class AbstractBase extends AbstractActionController */ protected function disableSessionWrites() { - $this->serviceLocator->get('VuFind\Session\Settings')->disableWrite(); + $this->serviceLocator->get(\VuFind\Session\Settings::class)->disableWrite(); } /** @@ -541,7 +542,7 @@ class AbstractBase extends AbstractActionController */ public function getSearchMemory() { - return $this->serviceLocator->get('VuFind\Search\Memory'); + return $this->serviceLocator->get(\VuFind\Search\Memory::class); } /** @@ -551,7 +552,8 @@ class AbstractBase extends AbstractActionController */ protected function commentsEnabled() { - $check = $this->serviceLocator->get('VuFind\Config\AccountCapabilities'); + $check = $this->serviceLocator + ->get(\VuFind\Config\AccountCapabilities::class); return $check->getCommentSetting() !== 'disabled'; } @@ -562,7 +564,8 @@ class AbstractBase extends AbstractActionController */ protected function listsEnabled() { - $check = $this->serviceLocator->get('VuFind\Config\AccountCapabilities'); + $check = $this->serviceLocator + ->get(\VuFind\Config\AccountCapabilities::class); return $check->getListSetting() !== 'disabled'; } @@ -573,7 +576,8 @@ class AbstractBase extends AbstractActionController */ protected function tagsEnabled() { - $check = $this->serviceLocator->get('VuFind\Config\AccountCapabilities'); + $check = $this->serviceLocator + ->get(\VuFind\Config\AccountCapabilities::class); return $check->getTagSetting() !== 'disabled'; } diff --git a/module/VuFind/src/VuFind/Controller/AbstractBaseWithConfigFactory.php b/module/VuFind/src/VuFind/Controller/AbstractBaseWithConfigFactory.php index 3da3fd398e5..b6a6f5c731f 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractBaseWithConfigFactory.php +++ b/module/VuFind/src/VuFind/Controller/AbstractBaseWithConfigFactory.php @@ -61,7 +61,8 @@ class AbstractBaseWithConfigFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($container, $config); } } diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php index 80fe11cd20a..0fe2f3041a0 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php +++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php @@ -198,7 +198,7 @@ class AbstractRecord extends AbstractBase // Save tags, if any: if ($tags = $this->params()->fromPost('tag')) { - $tagParser = $this->serviceLocator->get('VuFind\Tags'); + $tagParser = $this->serviceLocator->get(\VuFind\Tags::class); $driver->addTags($user, $tagParser->parse($tags)); $this->flashMessenger() ->addMessage(['msg' => 'add_tag_success'], 'success'); @@ -287,11 +287,11 @@ class AbstractRecord extends AbstractBase // Perform the save operation: $driver = $this->loadRecord(); $post = $this->getRequest()->getPost()->toArray(); - $tagParser = $this->serviceLocator->get('VuFind\Tags'); + $tagParser = $this->serviceLocator->get(\VuFind\Tags::class); $post['mytags'] = $tagParser->parse($post['mytags'] ?? ''); $favorites = $this->serviceLocator - ->get('VuFind\Favorites\FavoritesService'); + ->get(\VuFind\Favorites\FavoritesService::class); $results = $favorites->save($post, $user, $driver); // Display a success status message: @@ -415,7 +415,7 @@ class AbstractRecord extends AbstractBase $driver = $this->loadRecord(); // Create view - $mailer = $this->serviceLocator->get('VuFind\Mailer\Mailer'); + $mailer = $this->serviceLocator->get(\VuFind\Mailer\Mailer::class); $view = $this->createEmailViewModel( null, $mailer->getDefaultRecordSubject($driver) ); @@ -452,7 +452,8 @@ class AbstractRecord extends AbstractBase */ protected function smsEnabled() { - $check = $this->serviceLocator->get('VuFind\Config\AccountCapabilities'); + $check = $this->serviceLocator + ->get(\VuFind\Config\AccountCapabilities::class); return $check->getSmsSetting() !== 'disabled'; } @@ -472,7 +473,7 @@ class AbstractRecord extends AbstractBase $driver = $this->loadRecord(); // Load the SMS carrier list: - $sms = $this->serviceLocator->get('VuFind\SMS\SMSInterface'); + $sms = $this->serviceLocator->get(\VuFind\SMS\SMSInterface::class); $view = $this->createViewModel(); $view->carriers = $sms->getCarriers(); $view->validation = $sms->getValidationType(); @@ -527,7 +528,7 @@ class AbstractRecord extends AbstractBase $format = $this->params()->fromQuery('style'); // Display export menu if missing/invalid option - $export = $this->serviceLocator->get('VuFind\Export'); + $export = $this->serviceLocator->get(\VuFind\Export::class); if (empty($format) || !$export->recordSupportsFormat($driver, $format)) { if (!empty($format)) { $this->flashMessenger() @@ -658,7 +659,7 @@ class AbstractRecord extends AbstractBase { $driver = $this->loadRecord(); $request = $this->getRequest(); - $rtpm = $this->serviceLocator->get('VuFind\RecordTab\PluginManager'); + $rtpm = $this->serviceLocator->get(\VuFind\RecordTab\PluginManager::class); $details = $rtpm->getTabDetailsForRecord( $driver, $this->getRecordTabConfig(), $request, $this->fallbackDefaultTab diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php index 1127317d33f..e0c81e2e7e2 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php +++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php @@ -29,6 +29,7 @@ namespace VuFind\Controller; use VuFind\Search\RecommendListener; use VuFind\Solr\Utils as SolrUtils; +use Zend\Session\SessionManager; use Zend\Stdlib\Parameters; /** @@ -86,7 +87,8 @@ class AbstractSearch extends AbstractBase { $view = $this->createViewModel(); $view->options = $this->serviceLocator - ->get('VuFind\Search\Options\PluginManager')->get($this->searchClassId); + ->get(\VuFind\Search\Options\PluginManager::class) + ->get($this->searchClassId); if ($view->options->getAdvancedSearchAction() === false) { throw new \Exception('Advanced search not supported.'); } @@ -102,7 +104,7 @@ class AbstractSearch extends AbstractBase // to properly populate special controls on the advanced screen. if (!$view->saved && count($view->options->getDefaultFilters()) > 0) { $view->saved = $this->serviceLocator - ->get('VuFind\Search\Results\PluginManager') + ->get(\VuFind\Search\Results\PluginManager::class) ->get($this->searchClassId); $view->saved->getParams()->initFromRequest( new \Zend\StdLib\Parameters([]) @@ -214,7 +216,8 @@ class AbstractSearch extends AbstractBase return null; } - $rManager = $this->serviceLocator->get('VuFind\Recommend\PluginManager'); + $rManager = $this->serviceLocator + ->get(\VuFind\Recommend\PluginManager::class); // Special case: override recommend settings through parameter (used by // combined search) @@ -249,7 +252,7 @@ class AbstractSearch extends AbstractBase */ public function homeAction() { - $blocks = $this->serviceLocator->get('VuFind\ContentBlock\BlockLoader') + $blocks = $this->serviceLocator->get(\VuFind\ContentBlock\BlockLoader::class) ->getFromSearchClassId($this->searchClassId); return $this->createViewModel(compact('blocks')); } @@ -269,7 +272,7 @@ class AbstractSearch extends AbstractBase return $this->redirectToSavedSearch($savedId); } - $runner = $this->serviceLocator->get('VuFind\Search\SearchRunner'); + $runner = $this->serviceLocator->get(\VuFind\Search\SearchRunner::class); // Send both GET and POST variables to search class: $request = $this->getRequest()->getQuery()->toArray() @@ -319,7 +322,7 @@ class AbstractSearch extends AbstractBase } // Search toolbar - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('config'); $view->showBulkOptions = isset($config->Site->showBulkOptions) && $config->Site->showBulkOptions; @@ -339,7 +342,7 @@ class AbstractSearch extends AbstractBase { // Jump to only result, if configured $default = null; - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('config'); if (isset($config->Record->jump_to_single_search_result) && $config->Record->jump_to_single_search_result @@ -377,7 +380,7 @@ class AbstractSearch extends AbstractBase protected function retrieveSearchSecurely($searchId) { $searchTable = $this->getTable('Search'); - $sessId = $this->serviceLocator->get('Zend\Session\SessionManager')->getId(); + $sessId = $this->serviceLocator->get(SessionManager::class)->getId(); $user = $this->getUser(); $userId = $user ? $user->id : null; return $searchTable->getOwnedRowById($searchId, $sessId, $userId); @@ -393,7 +396,7 @@ class AbstractSearch extends AbstractBase protected function saveSearchToHistory($results) { $user = $this->getUser(); - $sessId = $this->serviceLocator->get('Zend\Session\SessionManager')->getId(); + $sessId = $this->serviceLocator->get(SessionManager::class)->getId(); $history = $this->getTable('Search'); $history->saveSearch( $this->getResultsManager(), $results, $sessId, @@ -447,7 +450,8 @@ class AbstractSearch extends AbstractBase */ protected function getResultsManager() { - return $this->serviceLocator->get('VuFind\Search\Results\PluginManager'); + return $this->serviceLocator + ->get(\VuFind\Search\Results\PluginManager::class); } /** @@ -507,7 +511,7 @@ class AbstractSearch extends AbstractBase */ protected function getRangeFieldList($config, $section, $filter) { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get($config); $fields = isset($config->SpecialFacets->$section) ? $config->SpecialFacets->$section->toArray() : []; @@ -661,7 +665,7 @@ class AbstractSearch extends AbstractBase $section = $params[1] ?? 'CheckboxFacets'; // Load config file: - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get($config); // Process checkbox settings in config: @@ -720,7 +724,7 @@ class AbstractSearch extends AbstractBase ? 'count' : current(array_keys($facetSortOptions)); } - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get($options->getFacetsIni()); $limit = isset($config->Results_Settings->lightboxLimit) ? $config->Results_Settings->lightboxLimit diff --git a/module/VuFind/src/VuFind/Controller/AbstractSolrSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSolrSearch.php index 9aa07b0910b..9b278161ae7 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractSolrSearch.php +++ b/module/VuFind/src/VuFind/Controller/AbstractSolrSearch.php @@ -50,7 +50,7 @@ class AbstractSolrSearch extends AbstractSearch // Set up facet information: $facets = $this->serviceLocator - ->get('VuFind\Search\FacetCache\PluginManager') + ->get(\VuFind\Search\FacetCache\PluginManager::class) ->get($this->searchClassId) ->getList('Advanced'); $view->hierarchicalFacets @@ -129,7 +129,7 @@ class AbstractSolrSearch extends AbstractSearch $facetHelper = null; if (!empty($hierarchicalFacets)) { $facetHelper = $this->serviceLocator - ->get('VuFind\Search\Solr\HierarchicalFacetHelper'); + ->get(\VuFind\Search\Solr\HierarchicalFacetHelper::class); } foreach ($facetList as $facet => &$list) { // Hierarchical facets: format display texts and sort facets diff --git a/module/VuFind/src/VuFind/Controller/AjaxControllerFactory.php b/module/VuFind/src/VuFind/Controller/AjaxControllerFactory.php index 4055fa902ac..ab0daac6bcc 100644 --- a/module/VuFind/src/VuFind/Controller/AjaxControllerFactory.php +++ b/module/VuFind/src/VuFind/Controller/AjaxControllerFactory.php @@ -61,7 +61,7 @@ class AjaxControllerFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $pm = $container->get('VuFind\AjaxHandler\PluginManager'); + $pm = $container->get(\VuFind\AjaxHandler\PluginManager::class); return new $requestedName($pm); } } diff --git a/module/VuFind/src/VuFind/Controller/AlmaController.php b/module/VuFind/src/VuFind/Controller/AlmaController.php index 555d088cbc1..32d3864ff7c 100644 --- a/module/VuFind/src/VuFind/Controller/AlmaController.php +++ b/module/VuFind/src/VuFind/Controller/AlmaController.php @@ -372,7 +372,7 @@ class AlmaController extends AbstractBase ] ); // Send the email - $this->serviceLocator->get('VuFind\Mailer\Mailer')->send( + $this->serviceLocator->get(\VuFind\Mailer\Mailer::class)->send( $user->email, $config->Site->email, $this->translate( 'new_user_welcome_subject', diff --git a/module/VuFind/src/VuFind/Controller/AlphabrowseController.php b/module/VuFind/src/VuFind/Controller/AlphabrowseController.php index 4d9229d256d..dda555b45f0 100644 --- a/module/VuFind/src/VuFind/Controller/AlphabrowseController.php +++ b/module/VuFind/src/VuFind/Controller/AlphabrowseController.php @@ -95,7 +95,7 @@ class AlphabrowseController extends AbstractBase ? (int)$config->AlphaBrowse->page_size : 20; // Connect to Solr: - $db = $this->serviceLocator->get('VuFind\Search\BackendManager') + $db = $this->serviceLocator->get(\VuFind\Search\BackendManager::class) ->get('Solr'); // Process incoming parameters: diff --git a/module/VuFind/src/VuFind/Controller/AuthorController.php b/module/VuFind/src/VuFind/Controller/AuthorController.php index e659071771e..33beb4c640a 100644 --- a/module/VuFind/src/VuFind/Controller/AuthorController.php +++ b/module/VuFind/src/VuFind/Controller/AuthorController.php @@ -106,7 +106,7 @@ class AuthorController extends AbstractSearch */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('config'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/AuthorityController.php b/module/VuFind/src/VuFind/Controller/AuthorityController.php index d560c24ce3e..d100c7f8b18 100644 --- a/module/VuFind/src/VuFind/Controller/AuthorityController.php +++ b/module/VuFind/src/VuFind/Controller/AuthorityController.php @@ -78,11 +78,11 @@ class AuthorityController extends AbstractSearch $id = $this->params()->fromQuery('id'); $cfg = $this->serviceLocator->get('Config'); $tabConfig = $cfg['vufind']['recorddriver_tabs']; - $driver = $this->serviceLocator->get('VuFind\Record\Loader') + $driver = $this->serviceLocator->get(\VuFind\Record\Loader::class) ->load($id, 'SolrAuth'); $request = $this->getRequest(); $tabs = $this->serviceLocator - ->get('VuFind\RecordTab\PluginManager') + ->get(\VuFind\RecordTab\PluginManager::class) ->getTabsForRecord($driver, $tabConfig, $request); return $this->createViewModel(['driver' => $driver, 'tabs' => $tabs]); } diff --git a/module/VuFind/src/VuFind/Controller/BrowseController.php b/module/VuFind/src/VuFind/Controller/BrowseController.php index 09a1bb2f14f..84b5cab233b 100644 --- a/module/VuFind/src/VuFind/Controller/BrowseController.php +++ b/module/VuFind/src/VuFind/Controller/BrowseController.php @@ -596,7 +596,7 @@ class BrowseController extends AbstractBase $sort = 'count', $query = '[* TO *]' ) { $results = $this->serviceLocator - ->get('VuFind\Search\Results\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Results\PluginManager::class)->get('Solr'); $params = $results->getParams(); $params->addFacet($facet); if ($category != null) { diff --git a/module/VuFind/src/VuFind/Controller/CartController.php b/module/VuFind/src/VuFind/Controller/CartController.php index db97500faf4..ba1ee787d90 100644 --- a/module/VuFind/src/VuFind/Controller/CartController.php +++ b/module/VuFind/src/VuFind/Controller/CartController.php @@ -69,7 +69,7 @@ class CartController extends AbstractBase */ protected function getCart() { - return $this->serviceLocator->get('VuFind\Cart'); + return $this->serviceLocator->get(\VuFind\Cart::class); } /** @@ -270,7 +270,7 @@ class CartController extends AbstractBase // Attempt to send the email and show an appropriate flash message: try { // If we got this far, we're ready to send the email: - $mailer = $this->serviceLocator->get('VuFind\Mailer\Mailer'); + $mailer = $this->serviceLocator->get(\VuFind\Mailer\Mailer::class); $mailer->setMaxRecipients($view->maxRecipients); $cc = $this->params()->fromPost('ccself') && $view->from != $view->to ? $view->from : null; @@ -315,7 +315,7 @@ class CartController extends AbstractBase */ protected function getExport() { - return $this->serviceLocator->get('VuFind\Export'); + return $this->serviceLocator->get(\VuFind\Export::class); } /** diff --git a/module/VuFind/src/VuFind/Controller/CartControllerFactory.php b/module/VuFind/src/VuFind/Controller/CartControllerFactory.php index 776eaea2ec1..bb56f89a8b9 100644 --- a/module/VuFind/src/VuFind/Controller/CartControllerFactory.php +++ b/module/VuFind/src/VuFind/Controller/CartControllerFactory.php @@ -62,7 +62,7 @@ class CartControllerFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } $session = new \Zend\Session\Container( - 'cart_followup', $container->get('Zend\Session\SessionManager') + 'cart_followup', $container->get(\Zend\Session\SessionManager::class) ); return new $requestedName($container, $session); } diff --git a/module/VuFind/src/VuFind/Controller/ChannelsControllerFactory.php b/module/VuFind/src/VuFind/Controller/ChannelsControllerFactory.php index 72fb8015b47..d3ca628582e 100644 --- a/module/VuFind/src/VuFind/Controller/ChannelsControllerFactory.php +++ b/module/VuFind/src/VuFind/Controller/ChannelsControllerFactory.php @@ -61,7 +61,7 @@ class ChannelsControllerFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $loader = $container->get('VuFind\ChannelProvider\ChannelLoader'); + $loader = $container->get(\VuFind\ChannelProvider\ChannelLoader::class); return new $requestedName($loader); } } diff --git a/module/VuFind/src/VuFind/Controller/CollectionController.php b/module/VuFind/src/VuFind/Controller/CollectionController.php index e2848e13e14..959f1ef839f 100644 --- a/module/VuFind/src/VuFind/Controller/CollectionController.php +++ b/module/VuFind/src/VuFind/Controller/CollectionController.php @@ -99,7 +99,7 @@ class CollectionController extends AbstractRecord */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('config'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/CollectionsController.php b/module/VuFind/src/VuFind/Controller/CollectionsController.php index 7055802642a..b485360810a 100644 --- a/module/VuFind/src/VuFind/Controller/CollectionsController.php +++ b/module/VuFind/src/VuFind/Controller/CollectionsController.php @@ -116,7 +116,7 @@ class CollectionsController extends AbstractBase $limit = $this->getBrowseLimit(); // Load Solr data or die trying: - $db = $this->serviceLocator->get('VuFind\Search\BackendManager') + $db = $this->serviceLocator->get(\VuFind\Search\BackendManager::class) ->get('Solr'); $result = $db->alphabeticBrowse($source, $from, $page, $limit); @@ -174,7 +174,7 @@ class CollectionsController extends AbstractBase $browseField = "hierarchy_browse"; $searchObject = $this->serviceLocator - ->get('VuFind\Search\Results\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Results\PluginManager::class)->get('Solr'); foreach ($appliedFilters as $filter) { $searchObject->getParams()->addFilter($filter); } @@ -337,7 +337,7 @@ class CollectionsController extends AbstractBase { $title = addcslashes($title, '"'); $query = new Query("is_hierarchy_title:\"$title\"", 'AllFields'); - $searchService = $this->serviceLocator->get('VuFindSearch\Service'); + $searchService = $this->serviceLocator->get(\VuFindSearch\Service::class); $result = $searchService->search('Solr', $query, 0, $this->getBrowseLimit()); return $result->getRecords(); } diff --git a/module/VuFind/src/VuFind/Controller/CombinedController.php b/module/VuFind/src/VuFind/Controller/CombinedController.php index 6c8351d5fc9..b58638bffe5 100644 --- a/module/VuFind/src/VuFind/Controller/CombinedController.php +++ b/module/VuFind/src/VuFind/Controller/CombinedController.php @@ -27,6 +27,7 @@ */ namespace VuFind\Controller; +use VuFind\Search\SearchRunner; use Zend\ServiceManager\ServiceLocatorInterface; /** @@ -62,7 +63,7 @@ class CombinedController extends AbstractSearch { // We need to load blocks differently in this controller since it // doesn't follow the usual configuration pattern. - $blocks = $this->serviceLocator->get('VuFind\ContentBlock\BlockLoader') + $blocks = $this->serviceLocator->get(\VuFind\ContentBlock\BlockLoader::class) ->getFromConfig('combined'); return $this->createViewModel(compact('blocks')); } @@ -81,7 +82,7 @@ class CombinedController extends AbstractSearch // Validate configuration: $sectionId = $this->params()->fromQuery('id'); - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('combined')->toArray(); $tabConfig = $this->getTabConfig($config); if (!isset($tabConfig[$sectionId])) { @@ -91,7 +92,7 @@ class CombinedController extends AbstractSearch // Retrieve results: $options = $this->serviceLocator - ->get('VuFind\Search\Options\PluginManager'); + ->get(\VuFind\Search\Options\PluginManager::class); $currentOptions = $options->get($searchClassId); list($controller, $action) = explode('-', $currentOptions->getSearchAction()); @@ -106,8 +107,9 @@ class CombinedController extends AbstractSearch ) { $html = ''; } else { - $cart = $this->serviceLocator->get('VuFind\Cart'); - $general = $this->serviceLocator->get('VuFind\Config\PluginManager') + $cart = $this->serviceLocator->get(\VuFind\Cart::class); + $general = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class) ->get('config'); $viewParams = [ 'searchClassId' => $searchClassId, @@ -139,7 +141,7 @@ class CombinedController extends AbstractSearch // Set up current request context: $request = $this->getRequest()->getQuery()->toArray() + $this->getRequest()->getPost()->toArray(); - $results = $this->serviceLocator->get('VuFind\Search\SearchRunner')->run( + $results = $this->serviceLocator->get(SearchRunner::class)->run( $request, 'Combined', $this->getSearchSetupCallback() ); @@ -151,8 +153,8 @@ class CombinedController extends AbstractSearch // Gather combined results: $combinedResults = []; $options = $this->serviceLocator - ->get('VuFind\Search\Options\PluginManager'); - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + ->get(\VuFind\Search\Options\PluginManager::class); + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('combined')->toArray(); $supportsCart = false; $supportsCartOptions = []; @@ -199,7 +201,7 @@ class CombinedController extends AbstractSearch } // Get default config for showBulkOptions - $settings = $this->serviceLocator->get('VuFind\Config\PluginManager') + $settings = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('config'); // Build view model: @@ -240,7 +242,7 @@ class CombinedController extends AbstractSearch unset($params['activeSearchClassId']); // don't need to pass this forward $route = $this->serviceLocator - ->get('VuFind\Search\Options\PluginManager') + ->get(\VuFind\Search\Options\PluginManager::class) ->get($searchClassId)->getSearchAction(); $base = $this->url()->fromRoute($route); return $this->redirect()->toUrl($base . '?' . http_build_query($params)); diff --git a/module/VuFind/src/VuFind/Controller/ContentController.php b/module/VuFind/src/VuFind/Controller/ContentController.php index 85b9de46d43..0c49d0d5ecc 100644 --- a/module/VuFind/src/VuFind/Controller/ContentController.php +++ b/module/VuFind/src/VuFind/Controller/ContentController.php @@ -50,8 +50,8 @@ class ContentController extends AbstractBase public function contentAction() { $page = $this->params()->fromRoute('page'); - $themeInfo = $this->serviceLocator->get('VuFindTheme\ThemeInfo'); - $language = $this->serviceLocator->get('Zend\Mvc\I18n\Translator') + $themeInfo = $this->serviceLocator->get(\VuFindTheme\ThemeInfo::class); + $language = $this->serviceLocator->get(\Zend\Mvc\I18n\Translator::class) ->getLocale(); $defaultLanguage = $this->getConfig()->Site->language; diff --git a/module/VuFind/src/VuFind/Controller/CoverControllerFactory.php b/module/VuFind/src/VuFind/Controller/CoverControllerFactory.php index 26de632cd2a..6ae4ab36cbc 100644 --- a/module/VuFind/src/VuFind/Controller/CoverControllerFactory.php +++ b/module/VuFind/src/VuFind/Controller/CoverControllerFactory.php @@ -62,9 +62,9 @@ class CoverControllerFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Cover\Loader'), - $container->get('VuFind\Cover\CachingProxy'), - $container->get('VuFind\Session\Settings') + $container->get(\VuFind\Cover\Loader::class), + $container->get(\VuFind\Cover\CachingProxy::class), + $container->get(\VuFind\Session\Settings::class) ); } } diff --git a/module/VuFind/src/VuFind/Controller/EITController.php b/module/VuFind/src/VuFind/Controller/EITController.php index b38f4dfd7e6..b083bf6133d 100644 --- a/module/VuFind/src/VuFind/Controller/EITController.php +++ b/module/VuFind/src/VuFind/Controller/EITController.php @@ -59,7 +59,7 @@ class EITController extends AbstractSearch */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('EIT'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/EITrecordController.php b/module/VuFind/src/VuFind/Controller/EITrecordController.php index 5bab5335611..902d58919df 100644 --- a/module/VuFind/src/VuFind/Controller/EITrecordController.php +++ b/module/VuFind/src/VuFind/Controller/EITrecordController.php @@ -66,7 +66,7 @@ class EITrecordController extends AbstractRecord */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('EIT'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/EdsController.php b/module/VuFind/src/VuFind/Controller/EdsController.php index cb49ea2d27e..f8fbbfee14e 100644 --- a/module/VuFind/src/VuFind/Controller/EdsController.php +++ b/module/VuFind/src/VuFind/Controller/EdsController.php @@ -59,7 +59,7 @@ class EdsController extends AbstractSearch */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('EDS'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/EdsrecordController.php b/module/VuFind/src/VuFind/Controller/EdsrecordController.php index 526588c36ff..f78ba6c2d18 100644 --- a/module/VuFind/src/VuFind/Controller/EdsrecordController.php +++ b/module/VuFind/src/VuFind/Controller/EdsrecordController.php @@ -82,7 +82,7 @@ class EdsrecordController extends AbstractRecord */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('EDS'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/ExternalAuthController.php b/module/VuFind/src/VuFind/Controller/ExternalAuthController.php index 65a646c199e..0de5b2046ed 100644 --- a/module/VuFind/src/VuFind/Controller/ExternalAuthController.php +++ b/module/VuFind/src/VuFind/Controller/ExternalAuthController.php @@ -68,11 +68,11 @@ class ExternalAuthController extends AbstractBase implements LoggerAwareInterfac $user = $this->getUser(); $authService = $this->serviceLocator - ->get('ZfcRbac\Service\AuthorizationService'); + ->get(\ZfcRbac\Service\AuthorizationService::class); if ($authService->isGranted($this->ezproxyRequiredPermission)) { // Access granted, redirect to EZproxy if (empty($config->EZproxy->disable_ticket_auth_logging)) { - $logger = $this->serviceLocator->get('VuFind\Logger'); + $logger = $this->serviceLocator->get(\VuFind\Logger::class); $logger->log( \Zend\Log\Logger::INFO, "EZproxy login to '" . $config->EZproxy->host diff --git a/module/VuFind/src/VuFind/Controller/FeedbackController.php b/module/VuFind/src/VuFind/Controller/FeedbackController.php index 7251b3b5399..41cd71c232e 100644 --- a/module/VuFind/src/VuFind/Controller/FeedbackController.php +++ b/module/VuFind/src/VuFind/Controller/FeedbackController.php @@ -54,7 +54,7 @@ class FeedbackController extends AbstractBase $user = $this->getUser(); - $form = $this->serviceLocator->get('VuFind\Form\Form'); + $form = $this->serviceLocator->get(\VuFind\Form\Form::class); $form->setFormId($formId); if (!$form->isEnabled()) { @@ -148,7 +148,7 @@ class FeedbackController extends AbstractBase $replyToName, $replyToEmail, $emailSubject, $emailMessage ) { try { - $mailer = $this->serviceLocator->get('VuFind\Mailer\Mailer'); + $mailer = $this->serviceLocator->get(\VuFind\Mailer\Mailer::class); if ($replyToEmail) { $mailer->setFromAddressOverride(''); } diff --git a/module/VuFind/src/VuFind/Controller/HierarchyController.php b/module/VuFind/src/VuFind/Controller/HierarchyController.php index c99b5edce38..aeb1a26767f 100644 --- a/module/VuFind/src/VuFind/Controller/HierarchyController.php +++ b/module/VuFind/src/VuFind/Controller/HierarchyController.php @@ -90,7 +90,7 @@ class HierarchyController extends AbstractBase $searchType = $this->params()->fromQuery('type', 'AllFields'); $results = $this->serviceLocator - ->get('VuFind\Search\Results\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Results\PluginManager::class)->get('Solr'); $results->getParams()->setBasicSearch($lookfor, $searchType); $results->getParams()->addFilter('hierarchy_top_id:' . $hierarchyID); $facets = $results->getFullFieldFacets(['id'], false, $limit + 1); @@ -120,7 +120,7 @@ class HierarchyController extends AbstractBase $this->disableSessionWrites(); // avoid session write timing bug // Retrieve the record from the index $id = $this->params()->fromQuery('id'); - $loader = $this->serviceLocator->get('VuFind\Record\Loader'); + $loader = $this->serviceLocator->get(\VuFind\Record\Loader::class); try { if ($recordDriver = $loader->load($id)) { $results = $recordDriver->getHierarchyDriver()->render( @@ -153,7 +153,7 @@ class HierarchyController extends AbstractBase $this->disableSessionWrites(); // avoid session write timing bug // Retrieve the record from the index $id = $this->params()->fromQuery('id'); - $loader = $this->serviceLocator->get('VuFind\Record\Loader'); + $loader = $this->serviceLocator->get(\VuFind\Record\Loader::class); try { if ($recordDriver = $loader->load($id)) { $results = $recordDriver->getHierarchyDriver() @@ -183,7 +183,7 @@ class HierarchyController extends AbstractBase public function getrecordAction() { $id = $this->params()->fromQuery('id'); - $loader = $this->serviceLocator->get('VuFind\Record\Loader'); + $loader = $this->serviceLocator->get(\VuFind\Record\Loader::class); try { $record = $loader->load($id); $result = $this->getViewRenderer()->record($record) diff --git a/module/VuFind/src/VuFind/Controller/HoldsTrait.php b/module/VuFind/src/VuFind/Controller/HoldsTrait.php index e1081430708..62be332f82a 100644 --- a/module/VuFind/src/VuFind/Controller/HoldsTrait.php +++ b/module/VuFind/src/VuFind/Controller/HoldsTrait.php @@ -165,7 +165,7 @@ trait HoldsTrait $defaultRequired = $this->holds()->getDefaultRequiredDate( $checkHolds, $catalog, $patron, $gatheredDetails ); - $defaultRequired = $this->serviceLocator->get('VuFind\Date\Converter') + $defaultRequired = $this->serviceLocator->get(\VuFind\Date\Converter::class) ->convertToDisplayDate("U", $defaultRequired); try { $defaultPickup diff --git a/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php b/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php index b06d691ea1d..ff2fb133c3a 100644 --- a/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php +++ b/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php @@ -132,7 +132,7 @@ trait ILLRequestsTrait // Find and format the default required date: $defaultRequired = $this->ILLRequests() ->getDefaultRequiredDate($checkRequests); - $defaultRequired = $this->serviceLocator->get('VuFind\Date\Converter') + $defaultRequired = $this->serviceLocator->get(\VuFind\Date\Converter::class) ->convertToDisplayDate("U", $defaultRequired); // Get pickup libraries diff --git a/module/VuFind/src/VuFind/Controller/IndexControllerFactory.php b/module/VuFind/src/VuFind/Controller/IndexControllerFactory.php index 40d94a426b4..96f80558c56 100644 --- a/module/VuFind/src/VuFind/Controller/IndexControllerFactory.php +++ b/module/VuFind/src/VuFind/Controller/IndexControllerFactory.php @@ -61,8 +61,9 @@ class IndexControllerFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); - $authManager = $container->get('VuFind\Auth\Manager'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); + $authManager = $container->get(\VuFind\Auth\Manager::class); return new $requestedName($config, $authManager); } } diff --git a/module/VuFind/src/VuFind/Controller/InstallController.php b/module/VuFind/src/VuFind/Controller/InstallController.php index 0bbd22c2a4a..2408da17897 100644 --- a/module/VuFind/src/VuFind/Controller/InstallController.php +++ b/module/VuFind/src/VuFind/Controller/InstallController.php @@ -166,7 +166,7 @@ class InstallController extends AbstractBase */ protected function checkCache() { - $cache = $this->serviceLocator->get('VuFind\Cache\Manager'); + $cache = $this->serviceLocator->get(\VuFind\Cache\Manager::class); return [ 'title' => 'Cache', 'status' => !$cache->hasDirectoryCreationError(), @@ -181,7 +181,7 @@ class InstallController extends AbstractBase */ public function fixcacheAction() { - $cache = $this->serviceLocator->get('VuFind\Cache\Manager'); + $cache = $this->serviceLocator->get(\VuFind\Cache\Manager::class); $view = $this->createViewModel(); $view->cacheDir = $cache->getCacheDir(); if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) { @@ -355,7 +355,8 @@ class InstallController extends AbstractBase try { $dbName = ($view->driver == 'pgsql') ? 'template1' : $view->driver; - $db = $this->serviceLocator->get('VuFind\Db\AdapterFactory') + $db = $this->serviceLocator + ->get(\VuFind\Db\AdapterFactory::class) ->getAdapterFromConnectionString("{$connection}/{$dbName}"); } catch (\Exception $e) { $this->flashMessenger() @@ -392,7 +393,7 @@ class InstallController extends AbstractBase $db->query($query, $db::QUERY_MODE_EXECUTE); } $dbFactory = $this->serviceLocator - ->get('VuFind\Db\AdapterFactory'); + ->get(\VuFind\Db\AdapterFactory::class); $db = $dbFactory->getAdapterFromConnectionString( $connection . '/' . $view->dbname ); @@ -586,7 +587,7 @@ class InstallController extends AbstractBase protected function testSearchService() { // Try to retrieve an arbitrary ID -- this will fail if Solr is down: - $searchService = $this->serviceLocator->get('VuFindSearch\Service'); + $searchService = $this->serviceLocator->get(\VuFindSearch\Service::class); $searchService->retrieve('Solr', '1'); } @@ -801,7 +802,7 @@ class InstallController extends AbstractBase { // Try to retrieve an SSL URL; if we're misconfigured, it will fail. try { - $this->serviceLocator->get('VuFindHttp\HttpService') + $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->get('https://google.com'); $status = true; } catch (\VuFindHttp\Exception\RuntimeException $e) { diff --git a/module/VuFind/src/VuFind/Controller/LibGuidesController.php b/module/VuFind/src/VuFind/Controller/LibGuidesController.php index a31fa3c6bf3..9230d58ca49 100644 --- a/module/VuFind/src/VuFind/Controller/LibGuidesController.php +++ b/module/VuFind/src/VuFind/Controller/LibGuidesController.php @@ -58,7 +58,7 @@ class LibGuidesController extends AbstractSearch */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('LibGuides'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php index 937a691131c..9c924a087a1 100644 --- a/module/VuFind/src/VuFind/Controller/MyResearchController.php +++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php @@ -363,7 +363,8 @@ class MyResearchController extends AbstractBase protected function setSavedFlagSecurely($searchId, $saved, $userId) { $searchTable = $this->getTable('Search'); - $sessId = $this->serviceLocator->get('Zend\Session\SessionManager')->getId(); + $sessId = $this->serviceLocator + ->get(\Zend\Session\SessionManager::class)->getId(); $row = $searchTable->getOwnedRowById($searchId, $sessId, $userId); if (empty($row)) { throw new ForbiddenException('Access denied.'); @@ -381,7 +382,8 @@ class MyResearchController extends AbstractBase public function savesearchAction() { // Fail if saved searches are disabled. - $check = $this->serviceLocator->get('VuFind\Config\AccountCapabilities'); + $check = $this->serviceLocator + ->get(\VuFind\Config\AccountCapabilities::class); if ($check->getSavedSearchSetting() === 'disabled') { throw new ForbiddenException('Saved searches disabled.'); } @@ -624,9 +626,9 @@ class MyResearchController extends AbstractBase protected function processEditSubmit($user, $driver, $listID) { $lists = $this->params()->fromPost('lists', []); - $tagParser = $this->serviceLocator->get('VuFind\Tags'); + $tagParser = $this->serviceLocator->get(\VuFind\Tags::class); $favorites = $this->serviceLocator - ->get('VuFind\Favorites\FavoritesService'); + ->get(\VuFind\Favorites\FavoritesService::class); $didSomething = false; foreach ($lists as $list) { $tags = $this->params()->fromPost('tags' . $list); @@ -786,7 +788,7 @@ class MyResearchController extends AbstractBase // If we got this far, we just need to display the favorites: try { - $runner = $this->serviceLocator->get('VuFind\Search\SearchRunner'); + $runner = $this->serviceLocator->get(\VuFind\Search\SearchRunner::class); // We want to merge together GET, POST and route parameters to // initialize our search object: @@ -796,7 +798,7 @@ class MyResearchController extends AbstractBase // Set up listener for recommendations: $rManager = $this->serviceLocator - ->get('VuFind\Recommend\PluginManager'); + ->get(\VuFind\Recommend\PluginManager::class); $setupCallback = function ($runner, $params, $searchId) use ($rManager) { $listener = new RecommendListener($rManager, $searchId); $listener->setConfig( @@ -986,7 +988,7 @@ class MyResearchController extends AbstractBase { $id = $current['id'] ?? ''; $source = $current['source'] ?? DEFAULT_SEARCH_BACKEND; - $record = $this->serviceLocator->get('VuFind\Record\Loader') + $record = $this->serviceLocator->get(\VuFind\Record\Loader::class) ->load($id, $source, true); $record->setExtraDetail('ils_details', $current); return $record; @@ -1359,7 +1361,8 @@ class MyResearchController extends AbstractBase if (strlen($row['id'] ?? '') > 0) { $source = $row['source'] ?? DEFAULT_SEARCH_BACKEND; $row['driver'] = $this->serviceLocator - ->get('VuFind\Record\Loader')->load($row['id'], $source); + ->get(\VuFind\Record\Loader::class) + ->load($row['id'], $source); if (empty($row['title'])) { $row['title'] = $row['driver']->getShortTitle(); } @@ -1468,7 +1471,7 @@ class MyResearchController extends AbstractBase . $user->verify_hash . '&auth_method=' . $method ] ); - $this->serviceLocator->get('VuFind\Mailer\Mailer')->send( + $this->serviceLocator->get(\VuFind\Mailer\Mailer::class)->send( $user->email, $config->Site->email, $this->translate('recovery_email_subject'), @@ -1697,7 +1700,7 @@ class MyResearchController extends AbstractBase $view = $this->createViewModel(['accountDeleted' => false]); if ($this->formWasSubmitted('submit')) { - $csrf = $this->serviceLocator->get('VuFind\Validator\Csrf'); + $csrf = $this->serviceLocator->get(\VuFind\Validator\Csrf::class); if (!$csrf->isValid($this->getRequest()->getPost()->get('csrf'))) { throw new \VuFind\Exception\BadRequest( 'error_inconsistent_parameters' diff --git a/module/VuFind/src/VuFind/Controller/OaiController.php b/module/VuFind/src/VuFind/Controller/OaiController.php index 5e53f01b7e0..23df0700cde 100644 --- a/module/VuFind/src/VuFind/Controller/OaiController.php +++ b/module/VuFind/src/VuFind/Controller/OaiController.php @@ -27,6 +27,9 @@ */ namespace VuFind\Controller; +use VuFind\Search\Results\PluginManager as ResultsManager; +use VuFindApi\Formatter\RecordFormatter; + /** * OAIController Class * @@ -100,16 +103,16 @@ class OaiController extends AbstractBase $this->getRequest()->getPost()->toArray() ); $server = new $serverClass( - $this->serviceLocator->get('VuFind\Search\Results\PluginManager'), - $this->serviceLocator->get('VuFind\Record\Loader'), - $this->serviceLocator->get('VuFind\Db\Table\PluginManager'), + $this->serviceLocator->get(ResultsManager::class), + $this->serviceLocator->get(\VuFind\Record\Loader::class), + $this->serviceLocator->get(\VuFind\Db\Table\PluginManager::class), $config, $baseURL, $params ); $server->setRecordLinkHelper( $this->getViewRenderer()->plugin('recordLink') ); $server->setRecordFormatter( - $this->serviceLocator->get('VuFindApi\Formatter\RecordFormatter') + $this->serviceLocator->get(RecordFormatter::class) ); $xml = $server->getResponse(); } catch (\Exception $e) { diff --git a/module/VuFind/src/VuFind/Controller/PrimoController.php b/module/VuFind/src/VuFind/Controller/PrimoController.php index f511f36cdf6..af967111e14 100644 --- a/module/VuFind/src/VuFind/Controller/PrimoController.php +++ b/module/VuFind/src/VuFind/Controller/PrimoController.php @@ -59,7 +59,7 @@ class PrimoController extends AbstractSearch */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('Primo'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/PrimorecordController.php b/module/VuFind/src/VuFind/Controller/PrimorecordController.php index c34d535f9ae..b4ed476697e 100644 --- a/module/VuFind/src/VuFind/Controller/PrimorecordController.php +++ b/module/VuFind/src/VuFind/Controller/PrimorecordController.php @@ -63,7 +63,7 @@ class PrimorecordController extends AbstractRecord */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('Primo'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/QRCodeControllerFactory.php b/module/VuFind/src/VuFind/Controller/QRCodeControllerFactory.php index dc3051698f5..16a196dd642 100644 --- a/module/VuFind/src/VuFind/Controller/QRCodeControllerFactory.php +++ b/module/VuFind/src/VuFind/Controller/QRCodeControllerFactory.php @@ -62,8 +62,8 @@ class QRCodeControllerFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\QRCode\Loader'), - $container->get('VuFind\Session\Settings') + $container->get(\VuFind\QRCode\Loader::class), + $container->get(\VuFind\Session\Settings::class) ); } } diff --git a/module/VuFind/src/VuFind/Controller/RecordController.php b/module/VuFind/src/VuFind/Controller/RecordController.php index a44027b1dd2..f7c7ffa5a08 100644 --- a/module/VuFind/src/VuFind/Controller/RecordController.php +++ b/module/VuFind/src/VuFind/Controller/RecordController.php @@ -68,7 +68,7 @@ class RecordController extends AbstractRecord */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('config'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/Search2Controller.php b/module/VuFind/src/VuFind/Controller/Search2Controller.php index c7b3907ac76..00a3d40935d 100644 --- a/module/VuFind/src/VuFind/Controller/Search2Controller.php +++ b/module/VuFind/src/VuFind/Controller/Search2Controller.php @@ -59,7 +59,7 @@ class Search2Controller extends AbstractSolrSearch */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config') + $config = $this->serviceLocator->get(\VuFind\Config::class) ->get('Search2'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/Search2recordController.php b/module/VuFind/src/VuFind/Controller/Search2recordController.php index 479ead7f1ed..d6198b5f55f 100644 --- a/module/VuFind/src/VuFind/Controller/Search2recordController.php +++ b/module/VuFind/src/VuFind/Controller/Search2recordController.php @@ -60,7 +60,7 @@ class Search2recordController extends AbstractRecord */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config') + $config = $this->serviceLocator->get(\VuFind\Config::class) ->get('Search2'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php index 1e81635d7a8..720d953512a 100644 --- a/module/VuFind/src/VuFind/Controller/SearchController.php +++ b/module/VuFind/src/VuFind/Controller/SearchController.php @@ -60,7 +60,7 @@ class SearchController extends AbstractSolrSearch { // If a URL was explicitly passed in, use that; otherwise, try to // find the HTTP referrer. - $mailer = $this->serviceLocator->get('VuFind\Mailer\Mailer'); + $mailer = $this->serviceLocator->get(\VuFind\Mailer\Mailer::class); $view = $this->createEmailViewModel(null, $mailer->getDefaultLinkSubject()); $mailer->setMaxRecipients($view->maxRecipients); // Set up reCaptcha @@ -126,7 +126,8 @@ class SearchController extends AbstractSolrSearch } $userId = is_object($user) ? $user->id : null; - $searchHistoryHelper = $this->serviceLocator->get('VuFind\Search\History'); + $searchHistoryHelper = $this->serviceLocator + ->get(\VuFind\Search\History::class); if ($this->params()->fromQuery('purge')) { $searchHistoryHelper->purgeSearchHistory($userId); @@ -280,7 +281,7 @@ class SearchController extends AbstractSolrSearch + $this->getRequest()->getPost()->toArray() ); $view = $this->createViewModel(); - $runner = $this->serviceLocator->get('VuFind\Search\SearchRunner'); + $runner = $this->serviceLocator->get(\VuFind\Search\SearchRunner::class); $view->results = $runner->run( $request, 'SolrReserves', $this->getSearchSetupCallback() ); @@ -415,7 +416,8 @@ class SearchController extends AbstractSolrSearch // Get suggestions and make sure they are an array (we don't want to JSON // encode them into an object): - $suggester = $this->serviceLocator->get('VuFind\Autocomplete\Suggester'); + $suggester = $this->serviceLocator + ->get(\VuFind\Autocomplete\Suggester::class); $suggestions = $suggester->getSuggestions($query, 'type', 'lookfor'); // Send the JSON response: @@ -435,7 +437,7 @@ class SearchController extends AbstractSolrSearch */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('config'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/ShibbolethLogoutNotificationController.php b/module/VuFind/src/VuFind/Controller/ShibbolethLogoutNotificationController.php index 56c836a9168..d244ad85450 100644 --- a/module/VuFind/src/VuFind/Controller/ShibbolethLogoutNotificationController.php +++ b/module/VuFind/src/VuFind/Controller/ShibbolethLogoutNotificationController.php @@ -106,7 +106,8 @@ class ShibbolethLogoutNotificationController extends AbstractBase if (empty($row)) { return; } - $sessionManager = $this->serviceLocator->get('Zend\Session\SessionManager'); + $sessionManager = $this->serviceLocator + ->get(\Zend\Session\SessionManager::class); $handler = $sessionManager->getSaveHandler(); $handler->destroy($row['session_id']); } diff --git a/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php b/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php index 221c6087d53..5a6b0192de7 100644 --- a/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php +++ b/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php @@ -132,7 +132,7 @@ trait StorageRetrievalRequestsTrait // Find and format the default required date: $defaultRequired = $this->storageRetrievalRequests() ->getDefaultRequiredDate($checkRequests); - $defaultRequired = $this->serviceLocator->get('VuFind\Date\Converter') + $defaultRequired = $this->serviceLocator->get(\VuFind\Date\Converter::class) ->convertToDisplayDate("U", $defaultRequired); try { $defaultPickup diff --git a/module/VuFind/src/VuFind/Controller/SummonController.php b/module/VuFind/src/VuFind/Controller/SummonController.php index fe12aa78700..8bb41797e2b 100644 --- a/module/VuFind/src/VuFind/Controller/SummonController.php +++ b/module/VuFind/src/VuFind/Controller/SummonController.php @@ -59,7 +59,7 @@ class SummonController extends AbstractSearch */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('Summon'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; @@ -106,7 +106,7 @@ class SummonController extends AbstractSearch // Set up facet information: $facets = $this->serviceLocator - ->get('VuFind\Search\FacetCache\PluginManager')->get('Summon') + ->get(\VuFind\Search\FacetCache\PluginManager::class)->get('Summon') ->getList('Advanced'); $view->facetList = $this->processAdvancedFacets($facets, $view->saved); $specialFacets = $this->parseSpecialFacetsSetting( diff --git a/module/VuFind/src/VuFind/Controller/SummonrecordController.php b/module/VuFind/src/VuFind/Controller/SummonrecordController.php index 07fb137d09b..47b3f339c54 100644 --- a/module/VuFind/src/VuFind/Controller/SummonrecordController.php +++ b/module/VuFind/src/VuFind/Controller/SummonrecordController.php @@ -63,7 +63,7 @@ class SummonrecordController extends AbstractRecord */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('Summon'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/UpgradeController.php b/module/VuFind/src/VuFind/Controller/UpgradeController.php index 13c0b96da11..1cac1bb50d2 100644 --- a/module/VuFind/src/VuFind/Controller/UpgradeController.php +++ b/module/VuFind/src/VuFind/Controller/UpgradeController.php @@ -237,7 +237,7 @@ class UpgradeController extends AbstractBase // subsequent calls. static $adapter = false; if (!$adapter) { - $factory = $this->serviceLocator->get('VuFind\Db\AdapterFactory'); + $factory = $this->serviceLocator->get(\VuFind\Db\AdapterFactory::class); $adapter = $factory->getAdapter( $this->session->dbRootUser, $this->session->dbRootPass ); @@ -302,7 +302,7 @@ class UpgradeController extends AbstractBase protected function fixSearchChecksumsInDatabase() { $manager = $this->serviceLocator - ->get('VuFind\Search\Results\PluginManager'); + ->get(\VuFind\Search\Results\PluginManager::class); $search = $this->getTable('search'); $searchWhere = ['checksum' => null, 'saved' => 1]; $searchRows = $search->select($searchWhere); @@ -498,7 +498,8 @@ class UpgradeController extends AbstractBase // If this is a MySQL connection, we can do an automatic upgrade; // if VuFind is using a different database, we have to prompt the // user to check the migrations directory and upgrade manually. - $adapter = $this->serviceLocator->get('Zend\Db\Adapter\Adapter'); + $adapter = $this->serviceLocator + ->get(\Zend\Db\Adapter\Adapter::class); $platform = $adapter->getDriver()->getDatabasePlatformName(); if (strtolower($platform) == 'mysql') { $upgradeResult = $this->upgradeMySQL($adapter); @@ -597,7 +598,7 @@ class UpgradeController extends AbstractBase try { // Query a table known to exist $factory = $this->serviceLocator - ->get('VuFind\Db\AdapterFactory'); + ->get(\VuFind\Db\AdapterFactory::class); $db = $factory->getAdapter($dbrootuser, $pass); $db->query("SELECT * FROM user;"); $this->session->dbRootUser = $dbrootuser; @@ -725,7 +726,7 @@ class UpgradeController extends AbstractBase // Process submit button: if ($this->formWasSubmitted('submit')) { - $converter = $this->serviceLocator->get('VuFind\Date\Converter'); + $converter = $this->serviceLocator->get(\VuFind\Date\Converter::class); foreach ($problems as $problem) { try { $driver = $this->getRecordLoader() @@ -828,7 +829,7 @@ class UpgradeController extends AbstractBase { // If the cache is messed up, nothing is going to work right -- check that // first: - $cache = $this->serviceLocator->get('VuFind\Cache\Manager'); + $cache = $this->serviceLocator->get(\VuFind\Cache\Manager::class); if ($cache->hasDirectoryCreationError()) { return $this->redirect()->toRoute('install-fixcache'); } diff --git a/module/VuFind/src/VuFind/Controller/UpgradeControllerFactory.php b/module/VuFind/src/VuFind/Controller/UpgradeControllerFactory.php index 91ee8f310f5..928b0daeb65 100644 --- a/module/VuFind/src/VuFind/Controller/UpgradeControllerFactory.php +++ b/module/VuFind/src/VuFind/Controller/UpgradeControllerFactory.php @@ -61,9 +61,9 @@ class UpgradeControllerFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $cookieManager = $container->get('VuFind\Cookie\CookieManager'); + $cookieManager = $container->get(\VuFind\Cookie\CookieManager::class); $session = new \Zend\Session\Container( - 'upgrade', $container->get('Zend\Session\SessionManager') + 'upgrade', $container->get(\Zend\Session\SessionManager::class) ); return new $requestedName($container, $cookieManager, $session); } diff --git a/module/VuFind/src/VuFind/Controller/WorldcatController.php b/module/VuFind/src/VuFind/Controller/WorldcatController.php index 87549743682..9325bf7a510 100644 --- a/module/VuFind/src/VuFind/Controller/WorldcatController.php +++ b/module/VuFind/src/VuFind/Controller/WorldcatController.php @@ -58,7 +58,7 @@ class WorldcatController extends AbstractSearch */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('WorldCat'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php b/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php index 99898d3d1a7..2d20805a897 100644 --- a/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php +++ b/module/VuFind/src/VuFind/Controller/WorldcatrecordController.php @@ -61,7 +61,7 @@ class WorldcatrecordController extends AbstractRecord */ protected function resultScrollerActive() { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->get('WorldCat'); return isset($config->Record->next_prev_navigation) && $config->Record->next_prev_navigation; diff --git a/module/VuFind/src/VuFind/Cookie/CookieManagerFactory.php b/module/VuFind/src/VuFind/Cookie/CookieManagerFactory.php index e92ea718d40..b3911fe8df7 100644 --- a/module/VuFind/src/VuFind/Cookie/CookieManagerFactory.php +++ b/module/VuFind/src/VuFind/Cookie/CookieManagerFactory.php @@ -62,7 +62,8 @@ class CookieManagerFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $path = '/'; if ($config->Cookies->limit_by_path ?? false) { $path = Console::isConsole() diff --git a/module/VuFind/src/VuFind/Cover/CachingProxyFactory.php b/module/VuFind/src/VuFind/Cover/CachingProxyFactory.php index 068783abfde..49518c6c052 100644 --- a/module/VuFind/src/VuFind/Cover/CachingProxyFactory.php +++ b/module/VuFind/src/VuFind/Cover/CachingProxyFactory.php @@ -61,10 +61,10 @@ class CachingProxyFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $cacheDir = $container->get('VuFind\Cache\Manager') + $cacheDir = $container->get(\VuFind\Cache\Manager::class) ->getCache('cover')->getOptions()->getCacheDir(); - $client = $container->get('VuFindHttp\HttpService')->createClient(); - $config = $container->get('VuFind\Config\PluginManager')->get('config') + $client = $container->get(\VuFindHttp\HttpService::class)->createClient(); + $config = $container->get(\VuFind\Config\PluginManager::class)->get('config') ->toArray(); $whitelist = isset($config['Content']['coverproxyCache']) ? (array)$config['Content']['coverproxyCache'] : []; diff --git a/module/VuFind/src/VuFind/Cover/GeneratorFactory.php b/module/VuFind/src/VuFind/Cover/GeneratorFactory.php index 36938fc0dde..8bc3547c655 100644 --- a/module/VuFind/src/VuFind/Cover/GeneratorFactory.php +++ b/module/VuFind/src/VuFind/Cover/GeneratorFactory.php @@ -62,8 +62,8 @@ class GeneratorFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFindTheme\ThemeInfo'), - $container->get('VuFind\Cover\Layer\PluginManager') + $container->get(\VuFindTheme\ThemeInfo::class), + $container->get(\VuFind\Cover\Layer\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/Cover/LoaderFactory.php b/module/VuFind/src/VuFind/Cover/LoaderFactory.php index a8bd85075a7..8629f054486 100644 --- a/module/VuFind/src/VuFind/Cover/LoaderFactory.php +++ b/module/VuFind/src/VuFind/Cover/LoaderFactory.php @@ -61,19 +61,22 @@ class LoaderFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $cacheDir = $container->get('VuFind\Cache\Manager') + $cacheDir = $container->get(\VuFind\Cache\Manager::class) ->getCache('cover')->getOptions()->getCacheDir(); - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $loader = new $requestedName( $config, - $container->get('VuFind\Content\Covers\PluginManager'), - $container->get('VuFindTheme\ThemeInfo'), - $container->get('VuFindHttp\HttpService'), + $container->get(\VuFind\Content\Covers\PluginManager::class), + $container->get(\VuFindTheme\ThemeInfo::class), + $container->get(\VuFindHttp\HttpService::class), $cacheDir ); // Add cover generator if enabled: if ($config->Content->makeDynamicCovers ?? false) { - $loader->setCoverGenerator($container->get('VuFind\Cover\Generator')); + $loader->setCoverGenerator( + $container->get(\VuFind\Cover\Generator::class) + ); } return $loader; } diff --git a/module/VuFind/src/VuFind/Crypt/HMACFactory.php b/module/VuFind/src/VuFind/Crypt/HMACFactory.php index f645ebb9d89..198ce0fd7f6 100644 --- a/module/VuFind/src/VuFind/Crypt/HMACFactory.php +++ b/module/VuFind/src/VuFind/Crypt/HMACFactory.php @@ -61,7 +61,8 @@ class HMACFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($config->Security->HMACkey); } } diff --git a/module/VuFind/src/VuFind/Db/Row/RowGatewayFactory.php b/module/VuFind/src/VuFind/Db/Row/RowGatewayFactory.php index 6cbff5b00bc..17054918635 100644 --- a/module/VuFind/src/VuFind/Db/Row/RowGatewayFactory.php +++ b/module/VuFind/src/VuFind/Db/Row/RowGatewayFactory.php @@ -57,7 +57,7 @@ class RowGatewayFactory implements \Zend\ServiceManager\Factory\FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null ) { - $adapter = $container->get('Zend\Db\Adapter\Adapter'); + $adapter = $container->get(\Zend\Db\Adapter\Adapter::class); return new $requestedName($adapter, ...($options !== null ? $options : [])); } } diff --git a/module/VuFind/src/VuFind/Db/Row/UserFactory.php b/module/VuFind/src/VuFind/Db/Row/UserFactory.php index eb74dcd025e..4ebcf82037a 100644 --- a/module/VuFind/src/VuFind/Db/Row/UserFactory.php +++ b/module/VuFind/src/VuFind/Db/Row/UserFactory.php @@ -67,14 +67,15 @@ class UserFactory extends RowGatewayFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $privacy = isset($config->Authentication->privacy) && $config->Authentication->privacy; $rowClass = $privacy ? $this->privateUserClass : $requestedName; $prototype = parent::__invoke($container, $rowClass, $options); $prototype->setConfig($config); if ($privacy) { - $sessionManager = $container->get('Zend\Session\SessionManager'); + $sessionManager = $container->get(\Zend\Session\SessionManager::class); $session = new \Zend\Session\Container('Account', $sessionManager); $prototype->setSession($session); } diff --git a/module/VuFind/src/VuFind/Db/Row/UserListFactory.php b/module/VuFind/src/VuFind/Db/Row/UserListFactory.php index d0a8c1f2fd5..6965f6c7f10 100644 --- a/module/VuFind/src/VuFind/Db/Row/UserListFactory.php +++ b/module/VuFind/src/VuFind/Db/Row/UserListFactory.php @@ -60,7 +60,7 @@ class UserListFactory extends RowGatewayFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory!'); } - $sessionManager = $container->get('Zend\Session\SessionManager'); + $sessionManager = $container->get(\Zend\Session\SessionManager::class); $session = new \Zend\Session\Container('List', $sessionManager); return parent::__invoke($container, $requestedName, [$session]); } diff --git a/module/VuFind/src/VuFind/Db/Table/CaseSensitiveTagsFactory.php b/module/VuFind/src/VuFind/Db/Table/CaseSensitiveTagsFactory.php index 8c3e790d6fb..a83861a3202 100644 --- a/module/VuFind/src/VuFind/Db/Table/CaseSensitiveTagsFactory.php +++ b/module/VuFind/src/VuFind/Db/Table/CaseSensitiveTagsFactory.php @@ -60,7 +60,8 @@ class CaseSensitiveTagsFactory extends GatewayFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $caseSensitive = isset($config->Social->case_sensitive_tags) && $config->Social->case_sensitive_tags; return parent::__invoke($container, $requestedName, [$caseSensitive]); diff --git a/module/VuFind/src/VuFind/Db/Table/GatewayFactory.php b/module/VuFind/src/VuFind/Db/Table/GatewayFactory.php index 1f124b44efe..a483b2ca3e2 100644 --- a/module/VuFind/src/VuFind/Db/Table/GatewayFactory.php +++ b/module/VuFind/src/VuFind/Db/Table/GatewayFactory.php @@ -50,7 +50,7 @@ class GatewayFactory implements \Zend\ServiceManager\Factory\FactoryInterface */ protected function getRowPrototype(ContainerInterface $container, $requestedName) { - $rowManager = $container->get('VuFind\Db\Row\PluginManager'); + $rowManager = $container->get(\VuFind\Db\Row\PluginManager::class); // Map Table class to matching Row class. $name = str_replace("\\Table\\", "\\Row\\", $requestedName); return $rowManager->has($name) ? $rowManager->get($name) : null; @@ -73,8 +73,8 @@ class GatewayFactory implements \Zend\ServiceManager\Factory\FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null ) { - $adapter = $container->get('Zend\Db\Adapter\Adapter'); - $tm = $container->get('VuFind\Db\Table\PluginManager'); + $adapter = $container->get(\Zend\Db\Adapter\Adapter::class); + $tm = $container->get(\VuFind\Db\Table\PluginManager::class); $config = $container->get('config'); $rowPrototype = $this->getRowPrototype($container, $requestedName); $args = $options ? $options : []; diff --git a/module/VuFind/src/VuFind/Db/Table/ResourceFactory.php b/module/VuFind/src/VuFind/Db/Table/ResourceFactory.php index 02e7c52f4c6..fd0d0ce7f81 100644 --- a/module/VuFind/src/VuFind/Db/Table/ResourceFactory.php +++ b/module/VuFind/src/VuFind/Db/Table/ResourceFactory.php @@ -60,8 +60,8 @@ class ResourceFactory extends GatewayFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory!'); } - $converter = $container->get('VuFind\Date\Converter'); - $loader = $container->get('VuFind\Record\Loader'); + $converter = $container->get(\VuFind\Date\Converter::class); + $loader = $container->get(\VuFind\Record\Loader::class); return parent::__invoke($container, $requestedName, [$converter, $loader]); } } diff --git a/module/VuFind/src/VuFind/Db/Table/UserFactory.php b/module/VuFind/src/VuFind/Db/Table/UserFactory.php index 4cbe25991ca..9ce70b8f683 100644 --- a/module/VuFind/src/VuFind/Db/Table/UserFactory.php +++ b/module/VuFind/src/VuFind/Db/Table/UserFactory.php @@ -57,12 +57,13 @@ class UserFactory extends GatewayFactory public function __invoke(ContainerInterface $container, $requestedName, array $options = null ) { - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $session = null; if (isset($config->Authentication->privacy) && $config->Authentication->privacy ) { - $sessionManager = $container->get('Zend\Session\SessionManager'); + $sessionManager = $container->get(\Zend\Session\SessionManager::class); $session = new \Zend\Session\Container('Account', $sessionManager); } return parent::__invoke($container, $requestedName, [$config, $session]); diff --git a/module/VuFind/src/VuFind/Db/Table/UserListFactory.php b/module/VuFind/src/VuFind/Db/Table/UserListFactory.php index 5fea27b4880..ba43dc99ea2 100644 --- a/module/VuFind/src/VuFind/Db/Table/UserListFactory.php +++ b/module/VuFind/src/VuFind/Db/Table/UserListFactory.php @@ -60,7 +60,7 @@ class UserListFactory extends GatewayFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory!'); } - $sessionManager = $container->get('Zend\Session\SessionManager'); + $sessionManager = $container->get(\Zend\Session\SessionManager::class); $session = new \Zend\Session\Container('List', $sessionManager); return parent::__invoke($container, $requestedName, [$session]); } diff --git a/module/VuFind/src/VuFind/DoiLinker/BrowZineFactory.php b/module/VuFind/src/VuFind/DoiLinker/BrowZineFactory.php index 4256b24dae4..42a6320c128 100644 --- a/module/VuFind/src/VuFind/DoiLinker/BrowZineFactory.php +++ b/module/VuFind/src/VuFind/DoiLinker/BrowZineFactory.php @@ -62,7 +62,8 @@ class BrowZineFactory implements \Zend\ServiceManager\Factory\FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $backend = $container->get('VuFind\Search\BackendManager')->get('BrowZine'); + $backend = $container->get(\VuFind\Search\BackendManager::class) + ->get('BrowZine'); return new $requestedName($backend->getConnector()); } } diff --git a/module/VuFind/src/VuFind/ExportFactory.php b/module/VuFind/src/VuFind/ExportFactory.php index fdbfbe68b0b..69f9b153050 100644 --- a/module/VuFind/src/VuFind/ExportFactory.php +++ b/module/VuFind/src/VuFind/ExportFactory.php @@ -62,8 +62,8 @@ class ExportFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Config\PluginManager')->get('config'), - $container->get('VuFind\Config\PluginManager')->get('export') + $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFind\Config\PluginManager::class)->get('export') ); } } diff --git a/module/VuFind/src/VuFind/Favorites/FavoritesServiceFactory.php b/module/VuFind/src/VuFind/Favorites/FavoritesServiceFactory.php index 8ef1bf9226d..4e64951424a 100644 --- a/module/VuFind/src/VuFind/Favorites/FavoritesServiceFactory.php +++ b/module/VuFind/src/VuFind/Favorites/FavoritesServiceFactory.php @@ -56,11 +56,11 @@ class FavoritesServiceFactory implements FactoryInterface */ public function __invoke(ContainerInterface $sm, $name, array $options = null) { - $tableManager = $sm->get('VuFind\Db\Table\PluginManager'); + $tableManager = $sm->get(\VuFind\Db\Table\PluginManager::class); return new FavoritesService( $tableManager->get('userlist'), $tableManager->get('resource'), - $sm->get('VuFind\Record\Cache') + $sm->get(\VuFind\Record\Cache::class) ); } } diff --git a/module/VuFind/src/VuFind/Form/FormFactory.php b/module/VuFind/src/VuFind/Form/FormFactory.php index f50cad21a09..4849f589dd0 100644 --- a/module/VuFind/src/VuFind/Form/FormFactory.php +++ b/module/VuFind/src/VuFind/Form/FormFactory.php @@ -62,9 +62,9 @@ class FormFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager') + $config = $container->get(\VuFind\Config\PluginManager::class) ->get('config')->toArray(); - $yamlReader = $container->get('VuFind\Config\YamlReader'); + $yamlReader = $container->get(\VuFind\Config\YamlReader::class); return new $requestedName( $yamlReader, $config['Feedback'] ?? null diff --git a/module/VuFind/src/VuFind/GeoFeatures/AbstractConfigFactory.php b/module/VuFind/src/VuFind/GeoFeatures/AbstractConfigFactory.php index dd18620c4c8..a9563aa74dd 100644 --- a/module/VuFind/src/VuFind/GeoFeatures/AbstractConfigFactory.php +++ b/module/VuFind/src/VuFind/GeoFeatures/AbstractConfigFactory.php @@ -64,6 +64,8 @@ class AbstractConfigFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\Config\PluginManager')); + return new $requestedName( + $container->get(\VuFind\Config\PluginManager::class) + ); } } diff --git a/module/VuFind/src/VuFind/Hierarchy/Driver/ConfigurationBasedFactory.php b/module/VuFind/src/VuFind/Hierarchy/Driver/ConfigurationBasedFactory.php index 4a55c3fcb38..008c566f2ed 100644 --- a/module/VuFind/src/VuFind/Hierarchy/Driver/ConfigurationBasedFactory.php +++ b/module/VuFind/src/VuFind/Hierarchy/Driver/ConfigurationBasedFactory.php @@ -65,7 +65,7 @@ class ConfigurationBasedFactory $parts = explode('\\', $requestedName); $config = end($parts); // Set up options based on global VuFind settings: - $configReader = $sm->get('VuFind\Config\PluginManager'); + $configReader = $sm->get(\VuFind\Config\PluginManager::class); $globalConfig = $configReader->get('config'); $options = [ 'enabled' => $globalConfig->Hierarchy->showTree ?? false @@ -77,8 +77,8 @@ class ConfigurationBasedFactory // Build object: return new ConfigurationBased( $driverConfig, - $sm->get('VuFind\Hierarchy\TreeDataSource\PluginManager'), - $sm->get('VuFind\Hierarchy\TreeRenderer\PluginManager'), + $sm->get(\VuFind\Hierarchy\TreeDataSource\PluginManager::class), + $sm->get(\VuFind\Hierarchy\TreeRenderer\PluginManager::class), $options ); } diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/SolrFactory.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/SolrFactory.php index dd154c2d64e..91572cb6f2c 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/SolrFactory.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/SolrFactory.php @@ -60,20 +60,21 @@ class SolrFactory implements \Zend\ServiceManager\Factory\FactoryInterface if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $cacheDir = $container->get('VuFind\Cache\Manager') + $cacheDir = $container->get(\VuFind\Cache\Manager::class) ->getCacheDir(false); - $hierarchyFilters = $container->get('VuFind\Config\PluginManager') + $hierarchyFilters = $container->get(\VuFind\Config\PluginManager::class) ->get('HierarchyDefault'); $filters = isset($hierarchyFilters->HierarchyTree->filterQueries) ? $hierarchyFilters->HierarchyTree->filterQueries->toArray() : []; - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $batchSize = isset($config->Index->cursor_batch_size) ? $config->Index->cursor_batch_size : 1000; - $solr = $container->get('VuFind\Search\BackendManager') + $solr = $container->get(\VuFind\Search\BackendManager::class) ->get('Solr')->getConnector(); $formatterManager = $container - ->get('VuFind\Hierarchy\TreeDataFormatter\PluginManager'); + ->get(\VuFind\Hierarchy\TreeDataFormatter\PluginManager::class); return new $requestedName( $solr, $formatterManager, rtrim($cacheDir, '/') . '/hierarchy', $filters, $batchSize diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTreeFactory.php b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTreeFactory.php index 77f61d133bb..7f43f3a736c 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTreeFactory.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTreeFactory.php @@ -60,7 +60,8 @@ class JSTreeFactory implements \Zend\ServiceManager\Factory\FactoryInterface if ($options !== null) { throw new \Exception('Unexpected options sent to factory!'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName( $container->get('ControllerPluginManager')->get('Url'), !empty($config->Collections->collections) diff --git a/module/VuFind/src/VuFind/ILS/ConnectionFactory.php b/module/VuFind/src/VuFind/ILS/ConnectionFactory.php index e9a7f0f7e84..ad0c32df448 100644 --- a/module/VuFind/src/VuFind/ILS/ConnectionFactory.php +++ b/module/VuFind/src/VuFind/ILS/ConnectionFactory.php @@ -61,11 +61,14 @@ class ConnectionFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } + $configManager = $container->get(\VuFind\Config\PluginManager::class); $catalog = new $requestedName( - $container->get('VuFind\Config\PluginManager')->get('config')->Catalog, - $container->get('VuFind\ILS\Driver\PluginManager'), - $container->get('VuFind\Config\PluginManager') + $configManager->get('config')->Catalog, + $container->get(\VuFind\ILS\Driver\PluginManager::class), + $container->get(\VuFind\Config\PluginManager::class) + ); + return $catalog->setHoldConfig( + $container->get(\VuFind\ILS\HoldSettings::class) ); - return $catalog->setHoldConfig($container->get('VuFind\ILS\HoldSettings')); } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/AlephFactory.php b/module/VuFind/src/VuFind/ILS/Driver/AlephFactory.php index a0a303d7be4..7d40d503b5b 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/AlephFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/AlephFactory.php @@ -61,7 +61,9 @@ class AlephFactory extends DriverWithDateConverterFactory throw new \Exception('Unexpected options passed to factory.'); } return parent::__invoke( - $container, $requestedName, [$container->get('VuFind\Cache\Manager')] + $container, + $requestedName, + [$container->get(\VuFind\Cache\Manager::class)] ); } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/AlmaFactory.php b/module/VuFind/src/VuFind/ILS/Driver/AlmaFactory.php index fad09dc0c16..a4d46669aeb 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/AlmaFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/AlmaFactory.php @@ -66,15 +66,15 @@ class AlmaFactory implements FactoryInterface // Set up the driver with the date converter (and any extra parameters // passed in as options): $driver = new $requestedName( - $container->get('VuFind\Date\Converter'), - $container->get('VuFind\Config\PluginManager'), + $container->get(\VuFind\Date\Converter::class), + $container->get(\VuFind\Config\PluginManager::class), ...($options ?: []) ); // Populate cache storage if a setCacheStorage method is present: if (method_exists($driver, 'setCacheStorage')) { $driver->setCacheStorage( - $container->get('VuFind\Cache\Manager')->getCache('object') + $container->get(\VuFind\Cache\Manager::class)->getCache('object') ); } diff --git a/module/VuFind/src/VuFind/ILS/Driver/DemoFactory.php b/module/VuFind/src/VuFind/ILS/Driver/DemoFactory.php index 307b874ae53..e6343922960 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/DemoFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/DemoFactory.php @@ -61,12 +61,12 @@ class DemoFactory extends DriverWithDateConverterFactory throw new \Exception('Unexpected options passed to factory.'); } $sessionFactory = function () use ($container) { - $manager = $container->get('Zend\Session\SessionManager'); + $manager = $container->get(\Zend\Session\SessionManager::class); return new \Zend\Session\Container('DemoDriver', $manager); }; return parent::__invoke( $container, $requestedName, - [$container->get('VuFindSearch\Service'), $sessionFactory] + [$container->get(\VuFindSearch\Service::class), $sessionFactory] ); } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/DriverWithDateConverterFactory.php b/module/VuFind/src/VuFind/ILS/Driver/DriverWithDateConverterFactory.php index 8fd6268073a..9d87a28ddf1 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/DriverWithDateConverterFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/DriverWithDateConverterFactory.php @@ -61,13 +61,13 @@ class DriverWithDateConverterFactory implements FactoryInterface // Set up the driver with the date converter (and any extra parameters // passed in as options): $driver = new $requestedName( - $container->get('VuFind\Date\Converter'), ...($options ?: []) + $container->get(\VuFind\Date\Converter::class), ...($options ?: []) ); // Populate cache storage if a setCacheStorage method is present: if (method_exists($driver, 'setCacheStorage')) { $driver->setCacheStorage( - $container->get('VuFind\Cache\Manager')->getCache('object') + $container->get(\VuFind\Cache\Manager::class)->getCache('object') ); } diff --git a/module/VuFind/src/VuFind/ILS/Driver/FolioFactory.php b/module/VuFind/src/VuFind/ILS/Driver/FolioFactory.php index a37d4b6a1a5..677d6c2319e 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/FolioFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/FolioFactory.php @@ -61,7 +61,7 @@ class FolioFactory extends DriverWithDateConverterFactory throw new \Exception('Unexpected options passed to factory.'); } $sessionFactory = function ($namespace) use ($container) { - $manager = $container->get('Zend\Session\SessionManager'); + $manager = $container->get(\Zend\Session\SessionManager::class); return new \Zend\Session\Container("Folio_$namespace", $manager); }; return parent::__invoke($container, $requestedName, [$sessionFactory]); diff --git a/module/VuFind/src/VuFind/ILS/Driver/MultiBackendFactory.php b/module/VuFind/src/VuFind/ILS/Driver/MultiBackendFactory.php index f58c05904bd..232f916b67c 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/MultiBackendFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/MultiBackendFactory.php @@ -62,9 +62,9 @@ class MultiBackendFactory implements FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Config\PluginManager'), - $container->get('VuFind\Auth\ILSAuthenticator'), - $container->get('VuFind\ILS\Driver\PluginManager') + $container->get(\VuFind\Config\PluginManager::class), + $container->get(\VuFind\Auth\ILSAuthenticator::class), + $container->get(\VuFind\ILS\Driver\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/NoILSFactory.php b/module/VuFind/src/VuFind/ILS/Driver/NoILSFactory.php index d0db0202e24..08654dbe280 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/NoILSFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/NoILSFactory.php @@ -61,6 +61,6 @@ class NoILSFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - return new $requestedName($container->get('VuFind\Record\Loader')); + return new $requestedName($container->get(\VuFind\Record\Loader::class)); } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/PAIAFactory.php b/module/VuFind/src/VuFind/ILS/Driver/PAIAFactory.php index 64db51aab4b..f7d54d8a9d3 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/PAIAFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/PAIAFactory.php @@ -62,7 +62,7 @@ class PAIAFactory extends DriverWithDateConverterFactory } return parent::__invoke( $container, $requestedName, - [$container->get('Zend\Session\SessionManager')] + [$container->get(\Zend\Session\SessionManager::class)] ); } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/SierraRestFactory.php b/module/VuFind/src/VuFind/ILS/Driver/SierraRestFactory.php index dd0ebd99931..05943e737c1 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/SierraRestFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/SierraRestFactory.php @@ -61,7 +61,7 @@ class SierraRestFactory extends DriverWithDateConverterFactory throw new \Exception('Unexpected options passed to factory.'); } $sessionFactory = function ($namespace) use ($container) { - $manager = $container->get('Zend\Session\SessionManager'); + $manager = $container->get(\Zend\Session\SessionManager::class); return new \Zend\Session\Container("SierraRest_$namespace", $manager); }; return parent::__invoke($container, $requestedName, [$sessionFactory]); diff --git a/module/VuFind/src/VuFind/ILS/Driver/SymphonyFactory.php b/module/VuFind/src/VuFind/ILS/Driver/SymphonyFactory.php index 52ae28982d8..e89fb7dace8 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/SymphonyFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/SymphonyFactory.php @@ -62,8 +62,8 @@ class SymphonyFactory implements FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Record\Loader'), - $container->get('VuFind\Cache\Manager') + $container->get(\VuFind\Record\Loader::class), + $container->get(\VuFind\Cache\Manager::class) ); } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestfulFactory.php b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestfulFactory.php index 56e525226c9..34f2c66d08d 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestfulFactory.php +++ b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestfulFactory.php @@ -60,7 +60,7 @@ class VoyagerRestfulFactory extends DriverWithDateConverterFactory if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $ils = $container->get('VuFind\ILS\HoldSettings'); + $ils = $container->get(\VuFind\ILS\HoldSettings::class); $extraParams = [$ils->getHoldsMode(), $ils->getTitleHoldsMode()]; return parent::__invoke($container, $requestedName, $extraParams); } diff --git a/module/VuFind/src/VuFind/ILS/HoldSettingsFactory.php b/module/VuFind/src/VuFind/ILS/HoldSettingsFactory.php index 00dc7e29889..810b1427b8d 100644 --- a/module/VuFind/src/VuFind/ILS/HoldSettingsFactory.php +++ b/module/VuFind/src/VuFind/ILS/HoldSettingsFactory.php @@ -61,8 +61,9 @@ class HoldSettingsFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } + $configManager = $container->get(\VuFind\Config\PluginManager::class); return new $requestedName( - $container->get('VuFind\Config\PluginManager')->get('config')->Catalog + $configManager->get('config')->Catalog ); } } diff --git a/module/VuFind/src/VuFind/ILS/Logic/LogicFactory.php b/module/VuFind/src/VuFind/ILS/Logic/LogicFactory.php index 0ceae43623b..33c0d2ff01b 100644 --- a/module/VuFind/src/VuFind/ILS/Logic/LogicFactory.php +++ b/module/VuFind/src/VuFind/ILS/Logic/LogicFactory.php @@ -62,10 +62,10 @@ class LogicFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Auth\ILSAuthenticator'), - $container->get('VuFind\ILS\Connection'), - $container->get('VuFind\Crypt\HMAC'), - $container->get('VuFind\Config\PluginManager')->get('config') + $container->get(\VuFind\Auth\ILSAuthenticator::class), + $container->get(\VuFind\ILS\Connection::class), + $container->get(\VuFind\Crypt\HMAC::class), + $container->get(\VuFind\Config\PluginManager::class)->get('config') ); } } diff --git a/module/VuFind/src/VuFind/Log/LoggerFactory.php b/module/VuFind/src/VuFind/Log/LoggerFactory.php index bf828b45e96..481689028f7 100644 --- a/module/VuFind/src/VuFind/Log/LoggerFactory.php +++ b/module/VuFind/src/VuFind/Log/LoggerFactory.php @@ -71,7 +71,7 @@ class LoggerFactory implements FactoryInterface // Make Writers $filters = explode(',', $error_types); $writer = new Writer\Db( - $container->get('Zend\Db\Adapter\Adapter'), + $container->get(\Zend\Db\Adapter\Adapter::class), $table_name, $columnMapping ); $this->addWriters($logger, $writer, $filters); @@ -96,7 +96,7 @@ class LoggerFactory implements FactoryInterface $error_types = $parts[1] ?? ''; // use smtp - $mailer = $container->get('VuFind\Mailer\Mailer'); + $mailer = $container->get(\VuFind\Mailer\Mailer::class); $msg = $mailer->getNewMessage() ->addFrom($config->Site->email) ->addTo($email) @@ -164,7 +164,7 @@ class LoggerFactory implements FactoryInterface // Make Writers $writer = new Writer\Slack( $config->Logging->slackurl, - $container->get('VuFindHttp\HttpService')->createClient(), + $container->get(\VuFindHttp\HttpService::class)->createClient(), $options ); $writer->setContentType('application/json'); @@ -185,7 +185,8 @@ class LoggerFactory implements FactoryInterface */ protected function configureLogger(ContainerInterface $container, Logger $logger) { - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $hasWriter = false; diff --git a/module/VuFind/src/VuFind/Mailer/Factory.php b/module/VuFind/src/VuFind/Mailer/Factory.php index 6aa5dba410c..230e3f4d720 100644 --- a/module/VuFind/src/VuFind/Mailer/Factory.php +++ b/module/VuFind/src/VuFind/Mailer/Factory.php @@ -107,7 +107,8 @@ class Factory implements FactoryInterface } // Load configurations: - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); // Create service: $class = new $requestedName($this->getTransport($config)); diff --git a/module/VuFind/src/VuFind/QRCode/LoaderFactory.php b/module/VuFind/src/VuFind/QRCode/LoaderFactory.php index 67d5db90f84..4155d3f58f6 100644 --- a/module/VuFind/src/VuFind/QRCode/LoaderFactory.php +++ b/module/VuFind/src/VuFind/QRCode/LoaderFactory.php @@ -62,8 +62,8 @@ class LoaderFactory implements FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Config\PluginManager')->get('config'), - $container->get('VuFindTheme\ThemeInfo') + $container->get(\VuFind\Config\PluginManager::class)->get('config'), + $container->get(\VuFindTheme\ThemeInfo::class) ); } } diff --git a/module/VuFind/src/VuFind/Record/CacheFactory.php b/module/VuFind/src/VuFind/Record/CacheFactory.php index c63a9bc9a64..40d3a1effcd 100644 --- a/module/VuFind/src/VuFind/Record/CacheFactory.php +++ b/module/VuFind/src/VuFind/Record/CacheFactory.php @@ -62,9 +62,9 @@ class CacheFactory implements FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\RecordDriver\PluginManager'), - $container->get('VuFind\Config\PluginManager')->get('RecordCache'), - $container->get('VuFind\Db\Table\PluginManager')->get('Record') + $container->get(\VuFind\RecordDriver\PluginManager::class), + $container->get(\VuFind\Config\PluginManager::class)->get('RecordCache'), + $container->get(\VuFind\Db\Table\PluginManager::class)->get('Record') ); } } diff --git a/module/VuFind/src/VuFind/Record/FallbackLoader/SummonFactory.php b/module/VuFind/src/VuFind/Record/FallbackLoader/SummonFactory.php index c3d0d04930c..b954b68553b 100644 --- a/module/VuFind/src/VuFind/Record/FallbackLoader/SummonFactory.php +++ b/module/VuFind/src/VuFind/Record/FallbackLoader/SummonFactory.php @@ -61,9 +61,9 @@ class SummonFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $backendManager = $container->get('VuFind\Search\BackendManager'); + $backendManager = $container->get(\VuFind\Search\BackendManager::class); return new $requestedName( - $container->get('VuFind\Db\Table\PluginManager')->get('resource'), + $container->get(\VuFind\Db\Table\PluginManager::class)->get('resource'), $backendManager->get('Summon') ); } diff --git a/module/VuFind/src/VuFind/Record/LoaderFactory.php b/module/VuFind/src/VuFind/Record/LoaderFactory.php index 8adb957982c..3dd2c87003e 100644 --- a/module/VuFind/src/VuFind/Record/LoaderFactory.php +++ b/module/VuFind/src/VuFind/Record/LoaderFactory.php @@ -62,10 +62,10 @@ class LoaderFactory implements FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFindSearch\Service'), - $container->get('VuFind\RecordDriver\PluginManager'), - $container->get('VuFind\Record\Cache'), - $container->get('VuFind\Record\FallbackLoader\PluginManager') + $container->get(\VuFindSearch\Service::class), + $container->get(\VuFind\RecordDriver\PluginManager::class), + $container->get(\VuFind\Record\Cache::class), + $container->get(\VuFind\Record\FallbackLoader\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/Record/RouterFactory.php b/module/VuFind/src/VuFind/Record/RouterFactory.php index b9e7f79b055..37103da0438 100644 --- a/module/VuFind/src/VuFind/Record/RouterFactory.php +++ b/module/VuFind/src/VuFind/Record/RouterFactory.php @@ -62,8 +62,8 @@ class RouterFactory implements FactoryInterface throw new \Exception('Unexpected options passed to factory.'); } return new $requestedName( - $container->get('VuFind\Record\Loader'), - $container->get('VuFind\Config\PluginManager')->get('config') + $container->get(\VuFind\Record\Loader::class), + $container->get(\VuFind\Config\PluginManager::class)->get('config') ); } } diff --git a/module/VuFind/src/VuFind/RecordDriver/AbstractBaseFactory.php b/module/VuFind/src/VuFind/RecordDriver/AbstractBaseFactory.php index da058162ec3..7b3fb3b8e90 100644 --- a/module/VuFind/src/VuFind/RecordDriver/AbstractBaseFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/AbstractBaseFactory.php @@ -58,7 +58,8 @@ class AbstractBaseFactory implements FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null ) { - $mainConfig = $container->get('VuFind\Config\PluginManager')->get('config'); + $mainConfig = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($mainConfig, ...($options ?: [])); } } diff --git a/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php b/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php index de9a28fca9b..6e5d2660f47 100644 --- a/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php @@ -62,9 +62,9 @@ class IlsAwareDelegatorFactory implements DelegatorFactoryInterface $ilsBackends = $this->getIlsBackends($container); if (!empty($ilsBackends) && $container->has('VuFind\ILS\Connection')) { $driver->attachILS( - $container->get('VuFind\ILS\Connection'), - $container->get('VuFind\ILS\Logic\Holds'), - $container->get('VuFind\ILS\Logic\TitleHolds') + $container->get(\VuFind\ILS\Connection::class), + $container->get(\VuFind\ILS\Logic\Holds::class), + $container->get(\VuFind\ILS\Logic\TitleHolds::class) ); $driver->setIlsBackends($ilsBackends); } @@ -84,7 +84,8 @@ class IlsAwareDelegatorFactory implements DelegatorFactoryInterface // Get a list of ILS-compatible backends. static $ilsBackends = null; if (!is_array($ilsBackends)) { - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $settings = isset($config->Catalog) ? $config->Catalog->toArray() : []; // If the setting is missing, default to the default backend; if it diff --git a/module/VuFind/src/VuFind/RecordDriver/NameBasedConfigFactory.php b/module/VuFind/src/VuFind/RecordDriver/NameBasedConfigFactory.php index 845b40741d5..f69c90d98c2 100644 --- a/module/VuFind/src/VuFind/RecordDriver/NameBasedConfigFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/NameBasedConfigFactory.php @@ -62,7 +62,8 @@ class NameBasedConfigFactory extends AbstractBaseFactory } $parts = explode('\\', $requestedName); $configName = array_pop($parts); - $config = $container->get('VuFind\Config\PluginManager')->get($configName); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get($configName); $finalOptions = [$config, $config]; return parent::__invoke($container, $requestedName, $finalOptions); } diff --git a/module/VuFind/src/VuFind/RecordDriver/PluginManager.php b/module/VuFind/src/VuFind/RecordDriver/PluginManager.php index deb4d000bb7..ce4dda26805 100644 --- a/module/VuFind/src/VuFind/RecordDriver/PluginManager.php +++ b/module/VuFind/src/VuFind/RecordDriver/PluginManager.php @@ -136,7 +136,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager ) { if ($sm && $sm->has('VuFind\Hierarchy\Driver\PluginManager')) { $instance->setHierarchyDriverManager( - $sm->get('VuFind\Hierarchy\Driver\PluginManager') + $sm->get(\VuFind\Hierarchy\Driver\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrDefaultFactory.php b/module/VuFind/src/VuFind/RecordDriver/SolrDefaultFactory.php index 80dca941083..ddb58cb3a22 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SolrDefaultFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/SolrDefaultFactory.php @@ -58,7 +58,7 @@ class SolrDefaultFactory extends SolrDefaultWithoutSearchServiceFactory array $options = null ) { $driver = parent::__invoke($container, $requestedName, $options); - $driver->attachSearchService($container->get('VuFindSearch\Service')); + $driver->attachSearchService($container->get(\VuFindSearch\Service::class)); return $driver; } } diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrDefaultWithoutSearchServiceFactory.php b/module/VuFind/src/VuFind/RecordDriver/SolrDefaultWithoutSearchServiceFactory.php index c24019b7dab..efa45299551 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SolrDefaultWithoutSearchServiceFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/SolrDefaultWithoutSearchServiceFactory.php @@ -60,7 +60,8 @@ class SolrDefaultWithoutSearchServiceFactory extends AbstractBaseFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('searches'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('searches'); $finalOptions = [null, $config]; return parent::__invoke($container, $requestedName, $finalOptions); } diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrWebFactory.php b/module/VuFind/src/VuFind/RecordDriver/SolrWebFactory.php index 91cef38e71b..517e0dfd725 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SolrWebFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/SolrWebFactory.php @@ -60,7 +60,8 @@ class SolrWebFactory extends AbstractBaseFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('website'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('website'); $finalOptions = [$config, $config]; return parent::__invoke($container, $requestedName, $finalOptions); } diff --git a/module/VuFind/src/VuFind/RecordDriver/SummonFactory.php b/module/VuFind/src/VuFind/RecordDriver/SummonFactory.php index f39a757bca6..33fcc8f6362 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SummonFactory.php +++ b/module/VuFind/src/VuFind/RecordDriver/SummonFactory.php @@ -58,7 +58,7 @@ class SummonFactory extends NameBasedConfigFactory array $options = null ) { $driver = parent::__invoke($container, $requestedName, $options); - $driver->setDateConverter($container->get('VuFind\Date\Converter')); + $driver->setDateConverter($container->get(\VuFind\Date\Converter::class)); return $driver; } } diff --git a/module/VuFind/src/VuFind/RecordTab/PreviewFactory.php b/module/VuFind/src/VuFind/RecordTab/PreviewFactory.php index 6a4905a9c31..9e77a5bcd53 100644 --- a/module/VuFind/src/VuFind/RecordTab/PreviewFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/PreviewFactory.php @@ -62,7 +62,7 @@ class PreviewFactory implements \Zend\ServiceManager\Factory\FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $cfg = $container->get('VuFind\Config\PluginManager')->get('config'); + $cfg = $container->get(\VuFind\Config\PluginManager::class)->get('config'); // currently only active if config [content] [previews] contains google // and googleoptions[tab] is not empty. $active = false; diff --git a/module/VuFind/src/VuFind/Related/SimilarFactory.php b/module/VuFind/src/VuFind/Related/SimilarFactory.php index 51413401179..d2278baf28f 100644 --- a/module/VuFind/src/VuFind/Related/SimilarFactory.php +++ b/module/VuFind/src/VuFind/Related/SimilarFactory.php @@ -61,6 +61,6 @@ class SimilarFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - return new $requestedName($container->get('VuFindSearch\Service')); + return new $requestedName($container->get(\VuFindSearch\Service::class)); } } diff --git a/module/VuFind/src/VuFind/Resolver/Driver/AbstractBaseFactory.php b/module/VuFind/src/VuFind/Resolver/Driver/AbstractBaseFactory.php index 0b20abfada7..0b26bf7d095 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/AbstractBaseFactory.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/AbstractBaseFactory.php @@ -58,7 +58,8 @@ class AbstractBaseFactory implements FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null ) { - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName( $config->OpenURL->url, ...($options ?: []) diff --git a/module/VuFind/src/VuFind/Resolver/Driver/DriverWithHttpClientFactory.php b/module/VuFind/src/VuFind/Resolver/Driver/DriverWithHttpClientFactory.php index ecd7e14b920..fc115b94e9a 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/DriverWithHttpClientFactory.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/DriverWithHttpClientFactory.php @@ -57,7 +57,7 @@ class DriverWithHttpClientFactory extends AbstractBaseFactory public function __invoke(ContainerInterface $container, $requestedName, array $options = null ) { - $client = $container->get('VuFindHttp\HttpService')->createClient(); + $client = $container->get(\VuFindHttp\HttpService::class)->createClient(); if ($options) { array_unshift($options, $client); } else { diff --git a/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php b/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php index 2068df49cf4..743f9c31144 100644 --- a/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php +++ b/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php @@ -96,7 +96,7 @@ class DynamicRoleProviderFactory implements FactoryInterface $config = $rbacConfig['role_provider']['VuFind\Role\DynamicRoleProvider']; // Load the permissions: - $configLoader = $serviceLocator->get('VuFind\Config\PluginManager'); + $configLoader = $serviceLocator->get(\VuFind\Config\PluginManager::class); $permissions = $configLoader->get('permissions')->toArray(); // If we're configured to map legacy settings, do so now: diff --git a/module/VuFind/src/VuFind/Role/PermissionDeniedManagerFactory.php b/module/VuFind/src/VuFind/Role/PermissionDeniedManagerFactory.php index e94d3b64d58..fe16edf2eeb 100644 --- a/module/VuFind/src/VuFind/Role/PermissionDeniedManagerFactory.php +++ b/module/VuFind/src/VuFind/Role/PermissionDeniedManagerFactory.php @@ -61,8 +61,8 @@ class PermissionDeniedManagerFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName( - $container->get('VuFind\Config\PluginManager')->get('permissionBehavior') - ); + $cfg = $container->get(\VuFind\Config\PluginManager::class) + ->get('permissionBehavior'); + return new $requestedName($cfg); } } diff --git a/module/VuFind/src/VuFind/Role/PermissionManagerFactory.php b/module/VuFind/src/VuFind/Role/PermissionManagerFactory.php index 794b33cdfab..98689092e36 100644 --- a/module/VuFind/src/VuFind/Role/PermissionManagerFactory.php +++ b/module/VuFind/src/VuFind/Role/PermissionManagerFactory.php @@ -61,11 +61,11 @@ class PermissionManagerFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $permissions = $container->get('VuFind\Config\PluginManager') + $permissions = $container->get(\VuFind\Config\PluginManager::class) ->get('permissions')->toArray(); $permManager = new $requestedName($permissions); $permManager->setAuthorizationService( - $container->get('ZfcRbac\Service\AuthorizationService') + $container->get(\ZfcRbac\Service\AuthorizationService::class) ); return $permManager; } diff --git a/module/VuFind/src/VuFind/SMS/Factory.php b/module/VuFind/src/VuFind/SMS/Factory.php index 4fb0cffb548..8344aaed638 100644 --- a/module/VuFind/src/VuFind/SMS/Factory.php +++ b/module/VuFind/src/VuFind/SMS/Factory.php @@ -58,8 +58,9 @@ class Factory implements FactoryInterface array $options = null ) { // Load configurations: - $mainConfig = $container->get('VuFind\Config\PluginManager')->get('config'); - $smsConfig = $container->get('VuFind\Config\PluginManager')->get('sms'); + $configManager = $container->get(\VuFind\Config\PluginManager::class); + $mainConfig = $configManager->get('config'); + $smsConfig = $configManager->get('sms'); // Determine SMS type: $type = isset($smsConfig->General->smsType) @@ -68,10 +69,11 @@ class Factory implements FactoryInterface // Initialize object based on requested type: switch (strtolower($type)) { case 'clickatell': - $client = $container->get('VuFindHttp\HttpService')->createClient(); + $client = $container->get(\VuFindHttp\HttpService::class) + ->createClient(); return new Clickatell($smsConfig, ['client' => $client]); case 'mailer': - $options = ['mailer' => $container->get('VuFind\Mailer\Mailer')]; + $options = ['mailer' => $container->get(\VuFind\Mailer\Mailer::class)]; if (isset($mainConfig->Site->email)) { $options['defaultFrom'] = $mainConfig->Site->email; } diff --git a/module/VuFind/src/VuFind/Search/Base/FacetCacheFactory.php b/module/VuFind/src/VuFind/Search/Base/FacetCacheFactory.php index a8286d6ff8d..fcb2add4033 100644 --- a/module/VuFind/src/VuFind/Search/Base/FacetCacheFactory.php +++ b/module/VuFind/src/VuFind/Search/Base/FacetCacheFactory.php @@ -52,7 +52,8 @@ class FacetCacheFactory implements FactoryInterface */ protected function getResults(ContainerInterface $container, $name) { - return $container->get('VuFind\Search\Results\PluginManager')->get($name); + return $container->get(\VuFind\Search\Results\PluginManager::class) + ->get($name); } /** @@ -78,8 +79,8 @@ class FacetCacheFactory implements FactoryInterface $parts = explode('\\', $requestedName); $requestedNamespace = $parts[count($parts) - 2]; $results = $this->getResults($container, $requestedNamespace); - $cacheManager = $container->get('VuFind\Cache\Manager'); - $language = $container->get('Zend\Mvc\I18n\Translator')->getLocale(); + $cacheManager = $container->get(\VuFind\Cache\Manager::class); + $language = $container->get(\Zend\Mvc\I18n\Translator::class)->getLocale(); return new $requestedName($results, $cacheManager, $language); } } diff --git a/module/VuFind/src/VuFind/Search/EDS/OptionsFactory.php b/module/VuFind/src/VuFind/Search/EDS/OptionsFactory.php index 3d32117ff0f..a274ee97746 100644 --- a/module/VuFind/src/VuFind/Search/EDS/OptionsFactory.php +++ b/module/VuFind/src/VuFind/Search/EDS/OptionsFactory.php @@ -61,11 +61,12 @@ class OptionsFactory extends \VuFind\Search\Options\OptionsFactory throw new \Exception('Unexpected options sent to factory.'); } $session = new \Zend\Session\Container( - 'EBSCO', $container->get('Zend\Session\SessionManager') + 'EBSCO', $container->get(\Zend\Session\SessionManager::class) ); // No API info in session? Re-establish connection: if (!isset($session->info)) { - $backend = $container->get('VuFind\Search\BackendManager')->get('EDS'); + $backend = $container->get(\VuFind\Search\BackendManager::class) + ->get('EDS'); $backend->getSessionToken(); } return parent::__invoke($container, $requestedName, [$session->info]); diff --git a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php index d472ca2fd7f..fd90e3e284d 100644 --- a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php @@ -148,9 +148,10 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface public function __invoke(ContainerInterface $sm, $name, array $options = null) { $this->serviceLocator = $sm; - $this->config = $this->serviceLocator->get('VuFind\Config\PluginManager'); + $this->config = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class); if ($this->serviceLocator->has('VuFind\Log\Logger')) { - $this->logger = $this->serviceLocator->get('VuFind\Log\Logger'); + $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class); } $connector = $this->createConnector(); $backend = $this->createBackend($connector); @@ -351,8 +352,9 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface $connector->setLogger($this->logger); } if ($this->serviceLocator->has('VuFindHttp\HttpService')) { - $connector - ->setProxy($this->serviceLocator->get('VuFindHttp\HttpService')); + $connector->setProxy( + $this->serviceLocator->get(\VuFindHttp\HttpService::class) + ); } return $connector; } @@ -405,7 +407,7 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface */ protected function loadSpecs() { - return $this->serviceLocator->get('VuFind\Config\SearchSpecsReader') + return $this->serviceLocator->get(\VuFind\Config\SearchSpecsReader::class) ->get($this->searchYaml); } @@ -496,7 +498,7 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface $search->ConditionalHiddenFilters->toArray() ); $listener->setAuthorizationService( - $this->serviceLocator->get('ZfcRbac\Service\AuthorizationService') + $this->serviceLocator->get(\ZfcRbac\Service\AuthorizationService::class) ); return $listener; } diff --git a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php index 13000425e3f..b2edaaeec18 100644 --- a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php @@ -83,10 +83,11 @@ class BrowZineBackendFactory implements FactoryInterface public function __invoke(ContainerInterface $sm, $name, array $options = null) { $this->serviceLocator = $sm; - $configReader = $this->serviceLocator->get('VuFind\Config\PluginManager'); + $configReader = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class); $this->browzineConfig = $configReader->get('BrowZine'); if ($this->serviceLocator->has('VuFind\Log\Logger')) { - $this->logger = $this->serviceLocator->get('VuFind\Log\Logger'); + $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class); } $connector = $this->createConnector(); @@ -125,7 +126,7 @@ class BrowZineBackendFactory implements FactoryInterface throw new \Exception("Missing library ID in BrowZine.ini"); } // Build HTTP client: - $client = $this->serviceLocator->get('VuFindHttp\HttpService') + $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->createClient(); $timeout = isset($this->browzineConfig->General->timeout) ? $this->browzineConfig->General->timeout : 30; @@ -158,7 +159,8 @@ class BrowZineBackendFactory implements FactoryInterface */ protected function createRecordCollectionFactory() { - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $callback = function ($data) use ($manager) { $driver = $manager->get('BrowZine'); $driver->setRawData($data); diff --git a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php index 6893ce0eaf8..492205e4399 100644 --- a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php @@ -84,10 +84,11 @@ class EITBackendFactory implements FactoryInterface public function __invoke(ContainerInterface $sm, $name, array $options = null) { $this->serviceLocator = $sm; - $this->config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $this->config = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class) ->get('EIT'); if ($this->serviceLocator->has('VuFind\Log\Logger')) { - $this->logger = $this->serviceLocator->get('VuFind\Log\Logger'); + $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class); } $connector = $this->createConnector(); $backend = $this->createBackend($connector); @@ -123,11 +124,9 @@ class EITBackendFactory implements FactoryInterface $base = "http://eit.ebscohost.com/Services/SearchService.asmx/Search"; $dbs = isset($this->config->General->dbs) ? $this->config->General->dbs : null; - $connector = new Connector( - $base, - $this->serviceLocator->get('VuFindHttp\HttpService')->createClient(), - $prof, $pwd, $dbs - ); + $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) + ->createClient(); + $connector = new Connector($base, $client, $prof, $pwd, $dbs); $connector->setLogger($this->logger); return $connector; } @@ -149,7 +148,8 @@ class EITBackendFactory implements FactoryInterface */ protected function createRecordCollectionFactory() { - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $callback = function ($data) use ($manager) { $driver = $manager->get('EIT'); $driver->setRawData($data); diff --git a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php index f3b2cf906f8..7213ca6c6fd 100644 --- a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php @@ -90,10 +90,11 @@ class EdsBackendFactory implements FactoryInterface public function __invoke(ContainerInterface $sm, $name, array $options = null) { $this->serviceLocator = $sm; - $this->edsConfig = $this->serviceLocator->get('VuFind\Config\PluginManager') + $this->edsConfig = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class) ->get('EDS'); if ($this->serviceLocator->has('VuFind\Log\Logger')) { - $this->logger = $this->serviceLocator->get('VuFind\Log\Logger'); + $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class); } $connector = $this->createConnector(); return $this->createBackend($connector); @@ -108,17 +109,21 @@ class EdsBackendFactory implements FactoryInterface */ protected function createBackend(Connector $connector) { - $auth = $this->serviceLocator->get('ZfcRbac\Service\AuthorizationService'); + $auth = $this->serviceLocator + ->get(\ZfcRbac\Service\AuthorizationService::class); $isGuest = !$auth->isGranted('access.EDSExtendedResults'); $session = new \Zend\Session\Container( - 'EBSCO', $this->serviceLocator->get('Zend\Session\SessionManager') + 'EBSCO', $this->serviceLocator->get(\Zend\Session\SessionManager::class) ); $backend = new Backend( $connector, $this->createRecordCollectionFactory(), - $this->serviceLocator->get('VuFind\Cache\Manager')->getCache('object'), + $this->serviceLocator->get(\VuFind\Cache\Manager::class) + ->getCache('object'), $session, $this->edsConfig, $isGuest ); - $backend->setAuthManager($this->serviceLocator->get('VuFind\Auth\Manager')); + $backend->setAuthManager( + $this->serviceLocator->get(\VuFind\Auth\Manager::class) + ); $backend->setLogger($this->logger); $backend->setQueryBuilder($this->createQueryBuilder()); return $backend; @@ -135,7 +140,7 @@ class EdsBackendFactory implements FactoryInterface $id = 'EDS'; $key = 'EDS'; // Build HTTP client: - $client = $this->serviceLocator->get('VuFindHttp\HttpService') + $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->createClient(); $timeout = isset($this->edsConfig->General->timeout) ? $this->edsConfig->General->timeout : 30; @@ -163,7 +168,8 @@ class EdsBackendFactory implements FactoryInterface */ protected function createRecordCollectionFactory() { - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $callback = function ($data) use ($manager) { $driver = $manager->get('EDS'); $driver->setRawData($data); diff --git a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php index e5cdf06beb8..1bdc9f51d2c 100644 --- a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php @@ -83,10 +83,11 @@ class LibGuidesBackendFactory implements FactoryInterface public function __invoke(ContainerInterface $sm, $name, array $options = null) { $this->serviceLocator = $sm; - $configReader = $this->serviceLocator->get('VuFind\Config\PluginManager'); + $configReader = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class); $this->libGuidesConfig = $configReader->get('LibGuides'); if ($this->serviceLocator->has('VuFind\Log\Logger')) { - $this->logger = $this->serviceLocator->get('VuFind\Log\Logger'); + $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class); } $connector = $this->createConnector(); $backend = $this->createBackend($connector); @@ -128,7 +129,7 @@ class LibGuidesBackendFactory implements FactoryInterface $baseUrl = $this->libGuidesConfig->General->baseUrl ?? null; // Build HTTP client: - $client = $this->serviceLocator->get('VuFindHttp\HttpService') + $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->createClient($baseUrl); $timeout = $this->libGuidesConfig->General->timeout ?? 30; $client->setOptions(['timeout' => $timeout]); @@ -155,7 +156,8 @@ class LibGuidesBackendFactory implements FactoryInterface */ protected function createRecordCollectionFactory() { - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $callback = function ($data) use ($manager) { $driver = $manager->get('LibGuides'); $driver->setRawData($data); diff --git a/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php index 973e7f6f193..9adbdb3fe2d 100644 --- a/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php @@ -30,6 +30,8 @@ namespace VuFind\Search\Factory; use Interop\Container\ContainerInterface; +use VuFindHttp\HttpService; + use VuFindSearch\Backend\Pazpar2\Backend; use VuFindSearch\Backend\Pazpar2\Connector; use VuFindSearch\Backend\Pazpar2\QueryBuilder; @@ -83,10 +85,11 @@ class Pazpar2BackendFactory implements FactoryInterface public function __invoke(ContainerInterface $sm, $name, array $options = null) { $this->serviceLocator = $sm; - $this->config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $this->config = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class) ->get('Pazpar2'); if ($this->serviceLocator->has('VuFind\Log\Logger')) { - $this->logger = $this->serviceLocator->get('VuFind\Log\Logger'); + $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class); } $connector = $this->createConnector(); $backend = $this->createBackend($connector); @@ -125,7 +128,7 @@ class Pazpar2BackendFactory implements FactoryInterface { $connector = new Connector( $this->config->General->base_url, - $this->serviceLocator->get('VuFindHttp\HttpService')->createClient() + $this->serviceLocator->get(HttpService::class)->createClient() ); $connector->setLogger($this->logger); return $connector; @@ -148,7 +151,8 @@ class Pazpar2BackendFactory implements FactoryInterface */ protected function createRecordCollectionFactory() { - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $callback = function ($data) use ($manager) { $driver = $manager->get('Pazpar2'); $driver->setRawData($data); diff --git a/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php index 941d93cfe91..521965c021f 100644 --- a/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php @@ -40,6 +40,8 @@ use VuFindSearch\Backend\Primo\Response\RecordCollectionFactory; use Zend\ServiceManager\Factory\FactoryInterface; +use ZfcRbac\Service\AuthorizationService; + /** * Factory for Primo Central backends. * @@ -86,10 +88,11 @@ class PrimoBackendFactory implements FactoryInterface public function __invoke(ContainerInterface $sm, $name, array $options = null) { $this->serviceLocator = $sm; - $configReader = $this->serviceLocator->get('VuFind\Config\PluginManager'); + $configReader = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class); $this->primoConfig = $configReader->get('Primo'); if ($this->serviceLocator->has('VuFind\Log\Logger')) { - $this->logger = $this->serviceLocator->get('VuFind\Log\Logger'); + $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class); } $connector = $this->createConnector(); @@ -146,7 +149,7 @@ class PrimoBackendFactory implements FactoryInterface : null; // Build HTTP client: - $client = $this->serviceLocator->get('VuFindHttp\HttpService') + $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->createClient(); $timeout = isset($this->primoConfig->General->timeout) ? $this->primoConfig->General->timeout : 30; @@ -177,7 +180,8 @@ class PrimoBackendFactory implements FactoryInterface */ protected function createRecordCollectionFactory() { - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $callback = function ($data) use ($manager) { $driver = $manager->get('Primo'); $driver->setRawData($data); @@ -209,7 +213,7 @@ class PrimoBackendFactory implements FactoryInterface $this->primoConfig->Institutions ); $permHandler->setAuthorizationService( - $this->serviceLocator->get('ZfcRbac\Service\AuthorizationService') + $this->serviceLocator->get(AuthorizationService::class) ); return $permHandler; } diff --git a/module/VuFind/src/VuFind/Search/Factory/SolrAuthBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SolrAuthBackendFactory.php index df3086ddba7..eb31d8319da 100644 --- a/module/VuFind/src/VuFind/Search/Factory/SolrAuthBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/SolrAuthBackendFactory.php @@ -74,7 +74,8 @@ class SolrAuthBackendFactory extends AbstractSolrBackendFactory protected function createBackend(Connector $connector) { $backend = parent::createBackend($connector); - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $factory = new RecordCollectionFactory([$manager, 'getSolrAuthRecord']); $backend->setRecordCollectionFactory($factory); return $backend; diff --git a/module/VuFind/src/VuFind/Search/Factory/SolrDefaultBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SolrDefaultBackendFactory.php index 2afeae41f39..55f9cd0cabd 100644 --- a/module/VuFind/src/VuFind/Search/Factory/SolrDefaultBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/SolrDefaultBackendFactory.php @@ -76,7 +76,8 @@ class SolrDefaultBackendFactory extends AbstractSolrBackendFactory protected function createBackend(Connector $connector) { $backend = parent::createBackend($connector); - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $factory = new RecordCollectionFactory([$manager, 'getSolrRecord']); $backend->setRecordCollectionFactory($factory); return $backend; diff --git a/module/VuFind/src/VuFind/Search/Factory/SolrReservesBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SolrReservesBackendFactory.php index ac30b4323d8..d26627f417b 100644 --- a/module/VuFind/src/VuFind/Search/Factory/SolrReservesBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/SolrReservesBackendFactory.php @@ -64,7 +64,8 @@ class SolrReservesBackendFactory extends AbstractSolrBackendFactory protected function createBackend(Connector $connector) { $backend = parent::createBackend($connector); - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $callback = function ($data) use ($manager) { $driver = $manager->get('SolrReserves'); $driver->setRawData($data); diff --git a/module/VuFind/src/VuFind/Search/Factory/SolrWebBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SolrWebBackendFactory.php index b2cb3f8377d..a0e0fce2b47 100644 --- a/module/VuFind/src/VuFind/Search/Factory/SolrWebBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/SolrWebBackendFactory.php @@ -91,7 +91,8 @@ class SolrWebBackendFactory extends AbstractSolrBackendFactory protected function createBackend(Connector $connector) { $backend = parent::createBackend($connector); - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $callback = function ($data) use ($manager) { $driver = $manager->get('SolrWeb'); $driver->setRawData($data); diff --git a/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php index 45f4811ee56..73cd064b5d0 100644 --- a/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php @@ -91,11 +91,12 @@ class SummonBackendFactory implements FactoryInterface public function __invoke(ContainerInterface $sm, $name, array $options = null) { $this->serviceLocator = $sm; - $configReader = $this->serviceLocator->get('VuFind\Config\PluginManager'); + $configReader = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class); $this->config = $configReader->get('config'); $this->summonConfig = $configReader->get('Summon'); if ($this->serviceLocator->has('VuFind\Log\Logger')) { - $this->logger = $this->serviceLocator->get('VuFind\Log\Logger'); + $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class); } $connector = $this->createConnector(); $backend = $this->createBackend($connector); @@ -131,7 +132,7 @@ class SummonBackendFactory implements FactoryInterface ? $this->config->Summon->apiKey : null; // Build HTTP client: - $client = $this->serviceLocator->get('VuFindHttp\HttpService') + $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->createClient(); $timeout = isset($this->summonConfig->General->timeout) ? $this->summonConfig->General->timeout : 30; @@ -150,7 +151,8 @@ class SummonBackendFactory implements FactoryInterface */ protected function isAuthed() { - return $this->serviceLocator->get('ZfcRbac\Service\AuthorizationService') + return $this->serviceLocator + ->get(\ZfcRbac\Service\AuthorizationService::class) ->isGranted('access.SummonExtendedResults'); } @@ -177,7 +179,8 @@ class SummonBackendFactory implements FactoryInterface */ protected function createRecordCollectionFactory() { - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $stripSnippets = !isset($this->summonConfig->General->snippets) || !$this->summonConfig->General->snippets; $callback = function ($data) use ($manager, $stripSnippets) { diff --git a/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php index 92ac5ab10e2..4cfa0e7bd05 100644 --- a/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php @@ -90,12 +90,13 @@ class WorldCatBackendFactory implements FactoryInterface public function __invoke(ContainerInterface $sm, $name, array $options = null) { $this->serviceLocator = $sm; - $this->config = $this->serviceLocator->get('VuFind\Config\PluginManager') + $this->config = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class) ->get('config'); $this->wcConfig = $this->serviceLocator - ->get('VuFind\Config\PluginManager')->get('WorldCat'); + ->get(\VuFind\Config\PluginManager::class)->get('WorldCat'); if ($this->serviceLocator->has('VuFind\Log\Logger')) { - $this->logger = $this->serviceLocator->get('VuFind\Log\Logger'); + $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class); } $connector = $this->createConnector(); $backend = $this->createBackend($connector); @@ -128,11 +129,9 @@ class WorldCatBackendFactory implements FactoryInterface ? $this->config->WorldCat->apiKey : null; $connectorOptions = isset($this->wcConfig->Connector) ? $this->wcConfig->Connector->toArray() : []; - $connector = new Connector( - $wsKey, - $this->serviceLocator->get('VuFindHttp\HttpService')->createClient(), - $connectorOptions - ); + $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) + ->createClient(); + $connector = new Connector($wsKey, $client, $connectorOptions); $connector->setLogger($this->logger); return $connector; } @@ -156,7 +155,8 @@ class WorldCatBackendFactory implements FactoryInterface */ protected function createRecordCollectionFactory() { - $manager = $this->serviceLocator->get('VuFind\RecordDriver\PluginManager'); + $manager = $this->serviceLocator + ->get(\VuFind\RecordDriver\PluginManager::class); $callback = function ($data) use ($manager) { $driver = $manager->get('WorldCat'); $driver->setRawData($data); diff --git a/module/VuFind/src/VuFind/Search/Favorites/ResultsFactory.php b/module/VuFind/src/VuFind/Search/Favorites/ResultsFactory.php index cdb78e616aa..fe13ff91d9f 100644 --- a/module/VuFind/src/VuFind/Search/Favorites/ResultsFactory.php +++ b/module/VuFind/src/VuFind/Search/Favorites/ResultsFactory.php @@ -60,7 +60,7 @@ class ResultsFactory extends \VuFind\Search\Results\ResultsFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory!'); } - $tm = $container->get('VuFind\Db\Table\PluginManager'); + $tm = $container->get(\VuFind\Db\Table\PluginManager::class); $obj = parent::__invoke( $container, $requestedName, [$tm->get('Resource'), $tm->get('UserList')] diff --git a/module/VuFind/src/VuFind/Search/HistoryFactory.php b/module/VuFind/src/VuFind/Search/HistoryFactory.php index ac418e347a8..893a2431c31 100644 --- a/module/VuFind/src/VuFind/Search/HistoryFactory.php +++ b/module/VuFind/src/VuFind/Search/HistoryFactory.php @@ -61,10 +61,11 @@ class HistoryFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $searchTable = $container->get('VuFind\Db\Table\PluginManager') + $searchTable = $container->get(\VuFind\Db\Table\PluginManager::class) ->get('Search'); - $resultsManager = $container->get('VuFind\Search\Results\PluginManager'); - $sessionId = $container->get('Zend\Session\SessionManager')->getId(); + $resultsManager = $container + ->get(\VuFind\Search\Results\PluginManager::class); + $sessionId = $container->get(\Zend\Session\SessionManager::class)->getId(); return new $requestedName($searchTable, $sessionId, $resultsManager); } } diff --git a/module/VuFind/src/VuFind/Search/MemoryFactory.php b/module/VuFind/src/VuFind/Search/MemoryFactory.php index 1e19eb540be..a54cdebc952 100644 --- a/module/VuFind/src/VuFind/Search/MemoryFactory.php +++ b/module/VuFind/src/VuFind/Search/MemoryFactory.php @@ -63,7 +63,7 @@ class MemoryFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } $session = new Container( - 'Search', $container->get('Zend\Session\SessionManager') + 'Search', $container->get(\Zend\Session\SessionManager::class) ); return new $requestedName($session); } diff --git a/module/VuFind/src/VuFind/Search/Options/OptionsFactory.php b/module/VuFind/src/VuFind/Search/Options/OptionsFactory.php index e2f1da2d1db..1c08cfddbca 100644 --- a/module/VuFind/src/VuFind/Search/Options/OptionsFactory.php +++ b/module/VuFind/src/VuFind/Search/Options/OptionsFactory.php @@ -59,7 +59,7 @@ class OptionsFactory implements FactoryInterface array $options = null ) { return new $requestedName( - $container->get('VuFind\Config\PluginManager'), ...($options ?: []) + $container->get(\VuFind\Config\PluginManager::class), ...($options ?: []) ); } } diff --git a/module/VuFind/src/VuFind/Search/Options/PluginFactory.php b/module/VuFind/src/VuFind/Search/Options/PluginFactory.php index 586152dd6e3..46bbf7db4be 100644 --- a/module/VuFind/src/VuFind/Search/Options/PluginFactory.php +++ b/module/VuFind/src/VuFind/Search/Options/PluginFactory.php @@ -64,6 +64,6 @@ class PluginFactory extends \VuFind\ServiceManager\AbstractPluginFactory array $options = null ) { $class = $this->getClassName($requestedName); - return new $class($container->get('VuFind\Config\PluginManager')); + return new $class($container->get(\VuFind\Config\PluginManager::class)); } } diff --git a/module/VuFind/src/VuFind/Search/Params/ParamsFactory.php b/module/VuFind/src/VuFind/Search/Params/ParamsFactory.php index 1cfdfb3bd1d..5e1fe1b80dd 100644 --- a/module/VuFind/src/VuFind/Search/Params/ParamsFactory.php +++ b/module/VuFind/src/VuFind/Search/Params/ParamsFactory.php @@ -60,9 +60,9 @@ class ParamsFactory implements FactoryInterface ) { // Replace trailing "Params" with "Options" to get the options service: $optionsService = preg_replace('/Params$/', 'Options', $requestedName); - $optionsObj = $container->get('VuFind\Search\Options\PluginManager') + $optionsObj = $container->get(\VuFind\Search\Options\PluginManager::class) ->get($optionsService); - $configLoader = $container->get('VuFind\Config\PluginManager'); + $configLoader = $container->get(\VuFind\Config\PluginManager::class); // Clone the options instance in case caller modifies it: return new $requestedName( clone $optionsObj, $configLoader, ...($options ?: []) diff --git a/module/VuFind/src/VuFind/Search/Params/PluginFactory.php b/module/VuFind/src/VuFind/Search/Params/PluginFactory.php index 4c4b7aa45ce..8e6c5eea67b 100644 --- a/module/VuFind/src/VuFind/Search/Params/PluginFactory.php +++ b/module/VuFind/src/VuFind/Search/Params/PluginFactory.php @@ -64,10 +64,10 @@ class PluginFactory extends \VuFind\ServiceManager\AbstractPluginFactory array $extras = null ) { $optionsService = preg_replace('/Params$/', 'Options', $requestedName); - $options = $container->get('VuFind\Search\Options\PluginManager') + $options = $container->get(\VuFind\Search\Options\PluginManager::class) ->get($optionsService); $class = $this->getClassName($requestedName); - $configLoader = $container->get('VuFind\Config\PluginManager'); + $configLoader = $container->get(\VuFind\Config\PluginManager::class); // Clone the options instance in case caller modifies it: return new $class(clone $options, $configLoader, ...($extras ?: [])); } diff --git a/module/VuFind/src/VuFind/Search/Results/PluginFactory.php b/module/VuFind/src/VuFind/Search/Results/PluginFactory.php index 022d9c17d89..3466c884e4c 100644 --- a/module/VuFind/src/VuFind/Search/Results/PluginFactory.php +++ b/module/VuFind/src/VuFind/Search/Results/PluginFactory.php @@ -64,10 +64,10 @@ class PluginFactory extends \VuFind\ServiceManager\AbstractPluginFactory array $extras = null ) { $paramsService = preg_replace('/Results$/', 'Params', $requestedName); - $params = $container->get('VuFind\Search\Params\PluginManager') + $params = $container->get(\VuFind\Search\Params\PluginManager::class) ->get($paramsService); - $searchService = $container->get('VuFindSearch\Service'); - $recordLoader = $container->get('VuFind\Record\Loader'); + $searchService = $container->get(\VuFindSearch\Service::class); + $recordLoader = $container->get(\VuFind\Record\Loader::class); $class = $this->getClassName($requestedName); return new $class( $params, $searchService, $recordLoader, ...($extras ?: []) diff --git a/module/VuFind/src/VuFind/Search/Results/ResultsFactory.php b/module/VuFind/src/VuFind/Search/Results/ResultsFactory.php index fe05add028f..cc7bf07726f 100644 --- a/module/VuFind/src/VuFind/Search/Results/ResultsFactory.php +++ b/module/VuFind/src/VuFind/Search/Results/ResultsFactory.php @@ -60,10 +60,10 @@ class ResultsFactory implements FactoryInterface ) { // Replace trailing "Results" with "Params" to get the params service: $paramsService = preg_replace('/Results$/', 'Params', $requestedName); - $params = $container->get('VuFind\Search\Params\PluginManager') + $params = $container->get(\VuFind\Search\Params\PluginManager::class) ->get($paramsService); - $searchService = $container->get('VuFindSearch\Service'); - $recordLoader = $container->get('VuFind\Record\Loader'); + $searchService = $container->get(\VuFindSearch\Service::class); + $recordLoader = $container->get(\VuFind\Record\Loader::class); return new $requestedName( $params, $searchService, $recordLoader, ...($options ?: []) ); diff --git a/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php b/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php index 11d75b5bfb0..52716e06bcc 100644 --- a/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php +++ b/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php @@ -58,7 +58,8 @@ class ResultsFactory extends \VuFind\Search\Results\ResultsFactory array $options = null ) { $solr = parent::__invoke($container, $requestedName, $options); - $config = $container->get('VuFind\Config\PluginManager')->get('Search2'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('Search2'); $solr->setSpellingProcessor( new \VuFind\Search\Solr\SpellingProcessor($config->Spelling ?? null) ); diff --git a/module/VuFind/src/VuFind/Search/SearchRunnerFactory.php b/module/VuFind/src/VuFind/Search/SearchRunnerFactory.php index d7ed6bd3b97..135bd7e5942 100644 --- a/module/VuFind/src/VuFind/Search/SearchRunnerFactory.php +++ b/module/VuFind/src/VuFind/Search/SearchRunnerFactory.php @@ -63,7 +63,7 @@ class SearchRunnerFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Search\Results\PluginManager'), + $container->get(\VuFind\Search\Results\PluginManager::class), new EventManager($container->get('SharedEventManager')) ); } diff --git a/module/VuFind/src/VuFind/Search/SearchTabsHelperFactory.php b/module/VuFind/src/VuFind/Search/SearchTabsHelperFactory.php index 932742f3da7..136ab2b5d64 100644 --- a/module/VuFind/src/VuFind/Search/SearchTabsHelperFactory.php +++ b/module/VuFind/src/VuFind/Search/SearchTabsHelperFactory.php @@ -61,7 +61,8 @@ class SearchTabsHelperFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $tabConfig = isset($config->SearchTabs) ? $config->SearchTabs->toArray() : []; $filterConfig = isset($config->SearchTabsFilters) @@ -69,7 +70,7 @@ class SearchTabsHelperFactory implements FactoryInterface $permissionConfig = isset($config->SearchTabsPermissions) ? $config->SearchTabsPermissions->toArray() : []; return new $requestedName( - $container->get('VuFind\Search\Results\PluginManager'), + $container->get(\VuFind\Search\Results\PluginManager::class), $tabConfig, $filterConfig, $container->get('Application')->getRequest(), $permissionConfig ); diff --git a/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php b/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php index 37869df1ff7..4c987a65edf 100644 --- a/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php +++ b/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php @@ -183,7 +183,7 @@ class DeduplicationListener */ protected function fetchLocalRecords($event) { - $config = $this->serviceLocator->get('VuFind\Config\PluginManager'); + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class); $searchConfig = $config->get($this->searchConfig); $dataSourceConfig = $config->get($this->dataSourceConfig); $recordSources = !empty($searchConfig->Records->sources) diff --git a/module/VuFind/src/VuFind/Search/Solr/FacetCacheFactory.php b/module/VuFind/src/VuFind/Search/Solr/FacetCacheFactory.php index 9edfd6ba3d4..61a09306743 100644 --- a/module/VuFind/src/VuFind/Search/Solr/FacetCacheFactory.php +++ b/module/VuFind/src/VuFind/Search/Solr/FacetCacheFactory.php @@ -51,9 +51,9 @@ class FacetCacheFactory extends \VuFind\Search\Base\FacetCacheFactory */ protected function getResults(ContainerInterface $container, $name) { - $filters = $container->get('VuFind\Search\SearchTabsHelper') + $filters = $container->get(\VuFind\Search\SearchTabsHelper::class) ->getHiddenFilters($name); - $results = $container->get('VuFind\Search\Results\PluginManager') + $results = $container->get(\VuFind\Search\Results\PluginManager::class) ->get($name); $params = $results->getParams(); foreach ($filters as $key => $subFilters) { diff --git a/module/VuFind/src/VuFind/Search/Solr/HierarchicalFacetListener.php b/module/VuFind/src/VuFind/Search/Solr/HierarchicalFacetListener.php index ac99cd2371f..96052f2c2b5 100644 --- a/module/VuFind/src/VuFind/Search/Solr/HierarchicalFacetListener.php +++ b/module/VuFind/src/VuFind/Search/Solr/HierarchicalFacetListener.php @@ -107,10 +107,10 @@ class HierarchicalFacetListener $this->backend = $backend; $this->serviceLocator = $serviceLocator; - $config = $this->serviceLocator->get('VuFind\Config\PluginManager'); + $config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class); $this->facetConfig = $config->get($facetConfig); $this->facetHelper = $this->serviceLocator - ->get('VuFind\Search\Solr\HierarchicalFacetHelper'); + ->get(\VuFind\Search\Solr\HierarchicalFacetHelper::class); $specialFacets = $this->facetConfig->SpecialFacets; $this->displayStyles diff --git a/module/VuFind/src/VuFind/Search/Solr/ParamsFactory.php b/module/VuFind/src/VuFind/Search/Solr/ParamsFactory.php index 5e6fa1aed65..a8acce3f6f8 100644 --- a/module/VuFind/src/VuFind/Search/Solr/ParamsFactory.php +++ b/module/VuFind/src/VuFind/Search/Solr/ParamsFactory.php @@ -60,7 +60,8 @@ class ParamsFactory extends \VuFind\Search\Params\ParamsFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $helper = $container->get('VuFind\Search\Solr\HierarchicalFacetHelper'); + $helper = $container + ->get(\VuFind\Search\Solr\HierarchicalFacetHelper::class); return parent::__invoke($container, $requestedName, [$helper]); } } diff --git a/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php b/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php index 5eea28ca728..f2affd7464b 100644 --- a/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php +++ b/module/VuFind/src/VuFind/Search/Solr/ResultsFactory.php @@ -58,7 +58,8 @@ class ResultsFactory extends \VuFind\Search\Results\ResultsFactory array $options = null ) { $solr = parent::__invoke($container, $requestedName, $options); - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $solr->setSpellingProcessor( new \VuFind\Search\Solr\SpellingProcessor($config->Spelling ?? null) ); diff --git a/module/VuFind/src/VuFind/Search/Tags/ResultsFactory.php b/module/VuFind/src/VuFind/Search/Tags/ResultsFactory.php index 513966b94b2..f2da46495be 100644 --- a/module/VuFind/src/VuFind/Search/Tags/ResultsFactory.php +++ b/module/VuFind/src/VuFind/Search/Tags/ResultsFactory.php @@ -60,7 +60,7 @@ class ResultsFactory extends \VuFind\Search\Results\ResultsFactory if (!empty($options)) { throw new \Exception('Unexpected options sent to factory!'); } - $tm = $container->get('VuFind\Db\Table\PluginManager'); + $tm = $container->get(\VuFind\Db\Table\PluginManager::class); return parent::__invoke($container, $requestedName, [$tm->get('Tags')]); } } diff --git a/module/VuFind/src/VuFind/Service/DateConverterFactory.php b/module/VuFind/src/VuFind/Service/DateConverterFactory.php index 2df544f7bad..5e9a7eb11dd 100644 --- a/module/VuFind/src/VuFind/Service/DateConverterFactory.php +++ b/module/VuFind/src/VuFind/Service/DateConverterFactory.php @@ -63,7 +63,8 @@ class DateConverterFactory implements FactoryInterface } // Pass along key [Site] settings: displayDateFormat, displayTimeFormat, // timezone - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $settings = isset($config->Site) ? $config->Site->toArray() : []; return new $requestedName($settings); } diff --git a/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php b/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php index 3719d3e7c74..336bb0c1e55 100644 --- a/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php +++ b/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php @@ -61,7 +61,8 @@ class ReCaptchaFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $siteKey = isset($config->Captcha->siteKey) ? $config->Captcha->siteKey : (isset($config->Captcha->publicKey) @@ -72,8 +73,9 @@ class ReCaptchaFactory implements FactoryInterface : (isset($config->Captcha->privateKey) ? $config->Captcha->privateKey : ''); - $httpClient = $container->get('VuFindHttp\HttpService')->createClient(); - $translator = $container->get('Zend\Mvc\I18n\Translator'); + $httpClient = $container->get(\VuFindHttp\HttpService::class) + ->createClient(); + $translator = $container->get(\Zend\Mvc\I18n\Translator::class); $rcOptions = ['lang' => $translator->getLocale()]; if (isset($config->Captcha->theme)) { $rcOptions['theme'] = $config->Captcha->theme; diff --git a/module/VuFind/src/VuFind/Service/ServiceWithConfigIniFactory.php b/module/VuFind/src/VuFind/Service/ServiceWithConfigIniFactory.php index ecba0637e88..139181674a3 100644 --- a/module/VuFind/src/VuFind/Service/ServiceWithConfigIniFactory.php +++ b/module/VuFind/src/VuFind/Service/ServiceWithConfigIniFactory.php @@ -58,7 +58,8 @@ class ServiceWithConfigIniFactory implements FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null ) { - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($config, ...($options ?: [])); } } diff --git a/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php b/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php index f383c4515ac..7aa68764eb3 100644 --- a/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php +++ b/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php @@ -54,7 +54,7 @@ class ServiceInitializer implements InitializerInterface static $enabled = null; if (null === $enabled) { // Return true if Record Cache is enabled for any data source - $cacheConfig = $sm->get('VuFind\Config\PluginManager') + $cacheConfig = $sm->get(\VuFind\Config\PluginManager::class) ->get('RecordCache'); $enabled = false; foreach ($cacheConfig as $section) { @@ -82,22 +82,24 @@ class ServiceInitializer implements InitializerInterface public function __invoke(ContainerInterface $sm, $instance) { if ($instance instanceof \VuFind\Db\Table\DbTableAwareInterface) { - $instance->setDbTableManager($sm->get('VuFind\Db\Table\PluginManager')); + $instance->setDbTableManager( + $sm->get(\VuFind\Db\Table\PluginManager::class) + ); } if ($instance instanceof \Zend\Log\LoggerAwareInterface) { - $instance->setLogger($sm->get('VuFind\Log\Logger')); + $instance->setLogger($sm->get(\VuFind\Log\Logger::class)); } if ($instance instanceof \VuFind\I18n\Translator\TranslatorAwareInterface) { - $instance->setTranslator($sm->get('Zend\Mvc\I18n\Translator')); + $instance->setTranslator($sm->get(\Zend\Mvc\I18n\Translator::class)); } if ($instance instanceof \VuFindHttp\HttpServiceAwareInterface) { - $instance->setHttpService($sm->get('VuFindHttp\HttpService')); + $instance->setHttpService($sm->get(\VuFindHttp\HttpService::class)); } // Only inject cache if configuration enabled (to save resources): if ($instance instanceof \VuFind\Record\Cache\RecordCacheAwareInterface && $this->isCacheEnabled($sm) ) { - $instance->setRecordCache($sm->get('VuFind\Record\Cache')); + $instance->setRecordCache($sm->get(\VuFind\Record\Cache::class)); } return $instance; } diff --git a/module/VuFind/src/VuFind/Session/ManagerFactory.php b/module/VuFind/src/VuFind/Session/ManagerFactory.php index 10757084262..2995052263d 100644 --- a/module/VuFind/src/VuFind/Session/ManagerFactory.php +++ b/module/VuFind/src/VuFind/Session/ManagerFactory.php @@ -53,7 +53,7 @@ class ManagerFactory implements FactoryInterface */ protected function getOptions(ContainerInterface $container) { - $cookieManager = $container->get('VuFind\Cookie\CookieManager'); + $cookieManager = $container->get(\VuFind\Cookie\CookieManager::class); // Set options only if we are not running from CLI $options = 'cli' !== PHP_SAPI ? [ 'cookie_httponly' => $cookieManager->isHttpOnly(), @@ -85,12 +85,14 @@ class ManagerFactory implements FactoryInterface protected function getHandler(ContainerInterface $container) { // Load and validate session configuration: - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); if (!isset($config->Session->type)) { throw new \Exception('Cannot initialize session; configuration missing'); } - $sessionPluginManager = $container->get('VuFind\Session\PluginManager'); + $sessionPluginManager = $container + ->get(\VuFind\Session\PluginManager::class); $sessionHandler = $sessionPluginManager->get($config->Session->type); $sessionHandler->setConfig($config->Session); return $sessionHandler; @@ -171,7 +173,7 @@ class ManagerFactory implements FactoryInterface // Check if we need to immediately stop it based on the settings object // (which may have been informed by a controller that sessions should not // be written as part of the current process): - $settings = $container->get('VuFind\Session\Settings'); + $settings = $container->get(\VuFind\Session\Settings::class); if ($settings->setSessionManager($sessionManager)->isWriteDisabled()) { $sessionManager->getSaveHandler()->disableWrites(); } else { diff --git a/module/VuFind/src/VuFind/Session/SecureDelegatorFactory.php b/module/VuFind/src/VuFind/Session/SecureDelegatorFactory.php index edfb35daf94..fd370367314 100644 --- a/module/VuFind/src/VuFind/Session/SecureDelegatorFactory.php +++ b/module/VuFind/src/VuFind/Session/SecureDelegatorFactory.php @@ -67,7 +67,7 @@ class SecureDelegatorFactory implements DelegatorFactoryInterface * @var HandlerInterface $handler */ $handler = call_user_func($callback); - $config = $container->get('VuFind\Config\PluginManager'); + $config = $container->get(\VuFind\Config\PluginManager::class); $secure = $config->get('config')->Session->secure ?? false; return $secure ? $this->delegate($container, $handler) : $handler; } @@ -83,8 +83,8 @@ class SecureDelegatorFactory implements DelegatorFactoryInterface protected function delegate( ContainerInterface $container, HandlerInterface $handler ): HandlerInterface { - $cookieManager = $container->get('VuFind\Cookie\CookieManager'); - $config = $container->get('ProxyManager\Configuration'); + $cookieManager = $container->get(\VuFind\Cookie\CookieManager::class); + $config = $container->get(\ProxyManager\Configuration::class); $factory = new LazyLoadingValueHolderFactory($config); $delegator = new SecureDelegator($cookieManager, $handler); /** diff --git a/module/VuFind/src/VuFind/Solr/WriterFactory.php b/module/VuFind/src/VuFind/Solr/WriterFactory.php index e37493415f5..729499db6fe 100644 --- a/module/VuFind/src/VuFind/Solr/WriterFactory.php +++ b/module/VuFind/src/VuFind/Solr/WriterFactory.php @@ -61,9 +61,10 @@ class WriterFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } + $changeTracker = $container->get(\VuFind\Db\Table\PluginManager::class) + ->get('changetracker'); return new $requestedName( - $container->get('VuFind\Search\BackendManager'), - $container->get('VuFind\Db\Table\PluginManager')->get('changetracker') + $container->get(\VuFind\Search\BackendManager::class), $changeTracker ); } } diff --git a/module/VuFind/src/VuFind/TagsFactory.php b/module/VuFind/src/VuFind/TagsFactory.php index 58e5c5222c4..d32fbd03cd5 100644 --- a/module/VuFind/src/VuFind/TagsFactory.php +++ b/module/VuFind/src/VuFind/TagsFactory.php @@ -61,7 +61,8 @@ class TagsFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $maxLength = isset($config->Social->max_tag_length) ? $config->Social->max_tag_length : 64; return new $requestedName($maxLength); diff --git a/module/VuFind/src/VuFind/Validator/CsrfFactory.php b/module/VuFind/src/VuFind/Validator/CsrfFactory.php index e50365789b6..c41ee838e0a 100644 --- a/module/VuFind/src/VuFind/Validator/CsrfFactory.php +++ b/module/VuFind/src/VuFind/Validator/CsrfFactory.php @@ -66,8 +66,9 @@ class CsrfFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); - $sessionManager = $container->get('Zend\Session\SessionManager'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); + $sessionManager = $container->get(\Zend\Session\SessionManager::class); return new $requestedName( [ 'session' => new \Zend\Session\Container('csrf', $sessionManager), diff --git a/module/VuFind/src/VuFind/View/Helper/Bootstrap3/LayoutClassFactory.php b/module/VuFind/src/VuFind/View/Helper/Bootstrap3/LayoutClassFactory.php index 8703255b271..e991df5bbcf 100644 --- a/module/VuFind/src/VuFind/View/Helper/Bootstrap3/LayoutClassFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Bootstrap3/LayoutClassFactory.php @@ -61,7 +61,8 @@ class LayoutClassFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $sidebarOnLeft = $config->Site->sidebarOnLeft ?? false; $mirror = $config->Site->mirrorSidebarInRTL ?? true; $offcanvas = $config->Site->offcanvas ?? false; diff --git a/module/VuFind/src/VuFind/View/Helper/Root/AccountCapabilitiesFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/AccountCapabilitiesFactory.php index f3f1bfc0052..49074080385 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/AccountCapabilitiesFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/AccountCapabilitiesFactory.php @@ -62,7 +62,7 @@ class AccountCapabilitiesFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Config\AccountCapabilities') + $container->get(\VuFind\Config\AccountCapabilities::class) ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/AddThisFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/AddThisFactory.php index ec73c23d32b..a23df23148a 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/AddThisFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/AddThisFactory.php @@ -61,7 +61,8 @@ class AddThisFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($config->AddThis->key ?? false); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/AuthFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/AuthFactory.php index e90a0280cd3..2efae01d336 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/AuthFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/AuthFactory.php @@ -62,8 +62,8 @@ class AuthFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Auth\Manager'), - $container->get('VuFind\Auth\ILSAuthenticator') + $container->get(\VuFind\Auth\Manager::class), + $container->get(\VuFind\Auth\ILSAuthenticator::class) ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/AuthorNotesFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/AuthorNotesFactory.php index e90a0280cd3..2efae01d336 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/AuthorNotesFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/AuthorNotesFactory.php @@ -62,8 +62,8 @@ class AuthFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Auth\Manager'), - $container->get('VuFind\Auth\ILSAuthenticator') + $container->get(\VuFind\Auth\Manager::class), + $container->get(\VuFind\Auth\ILSAuthenticator::class) ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/CartFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/CartFactory.php index b9b69a13f99..9729a026d97 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/CartFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/CartFactory.php @@ -61,6 +61,6 @@ class CartFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\Cart')); + return new $requestedName($container->get(\VuFind\Cart::class)); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/CitationFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/CitationFactory.php index 18a6a4b9a50..7791872b75b 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/CitationFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/CitationFactory.php @@ -61,6 +61,6 @@ class CitationFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\Date\Converter')); + return new $requestedName($container->get(\VuFind\Date\Converter::class)); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/ConfigFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/ConfigFactory.php index cdaa4507258..d9f7d02f89b 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/ConfigFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/ConfigFactory.php @@ -61,6 +61,8 @@ class ConfigFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\Config\PluginManager')); + return new $requestedName( + $container->get(\VuFind\Config\PluginManager::class) + ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/ContentLoaderFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/ContentLoaderFactory.php index fc4a74f8854..295182cd465 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/ContentLoaderFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/ContentLoaderFactory.php @@ -64,7 +64,7 @@ class ContentLoaderFactory implements FactoryInterface // Use the requested service name to look up the appropriate content loader: $parts = explode('\\', $requestedName); $type = strtolower(array_pop($parts)); - $loader = $container->get('VuFind\Content\PluginManager')->get($type); + $loader = $container->get(\VuFind\Content\PluginManager::class)->get($type); return new ContentLoader($loader); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/DateTimeFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/DateTimeFactory.php index f86154c1c95..79f704c5974 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/DateTimeFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/DateTimeFactory.php @@ -61,6 +61,6 @@ class DateTimeFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\Date\Converter')); + return new $requestedName($container->get(\VuFind\Date\Converter::class)); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/DoiFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/DoiFactory.php index b552966621c..a64e6f8dd38 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/DoiFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/DoiFactory.php @@ -61,7 +61,8 @@ class DoiFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $helpers = $container->get('ViewHelperManager'); return new $requestedName($helpers->get('context'), $config->DOI ?? null); } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/ExportFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/ExportFactory.php index f61d09e9205..bc94baeee8d 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/ExportFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/ExportFactory.php @@ -61,6 +61,6 @@ class ExportFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\Export')); + return new $requestedName($container->get(\VuFind\Export::class)); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/FeedbackFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/FeedbackFactory.php index 120bd276a05..4ac80ea0b6d 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/FeedbackFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/FeedbackFactory.php @@ -61,7 +61,8 @@ class FeedbackFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($config->Feedback->tab_enabled ?? false); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/FlashmessagesFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/FlashmessagesFactory.php index bcd67fff84f..2512310196f 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/FlashmessagesFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/FlashmessagesFactory.php @@ -62,7 +62,7 @@ class FlashmessagesFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } $messenger = $container->get('ControllerPluginManager') - ->get('Zend\Mvc\Plugin\FlashMessenger\FlashMessenger'); + ->get(\Zend\Mvc\Plugin\FlashMessenger\FlashMessenger::class); return new $requestedName($messenger); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/GeoCoordsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/GeoCoordsFactory.php index 5627bdf90df..92b36992aab 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/GeoCoordsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/GeoCoordsFactory.php @@ -61,7 +61,7 @@ class GeoCoordsFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\GeoFeatures\MapSelectionConfig') + $config = $container->get(\VuFind\GeoFeatures\MapSelectionConfig::class) ->getMapSelectionOptions(); return new $requestedName($config['default_coordinates']); } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/GoogleAnalyticsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/GoogleAnalyticsFactory.php index 0d63b823b6a..b33603241ef 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/GoogleAnalyticsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/GoogleAnalyticsFactory.php @@ -61,7 +61,8 @@ class GoogleAnalyticsFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $key = $config->GoogleAnalytics->apiKey ?? false; $universal = $config->GoogleAnalytics->universal ?? false; return new $requestedName($key, $universal); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/HelpTextFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/HelpTextFactory.php index 218894eec93..ded2534fc12 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/HelpTextFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/HelpTextFactory.php @@ -62,7 +62,7 @@ class HelpTextFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } $lang = $container->has('Zend\Mvc\I18n\Translator') - ? $container->get('Zend\Mvc\I18n\Translator')->getLocale() + ? $container->get(\Zend\Mvc\I18n\Translator::class)->getLocale() : 'en'; $helpers = $container->get('ViewHelperManager'); return new $requestedName($helpers->get('context'), $lang); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/HistoryLabelFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/HistoryLabelFactory.php index b41a08cf1d0..d8af099ef3e 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/HistoryLabelFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/HistoryLabelFactory.php @@ -61,7 +61,8 @@ class HistoryLabelFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $labels = isset($config->SearchHistoryLabels) ? $config->SearchHistoryLabels->toArray() : []; $helpers = $container->get('ViewHelperManager'); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/IlsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/IlsFactory.php index b83f818ee9c..bbe1f26ba02 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/IlsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/IlsFactory.php @@ -61,6 +61,6 @@ class IlsFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\ILS\Connection')); + return new $requestedName($container->get(\VuFind\ILS\Connection::class)); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/KeepAliveFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/KeepAliveFactory.php index 603b351ce93..3af02a7f9fe 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/KeepAliveFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/KeepAliveFactory.php @@ -61,7 +61,8 @@ class KeepAliveFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($config->Session->keepAlive ?? 0); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/OpenUrlFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/OpenUrlFactory.php index fc3ed6bd875..b0dd989ff10 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/OpenUrlFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/OpenUrlFactory.php @@ -61,7 +61,8 @@ class OpenUrlFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $openUrlRules = json_decode( file_get_contents( \VuFind\Config\Locator::getConfigPath('OpenUrlRules.json') @@ -69,7 +70,7 @@ class OpenUrlFactory implements FactoryInterface true ); $resolverPluginManager - = $container->get('VuFind\Resolver\Driver\PluginManager'); + = $container->get(\VuFind\Resolver\Driver\PluginManager::class); $helpers = $container->get('ViewHelperManager'); return new $requestedName( $helpers->get('context'), diff --git a/module/VuFind/src/VuFind/View/Helper/Root/PermissionFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/PermissionFactory.php index 8b17ded2230..a60b6ca6fb6 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/PermissionFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/PermissionFactory.php @@ -62,8 +62,8 @@ class PermissionFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Role\PermissionManager'), - $container->get('VuFind\Role\PermissionDeniedManager') + $container->get(\VuFind\Role\PermissionManager::class), + $container->get(\VuFind\Role\PermissionDeniedManager::class) ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/PiwikFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/PiwikFactory.php index 27fcd3dfd85..2720a2d3b2f 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/PiwikFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/PiwikFactory.php @@ -61,7 +61,8 @@ class PiwikFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $url = $config->Piwik->url ?? false; $settings = [ 'siteId' => $config->Piwik->site_id ?? 1, diff --git a/module/VuFind/src/VuFind/View/Helper/Root/ProxyUrlFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/ProxyUrlFactory.php index ea007570fe1..1cb09ccbcd0 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/ProxyUrlFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/ProxyUrlFactory.php @@ -61,7 +61,8 @@ class ProxyUrlFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($config); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RecaptchaFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/RecaptchaFactory.php index 411d01e06db..45ac126b386 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RecaptchaFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RecaptchaFactory.php @@ -62,8 +62,8 @@ class RecaptchaFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Service\ReCaptcha'), - $container->get('VuFind\Config\PluginManager')->get('config') + $container->get(\VuFind\Service\ReCaptcha::class), + $container->get(\VuFind\Config\PluginManager::class)->get('config') ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php index 5ae8ecde63f..65872ea0e2f 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RecordFactory.php @@ -61,9 +61,10 @@ class RecordFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $helper = new $requestedName($config); - $helper->setCoverRouter($container->get('VuFind\Cover\Router')); + $helper->setCoverRouter($container->get(\VuFind\Cover\Router::class)); return $helper; } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RecordLinkFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/RecordLinkFactory.php index c3260932137..ca3912a3332 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RecordLinkFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RecordLinkFactory.php @@ -61,6 +61,6 @@ class RecordLinkFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\Record\Router')); + return new $requestedName($container->get(\VuFind\Record\Router::class)); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RelaisFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/RelaisFactory.php index 0000f629195..3c138fb9078 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RelaisFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RelaisFactory.php @@ -61,7 +61,8 @@ class RelaisFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $urlHelper = $container->get('ViewHelperManager')->get('url'); $loginUrl = $urlHelper->__invoke('relais-login'); return new $requestedName($config->Relais ?? null, $loginUrl); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RelatedFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/RelatedFactory.php index bb65c7ee17b..7a8b981b652 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RelatedFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RelatedFactory.php @@ -62,9 +62,9 @@ class RelatedFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Related\PluginManager'), - $container->get('VuFind\Config\PluginManager'), - $container->get('VuFind\Search\Options\PluginManager') + $container->get(\VuFind\Related\PluginManager::class), + $container->get(\VuFind\Config\PluginManager::class), + $container->get(\VuFind\Search\Options\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SafeMoneyFormatFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SafeMoneyFormatFactory.php index d84fef199fe..f1b349dce36 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SafeMoneyFormatFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SafeMoneyFormatFactory.php @@ -61,7 +61,8 @@ class SafeMoneyFormatFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); $defaultCurrency = $config->Site->defaultCurrency ?? null; return new $requestedName($defaultCurrency); } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SearchBoxFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SearchBoxFactory.php index 76edeb356aa..427ae595273 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SearchBoxFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SearchBoxFactory.php @@ -61,13 +61,13 @@ class SearchBoxFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager'); + $config = $container->get(\VuFind\Config\PluginManager::class); $mainConfig = $config->get('config'); $searchboxConfig = $config->get('searchbox')->toArray(); $includeAlphaOptions = $searchboxConfig['General']['includeAlphaBrowse'] ?? false; return new $requestedName( - $container->get('VuFind\Search\Options\PluginManager'), + $container->get(\VuFind\Search\Options\PluginManager::class), $searchboxConfig, isset($mainConfig->SearchPlaceholder) ? $mainConfig->SearchPlaceholder->toArray() : [], diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SearchMemoryFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SearchMemoryFactory.php index a4ca1a90c4b..53e76ccb2f9 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SearchMemoryFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SearchMemoryFactory.php @@ -61,6 +61,6 @@ class SearchMemoryFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - return new $requestedName($container->get('VuFind\Search\Memory')); + return new $requestedName($container->get(\VuFind\Search\Memory::class)); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SearchOptionsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SearchOptionsFactory.php index cf3deccbc2e..f0ec2b35d67 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SearchOptionsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SearchOptionsFactory.php @@ -62,7 +62,7 @@ class SearchOptionsFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Search\Options\PluginManager') + $container->get(\VuFind\Search\Options\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SearchParamsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SearchParamsFactory.php index 73b6584b26e..c00e68d58af 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SearchParamsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SearchParamsFactory.php @@ -62,7 +62,7 @@ class SearchParamsFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Search\Params\PluginManager') + $container->get(\VuFind\Search\Params\PluginManager::class) ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SearchTabsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SearchTabsFactory.php index f8acf7e416d..f8d84399d30 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SearchTabsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SearchTabsFactory.php @@ -62,9 +62,9 @@ class SearchTabsFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } return new $requestedName( - $container->get('VuFind\Search\Results\PluginManager'), + $container->get(\VuFind\Search\Results\PluginManager::class), $container->get('ViewHelperManager')->get('url'), - $container->get('VuFind\Search\SearchTabsHelper') + $container->get(\VuFind\Search\SearchTabsHelper::class) ); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlusFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlusFactory.php index 1ac1eb26d59..08be5432d73 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlusFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlusFactory.php @@ -61,7 +61,8 @@ class SyndeticsPlusFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($config->Syndetics ?? null); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SystemEmailFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/SystemEmailFactory.php index 832f79140c6..1da45bbbedb 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SystemEmailFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SystemEmailFactory.php @@ -61,7 +61,8 @@ class SystemEmailFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $config = $container->get('VuFind\Config\PluginManager')->get('config'); + $config = $container->get(\VuFind\Config\PluginManager::class) + ->get('config'); return new $requestedName($config->Site->email ?? ''); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/UserListFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/UserListFactory.php index 584c20ad928..4810779adb2 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/UserListFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/UserListFactory.php @@ -61,9 +61,9 @@ class UserListFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $sessionManager = $container->get('Zend\Session\SessionManager'); + $sessionManager = $container->get(\Zend\Session\SessionManager::class); $session = new \Zend\Session\Container('List', $sessionManager); - $capabilities = $container->get('VuFind\Config\AccountCapabilities'); + $capabilities = $container->get(\VuFind\Config\AccountCapabilities::class); return new $requestedName($session, $capabilities->getListSetting()); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/UserTagsFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/UserTagsFactory.php index c7ba6c028b1..192d25fffc7 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/UserTagsFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/UserTagsFactory.php @@ -61,7 +61,7 @@ class UserTagsFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $capabilities = $container->get('VuFind\Config\AccountCapabilities'); + $capabilities = $container->get(\VuFind\Config\AccountCapabilities::class); return new $requestedName($capabilities->getTagSetting()); } } diff --git a/module/VuFind/src/VuFind/XSLT/Import/VuFind.php b/module/VuFind/src/VuFind/XSLT/Import/VuFind.php index 746b395cfb5..2f5f6d97cfd 100644 --- a/module/VuFind/src/VuFind/XSLT/Import/VuFind.php +++ b/module/VuFind/src/VuFind/XSLT/Import/VuFind.php @@ -69,7 +69,7 @@ class VuFind */ public static function getChangeTracker() { - return static::$serviceLocator->get('VuFind\Db\Table\PluginManager') + return static::$serviceLocator->get(\VuFind\Db\Table\PluginManager::class) ->get('ChangeTracker'); } @@ -82,7 +82,7 @@ class VuFind */ public static function getConfig($config = 'config') { - return static::$serviceLocator->get('VuFind\Config\PluginManager') + return static::$serviceLocator->get(\VuFind\Config\PluginManager::class) ->get($config); } diff --git a/module/VuFind/src/VuFind/XSLT/Importer.php b/module/VuFind/src/VuFind/XSLT/Importer.php index 0b2111a9573..caad2b7f2dc 100644 --- a/module/VuFind/src/VuFind/XSLT/Importer.php +++ b/module/VuFind/src/VuFind/XSLT/Importer.php @@ -81,7 +81,7 @@ class Importer // Save the results (or just display them, if in test mode): if (!$testMode) { - $solr = $this->serviceLocator->get('VuFind\Solr\Writer'); + $solr = $this->serviceLocator->get(\VuFind\Solr\Writer::class); $solr->save($index, new RawXMLDocument($xml)); } else { Console::write($xml . "\n"); diff --git a/module/VuFind/src/VuFindTest/Unit/AjaxHandlerTest.php b/module/VuFind/src/VuFindTest/Unit/AjaxHandlerTest.php index 56f87a259c1..59d2fcfd19a 100644 --- a/module/VuFind/src/VuFindTest/Unit/AjaxHandlerTest.php +++ b/module/VuFind/src/VuFindTest/Unit/AjaxHandlerTest.php @@ -49,7 +49,7 @@ abstract class AjaxHandlerTest extends MockContainerTest */ protected function getMockUser() { - return $this->container->get('VuFind\Db\Row\User'); + return $this->container->get(\VuFind\Db\Row\User::class); } /** diff --git a/module/VuFind/src/VuFindTest/Unit/DbTestCase.php b/module/VuFind/src/VuFindTest/Unit/DbTestCase.php index 9c7ea6eb35b..db3f090aef8 100644 --- a/module/VuFind/src/VuFindTest/Unit/DbTestCase.php +++ b/module/VuFind/src/VuFindTest/Unit/DbTestCase.php @@ -107,7 +107,7 @@ abstract class DbTestCase extends TestCase // Add database service: if (!$sm->has('VuFind\Db\Table\PluginManager')) { $dbFactory = new \VuFind\Db\AdapterFactory( - $sm->get('VuFind\Config\PluginManager')->get('config') + $sm->get(\VuFind\Config\PluginManager::class)->get('config') ); $sm->setService('Zend\Db\Adapter\Adapter', $dbFactory->getAdapter()); $this->addTableManager($sm); @@ -154,6 +154,6 @@ abstract class DbTestCase extends TestCase public function getTable($table) { $sm = $this->getServiceManager(); - return $sm->get('VuFind\Db\Table\PluginManager')->get($table); + return $sm->get(\VuFind\Db\Table\PluginManager::class)->get($table); } } diff --git a/module/VuFind/src/VuFindTest/Unit/TestCase.php b/module/VuFind/src/VuFindTest/Unit/TestCase.php index eeb78a73326..0b5c6971f72 100644 --- a/module/VuFind/src/VuFindTest/Unit/TestCase.php +++ b/module/VuFind/src/VuFindTest/Unit/TestCase.php @@ -200,10 +200,12 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase $this->serviceManager->setService( 'SharedEventManager', new \Zend\EventManager\SharedEventManager() ); + $driverManager = $this->serviceManager + ->get(\VuFind\RecordDriver\PluginManager::class); $this->serviceManager->setService( 'VuFind\Record\Loader', new \VuFind\Record\Loader( - $this->serviceManager->get('VuFindSearch\Service'), - $this->serviceManager->get('VuFind\RecordDriver\PluginManager') + $this->serviceManager->get(\VuFindSearch\Service::class), + $driverManager ) ); $this->serviceManager->setService('Config', []); @@ -228,7 +230,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase $authManager = new \VuFind\Auth\PluginManager($sm); $sm->setService('VuFind\Auth\PluginManager', $authManager); } - return $sm->get('VuFind\Auth\PluginManager'); + return $sm->get(\VuFind\Auth\PluginManager::class); } /** diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Auth/ILSTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Auth/ILSTest.php index 5ad50b8fb2b..c84b9aaa92d 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Auth/ILSTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Auth/ILSTest.php @@ -113,7 +113,7 @@ class ILSTest extends \VuFindTest\Unit\DbTestCase $authenticator ); $auth->setDbTableManager( - $this->getServiceManager()->get('VuFind\Db\Table\PluginManager') + $this->getServiceManager()->get(\VuFind\Db\Table\PluginManager::class) ); $auth->getCatalog()->setDriver($driver); return $auth; diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrAuthTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrAuthTest.php index 9db7e3e24e1..640542685d1 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrAuthTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrAuthTest.php @@ -60,7 +60,7 @@ class SolrAuthTest extends \VuFindTest\Unit\DbTestCase */ public function testSimpleSearch() { - $solr = $this->getServiceManager()->get('VuFind\Search\BackendManager') + $solr = $this->getServiceManager()->get(\VuFind\Search\BackendManager::class) ->get('SolrAuth'); // Search for a term known to exist in the sample data; request just one diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrTest.php index a70422d95a8..af6c4b71a71 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrTest.php @@ -60,7 +60,7 @@ class SolrTest extends \VuFindTest\Unit\TestCase */ public function testAlphaBrowseSeeAlso() { - $solr = $this->getServiceManager()->get('VuFind\Search\BackendManager') + $solr = $this->getServiceManager()->get(\VuFind\Search\BackendManager::class) ->get('Solr'); $extras = new ParamBag(['extras' => 'id']); $result = $solr->alphabeticBrowse('author', 'Dublin Society', 0, 1, $extras); @@ -79,7 +79,7 @@ class SolrTest extends \VuFindTest\Unit\TestCase */ public function testAlphaBrowseUseInstead() { - $solr = $this->getServiceManager()->get('VuFind\Search\BackendManager') + $solr = $this->getServiceManager()->get(\VuFind\Search\BackendManager::class) ->get('Solr'); $extras = new ParamBag(['extras' => 'id']); $result = $solr @@ -99,7 +99,7 @@ class SolrTest extends \VuFindTest\Unit\TestCase */ public function testDeweyValues() { - $solr = $this->getServiceManager()->get('VuFind\Search\BackendManager') + $solr = $this->getServiceManager()->get(\VuFind\Search\BackendManager::class) ->get('Solr'); $extras = new ParamBag(['extras' => 'id']); $result = $solr->alphabeticBrowse('dewey', '123.45 .I39', 0, 1, $extras); @@ -121,7 +121,7 @@ class SolrTest extends \VuFindTest\Unit\TestCase */ public function testTermsHandler() { - $solr = $this->getServiceManager()->get('VuFind\Search\BackendManager') + $solr = $this->getServiceManager()->get(\VuFind\Search\BackendManager::class) ->get('Solr'); $currentPageInfo = $solr->terms('id', 'test', 1)->getFieldTerms('id'); $this->assertEquals(1, count($currentPageInfo)); diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/View/Helper/Root/ResultFeedTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/View/Helper/Root/ResultFeedTest.php index 3a22733b115..3fd9b577041 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/View/Helper/Root/ResultFeedTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/View/Helper/Root/ResultFeedTest.php @@ -68,7 +68,7 @@ class ResultFeedTest extends \VuFindTest\Unit\ViewHelperTestCase ->setConstructorArgs( [ new \VuFind\Record\Router( - $this->getServiceManager()->get('VuFind\Record\Loader'), + $this->getServiceManager()->get(\VuFind\Record\Loader::class), new \Zend\Config\Config([]) ) ] @@ -119,7 +119,7 @@ class ResultFeedTest extends \VuFindTest\Unit\ViewHelperTestCase $request->set('view', 'rss'); $results = $this->getServiceManager() - ->get('VuFind\Search\Results\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Results\PluginManager::class)->get('Solr'); $results->getParams()->initFromRequest($request); $helper = new ResultFeed(); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Config/SearchSpecsReaderTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Config/SearchSpecsReaderTest.php index dcb6988f85d..1571d1990d8 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Config/SearchSpecsReaderTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Config/SearchSpecsReaderTest.php @@ -94,7 +94,7 @@ class SearchSpecsReaderTest extends \VuFindTest\Unit\TestCase { // The searchspecs.yaml file should define author dismax fields (among many // other things). - $reader = $this->getServiceManager()->get('VuFind\Config\SearchSpecsReader'); + $reader = $this->getServiceManager()->get(\VuFind\Config\SearchSpecsReader::class); $specs = $reader->get('searchspecs.yaml'); $this->assertTrue( isset($specs['Author']['DismaxFields']) @@ -109,7 +109,7 @@ class SearchSpecsReaderTest extends \VuFindTest\Unit\TestCase */ public function testMissingFileRead() { - $reader = $this->getServiceManager()->get('VuFind\Config\SearchSpecsReader'); + $reader = $this->getServiceManager()->get(\VuFind\Config\SearchSpecsReader::class); $specs = $reader->get('notreallyasearchspecs.yaml'); $this->assertEquals([], $specs); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/RandomRecommendTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/RandomRecommendTest.php index 380e48d15b4..9b59f2a4297 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/RandomRecommendTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/RandomRecommendTest.php @@ -129,7 +129,7 @@ class RandomRecommendTest extends TestCase // Use Solr since some Base components are abstract: $params = $this->getServiceManager() - ->get('VuFind\Search\Params\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Params\PluginManager::class)->get('Solr'); $query = $this->getFixture('query'); $params->setBasicSearch($query->getString(), $query->getHandler()); $request = $this->createMock('\Zend\StdLib\Parameters'); @@ -161,13 +161,13 @@ class RandomRecommendTest extends TestCase ->will( $this->returnValue( $this->getServiceManager() - ->get('VuFind\Search\Params\PluginManager')->get('Solr') + ->get(\VuFind\Search\Params\PluginManager::class)->get('Solr') ) ); // Use Solr since some Base components are abstract: $params = $this->getServiceManager() - ->get('VuFind\Search\Params\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Params\PluginManager::class)->get('Solr'); $query = $this->getFixture('query'); $params->setBasicSearch($query->getString(), $query->getHandler()); $request = $this->createMock('\Zend\StdLib\Parameters'); @@ -194,7 +194,7 @@ class RandomRecommendTest extends TestCase // Use Solr since some Base components are abstract: $results = $this->getServiceManager() - ->get('VuFind\Search\Results\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Results\PluginManager::class)->get('Solr'); $params = $results->getParams(); $query = $this->getFixture('query'); $params->setBasicSearch($query->getString(), $query->getHandler()); @@ -232,7 +232,7 @@ class RandomRecommendTest extends TestCase // Use Solr since some Base components are abstract: $results = $this->getServiceManager() - ->get('VuFind\Search\Results\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Results\PluginManager::class)->get('Solr'); $params = $results->getParams(); $query = $this->getFixture('query'); $params->setBasicSearch($query->getString(), $query->getHandler()); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Base/ParamsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Base/ParamsTest.php index 2ff6af9f3c1..54659193545 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Base/ParamsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Base/ParamsTest.php @@ -50,7 +50,7 @@ class ParamsTest extends \VuFindTest\Unit\TestCase { // Use Solr since some Base components are abstract: $params = $this->getServiceManager() - ->get('VuFind\Search\Params\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Params\PluginManager::class)->get('Solr'); // Key test: word boundaries: $params->setBasicSearch('go good googler'); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/SpellingProcessorTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/SpellingProcessorTest.php index b62166ad154..c75a801360e 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/SpellingProcessorTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/SpellingProcessorTest.php @@ -131,7 +131,7 @@ class SpellingProcessorTest extends TestCase $spelling = $this->getFixture('spell1'); $query = $this->getFixture('query1'); $params = $this->getServiceManager() - ->get('VuFind\Search\Params\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Params\PluginManager::class)->get('Solr'); $params->setBasicSearch($query->getString(), $query->getHandler()); $sp = new SpellingProcessor(); $this->assertEquals( @@ -193,7 +193,7 @@ class SpellingProcessorTest extends TestCase $spelling = $this->getFixture('spell1'); $query = $this->getFixture('query1'); $params = $this->getServiceManager() - ->get('VuFind\Search\Params\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Params\PluginManager::class)->get('Solr'); $params->setBasicSearch($query->getString(), $query->getHandler()); $config = new Config(['expand' => false, 'phrase' => true]); $sp = new SpellingProcessor($config); @@ -429,7 +429,7 @@ class SpellingProcessorTest extends TestCase $spelling = $this->getFixture('spell' . $testNum); $query = $this->getFixture('query' . $testNum); $params = $this->getServiceManager() - ->get('VuFind\Search\Params\PluginManager')->get('Solr'); + ->get(\VuFind\Search\Params\PluginManager::class)->get('Solr'); $this->setProperty($params, 'query', $query); $sp = new SpellingProcessor(new Config($config)); $suggestions = $sp->getSuggestions($spelling, $query); diff --git a/module/VuFindAdmin/src/VuFindAdmin/Controller/AbstractAdmin.php b/module/VuFindAdmin/src/VuFindAdmin/Controller/AbstractAdmin.php index 6f8288f0b14..1e156a18646 100644 --- a/module/VuFindAdmin/src/VuFindAdmin/Controller/AbstractAdmin.php +++ b/module/VuFindAdmin/src/VuFindAdmin/Controller/AbstractAdmin.php @@ -75,7 +75,7 @@ class AbstractAdmin extends \VuFind\Controller\AbstractBase $config = $this->getConfig(); if (!isset($config->Site->admin_enabled) || !$config->Site->admin_enabled) { $pluginManager = $this->serviceLocator - ->get('Zend\Mvc\Controller\PluginManager'); + ->get(\Zend\Mvc\Controller\PluginManager::class); $redirectPlugin = $pluginManager->get('redirect'); return $redirectPlugin->toRoute('admin/disabled'); } diff --git a/module/VuFindAdmin/src/VuFindAdmin/Controller/AdminController.php b/module/VuFindAdmin/src/VuFindAdmin/Controller/AdminController.php index ef019c79411..161f248055a 100644 --- a/module/VuFindAdmin/src/VuFindAdmin/Controller/AdminController.php +++ b/module/VuFindAdmin/src/VuFindAdmin/Controller/AdminController.php @@ -58,7 +58,7 @@ class AdminController extends AbstractAdmin $config = $this->getConfig(); $xml = false; if (isset($config->Index->url)) { - $response = $this->serviceLocator->get('VuFindHttp\HttpService') + $response = $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->get($config->Index->url . '/admin/cores?wt=xml'); $xml = $response->isSuccess() ? $response->getBody() : false; } diff --git a/module/VuFindAdmin/src/VuFindAdmin/Controller/ConfigController.php b/module/VuFindAdmin/src/VuFindAdmin/Controller/ConfigController.php index 75a829e8d46..17a5f45a79e 100644 --- a/module/VuFindAdmin/src/VuFindAdmin/Controller/ConfigController.php +++ b/module/VuFindAdmin/src/VuFindAdmin/Controller/ConfigController.php @@ -70,7 +70,7 @@ class ConfigController extends AbstractAdmin // Reload config now that it has been edited (otherwise, old setting // will persist in cache): - $this->serviceLocator->get('VuFind\Config\PluginManager') + $this->serviceLocator->get(\VuFind\Config\PluginManager::class) ->reload('config'); } else { $this->flashMessenger()->addMessage( diff --git a/module/VuFindAdmin/src/VuFindAdmin/Controller/MaintenanceController.php b/module/VuFindAdmin/src/VuFindAdmin/Controller/MaintenanceController.php index bd5349a7223..178d3163097 100644 --- a/module/VuFindAdmin/src/VuFindAdmin/Controller/MaintenanceController.php +++ b/module/VuFindAdmin/src/VuFindAdmin/Controller/MaintenanceController.php @@ -46,7 +46,7 @@ class MaintenanceController extends AbstractAdmin public function homeAction() { $view = $this->createViewModel(); - $view->caches = $this->serviceLocator->get('VuFind\Cache\Manager') + $view->caches = $this->serviceLocator->get(\VuFind\Cache\Manager::class) ->getCacheList(); $view->setTemplate('admin/maintenance/home'); return $view; @@ -59,7 +59,7 @@ class MaintenanceController extends AbstractAdmin */ public function clearcacheAction() { - $cacheManager = $this->serviceLocator->get('VuFind\Cache\Manager'); + $cacheManager = $this->serviceLocator->get(\VuFind\Cache\Manager::class); foreach ($this->params()->fromQuery('cache', []) as $cache) { $cacheManager->getCache($cache)->flush(); } diff --git a/module/VuFindApi/src/VuFindApi/Controller/ApiTrait.php b/module/VuFindApi/src/VuFindApi/Controller/ApiTrait.php index fd056266039..1776c7037e7 100644 --- a/module/VuFindApi/src/VuFindApi/Controller/ApiTrait.php +++ b/module/VuFindApi/src/VuFindApi/Controller/ApiTrait.php @@ -115,7 +115,8 @@ trait ApiTrait */ protected function isAccessDenied($permission) { - $auth = $this->serviceLocator->get('ZfcRbac\Service\AuthorizationService'); + $auth = $this->serviceLocator + ->get(\ZfcRbac\Service\AuthorizationService::class); if (!$auth->isGranted($permission)) { return $this->output([], self::STATUS_ERROR, 403, 'Permission denied'); } diff --git a/module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php b/module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php index 1794a75f427..f670a6902cd 100644 --- a/module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php +++ b/module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php @@ -189,7 +189,7 @@ class SearchApiController extends \VuFind\Controller\AbstractSearch return $this->output([], self::STATUS_ERROR, 400, 'Missing id'); } - $loader = $this->serviceLocator->get('VuFind\Record\Loader'); + $loader = $this->serviceLocator->get(\VuFind\Record\Loader::class); try { if (is_array($request['id'])) { $results = $loader->loadBatchForSource($request['id']); @@ -253,7 +253,7 @@ class SearchApiController extends \VuFind\Controller\AbstractSearch ? $facetConfig->SpecialFacets->hierarchical->toArray() : []; - $runner = $this->serviceLocator->get('VuFind\Search\SearchRunner'); + $runner = $this->serviceLocator->get(\VuFind\Search\SearchRunner::class); try { $results = $runner->run( $request, @@ -333,7 +333,7 @@ class SearchApiController extends \VuFind\Controller\AbstractSearch $facetResults = $results->getFullFieldFacets($facets, false, -1, 'count'); $facetHelper = $this->serviceLocator - ->get('VuFind\Search\Solr\HierarchicalFacetHelper'); + ->get(\VuFind\Search\Solr\HierarchicalFacetHelper::class); $facetList = []; foreach ($facets as $facet) { diff --git a/module/VuFindApi/src/VuFindApi/Formatter/RecordFormatterFactory.php b/module/VuFindApi/src/VuFindApi/Formatter/RecordFormatterFactory.php index 84b1cc4c7d6..62f6f016cae 100644 --- a/module/VuFindApi/src/VuFindApi/Formatter/RecordFormatterFactory.php +++ b/module/VuFindApi/src/VuFindApi/Formatter/RecordFormatterFactory.php @@ -62,7 +62,7 @@ class RecordFormatterFactory implements FactoryInterface throw new \Exception('Unexpected options sent to factory.'); } - $recordFields = $container->get('VuFind\Config\YamlReader') + $recordFields = $container->get(\VuFind\Config\YamlReader::class) ->get('SearchApiRecordFields.yaml'); $helperManager = $container->get('ViewHelperManager'); return new $requestedName($recordFields, $helperManager); diff --git a/module/VuFindConsole/src/VuFindConsole/Controller/AbstractBase.php b/module/VuFindConsole/src/VuFindConsole/Controller/AbstractBase.php index 78322f74f8b..9f2f31a1af7 100644 --- a/module/VuFindConsole/src/VuFindConsole/Controller/AbstractBase.php +++ b/module/VuFindConsole/src/VuFindConsole/Controller/AbstractBase.php @@ -117,7 +117,8 @@ class AbstractBase extends AbstractActionController */ public function getConfig($id = 'config') { - return $this->serviceLocator->get('VuFind\Config\PluginManager')->get($id); + return $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class)->get($id); } /** @@ -127,7 +128,7 @@ class AbstractBase extends AbstractActionController */ public function getILS() { - return $this->serviceLocator->get('VuFind\ILS\Connection'); + return $this->serviceLocator->get(\VuFind\ILS\Connection::class); } /** @@ -139,7 +140,7 @@ class AbstractBase extends AbstractActionController */ public function getTable($table) { - return $this->serviceLocator->get('VuFind\Db\Table\PluginManager') + return $this->serviceLocator->get(\VuFind\Db\Table\PluginManager::class) ->get($table); } } diff --git a/module/VuFindConsole/src/VuFindConsole/Controller/CompileController.php b/module/VuFindConsole/src/VuFindConsole/Controller/CompileController.php index d2696c70ec9..a03e1ec4dd0 100644 --- a/module/VuFindConsole/src/VuFindConsole/Controller/CompileController.php +++ b/module/VuFindConsole/src/VuFindConsole/Controller/CompileController.php @@ -68,7 +68,7 @@ class CompileController extends AbstractBase if (empty($target)) { $target = "{$source}_compiled"; } - $compiler = $this->serviceLocator->get('VuFindTheme\ThemeCompiler'); + $compiler = $this->serviceLocator->get(\VuFindTheme\ThemeCompiler::class); if (!$compiler->compile($source, $target, $request->getParam('force'))) { Console::writeLine($compiler->getLastError()); return $this->getFailureResponse(); diff --git a/module/VuFindConsole/src/VuFindConsole/Controller/GenerateController.php b/module/VuFindConsole/src/VuFindConsole/Controller/GenerateController.php index aa190de726d..7d4d7b53b3a 100644 --- a/module/VuFindConsole/src/VuFindConsole/Controller/GenerateController.php +++ b/module/VuFindConsole/src/VuFindConsole/Controller/GenerateController.php @@ -357,7 +357,7 @@ class GenerateController extends AbstractBase } // Use the theme generator to create and configure the theme: - $generator = $this->serviceLocator->get('VuFindTheme\ThemeGenerator'); + $generator = $this->serviceLocator->get(\VuFindTheme\ThemeGenerator::class); if (!$generator->generate($name) || !$generator->configure($this->getConfig(), $name) ) { @@ -384,7 +384,7 @@ class GenerateController extends AbstractBase } // Use the theme generator to create and configure the theme: - $generator = $this->serviceLocator->get('VuFindTheme\MixinGenerator'); + $generator = $this->serviceLocator->get(\VuFindTheme\MixinGenerator::class); if (!$generator->generate($name)) { Console::writeLine($generator->getLastError()); return $this->getFailureResponse(); @@ -402,6 +402,8 @@ class GenerateController extends AbstractBase */ protected function getGeneratorTools() { - return $this->serviceLocator->get('VuFindConsole\Generator\GeneratorTools'); + return $this->serviceLocator->get( + \VuFindConsole\Generator\GeneratorTools::class + ); } } diff --git a/module/VuFindConsole/src/VuFindConsole/Controller/HarvestController.php b/module/VuFindConsole/src/VuFindConsole/Controller/HarvestController.php index fdbb12bff31..8db422eb84b 100644 --- a/module/VuFindConsole/src/VuFindConsole/Controller/HarvestController.php +++ b/module/VuFindConsole/src/VuFindConsole/Controller/HarvestController.php @@ -84,7 +84,7 @@ class HarvestController extends AbstractBase } // Get the default VuFind HTTP client: - $client = $this->serviceLocator->get('VuFindHttp\HttpService') + $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->createClient(); // Run the job! diff --git a/module/VuFindConsole/src/VuFindConsole/Controller/ImportController.php b/module/VuFindConsole/src/VuFindConsole/Controller/ImportController.php index 8c1ff0c2c23..6b5f64e0fca 100644 --- a/module/VuFindConsole/src/VuFindConsole/Controller/ImportController.php +++ b/module/VuFindConsole/src/VuFindConsole/Controller/ImportController.php @@ -140,7 +140,8 @@ class ImportController extends AbstractBase $testMode = $request->getParam('test-only') ? true : false; $index = $request->getParam('index', 'SolrWeb'); - $configLoader = $this->serviceLocator->get('VuFind\Config\PluginManager'); + $configLoader = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class); $crawlConfig = $configLoader->get('webcrawl'); // Get the time we started indexing -- we'll delete records older than this @@ -159,7 +160,7 @@ class ImportController extends AbstractBase // Skip Solr operations if we're in test mode. if (!$testMode) { - $solr = $this->serviceLocator->get('VuFind\Solr\Writer'); + $solr = $this->serviceLocator->get(\VuFind\Solr\Writer::class); if ($verbose) { Console::writeLine("Deleting old records (prior to $startTime)..."); } diff --git a/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php b/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php index 5d29961a9c5..bd3445f059a 100644 --- a/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php +++ b/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php @@ -152,7 +152,7 @@ class UtilController extends AbstractBase && !empty($reserves) ) { // Setup Solr Connection - $solr = $this->serviceLocator->get('VuFind\Solr\Writer'); + $solr = $this->serviceLocator->get(\VuFind\Solr\Writer::class); // Delete existing records $solr->deleteAll('SolrReserves'); @@ -262,7 +262,7 @@ class UtilController extends AbstractBase $core = $this->getRequest()->getParam('core', 'Solr'); // Commit and Optimize the Solr Index - $solr = $this->serviceLocator->get('VuFind\Solr\Writer'); + $solr = $this->serviceLocator->get(\VuFind\Solr\Writer::class); $solr->commit($core); if ($optimize) { $solr->optimize($core); @@ -278,9 +278,10 @@ class UtilController extends AbstractBase public function sitemapAction() { // Build sitemap and display appropriate warnings if needed: - $configLoader = $this->serviceLocator->get('VuFind\Config\PluginManager'); + $configLoader = $this->serviceLocator + ->get(\VuFind\Config\PluginManager::class); $generator = new Sitemap( - $this->serviceLocator->get('VuFind\Search\BackendManager'), + $this->serviceLocator->get(\VuFind\Search\BackendManager::class), $configLoader->get('config')->Site->url, $configLoader->get('sitemap') ); $request = $this->getRequest(); @@ -398,7 +399,7 @@ class UtilController extends AbstractBase . implode(', ', $ids) ); } - $writer = $this->serviceLocator->get('VuFind\Solr\Writer'); + $writer = $this->serviceLocator->get(\VuFind\Solr\Writer::class); $writer->deleteRecords($index, $ids); if ($verbose) { Console::writeLine('Delete operation completed.'); @@ -424,7 +425,8 @@ class UtilController extends AbstractBase return $this->getFailureResponse(); } - $recordTable = $this->serviceLocator->get('VuFind\Db\Table\PluginManager') + $recordTable = $this->serviceLocator + ->get(\VuFind\Db\Table\PluginManager::class) ->get('Record'); $count = $recordTable->cleanup(); @@ -579,7 +581,7 @@ class UtilController extends AbstractBase } } else { // Default behavior: Get Suppressed Records and Delete from index - $solr = $this->serviceLocator->get('VuFind\Solr\Writer'); + $solr = $this->serviceLocator->get(\VuFind\Solr\Writer::class); $solr->deleteRecords($backend, $result); $solr->commit($backend); $solr->optimize($backend); @@ -750,9 +752,9 @@ class UtilController extends AbstractBase } $skipJson = $request->getParam('skip-json') || $request->getParam('sj'); $skipXml = $request->getParam('skip-xml') || $request->getParam('sx'); - $recordLoader = $this->serviceLocator->get('VuFind\Record\Loader'); + $recordLoader = $this->serviceLocator->get(\VuFind\Record\Loader::class); $hierarchies = $this->serviceLocator - ->get('VuFind\Search\Results\PluginManager')->get('Solr') + ->get(\VuFind\Search\Results\PluginManager::class)->get('Solr') ->getFullFieldFacets(['hierarchy_top_id']); if (!isset($hierarchies['hierarchy_top_id']['data']['list'])) { $hierarchies['hierarchy_top_id']['data']['list'] = []; @@ -811,7 +813,7 @@ class UtilController extends AbstractBase public function cssbuilderAction() { $compiler = new \VuFindTheme\LessCompiler(true); - $cacheManager = $this->serviceLocator->get('VuFind\Cache\Manager'); + $cacheManager = $this->serviceLocator->get(\VuFind\Cache\Manager::class); $cacheDir = $cacheManager->getCacheDir() . 'less/'; $compiler->setTempPath($cacheDir); $compiler->compile(array_unique($this->getRequest()->getParam('themes'))); @@ -970,7 +972,8 @@ class UtilController extends AbstractBase } // Now do the database rewrite: - $userTable = $this->serviceLocator->get('VuFind\Db\Table\PluginManager') + $userTable = $this->serviceLocator + ->get(\VuFind\Db\Table\PluginManager::class) ->get('User'); $users = $userTable->select( function ($select) { diff --git a/module/VuFindDevTools/src/VuFindDevTools/Controller/DevtoolsController.php b/module/VuFindDevTools/src/VuFindDevTools/Controller/DevtoolsController.php index 204527b24ee..6996491370f 100644 --- a/module/VuFindDevTools/src/VuFindDevTools/Controller/DevtoolsController.php +++ b/module/VuFindDevTools/src/VuFindDevTools/Controller/DevtoolsController.php @@ -29,6 +29,7 @@ namespace VuFindDevTools\Controller; use VuFind\I18n\Translator\Loader\ExtendedIni; +use VuFind\Search\Results\PluginManager as ResultsManager; use VuFindDevTools\LanguageHelper; /** @@ -55,7 +56,7 @@ class DevtoolsController extends \VuFind\Controller\AbstractBase { try { $backend = $this->serviceLocator - ->get('VuFind\Search\BackendManager') + ->get(\VuFind\Search\BackendManager::class) ->get($id); } catch (\Exception $e) { return null; @@ -78,7 +79,7 @@ class DevtoolsController extends \VuFind\Controller\AbstractBase } if (isset($view->min) && $view->min) { $view->results = $view->min->deminify( - $this->serviceLocator->get('VuFind\Search\Results\PluginManager') + $this->serviceLocator->get(ResultsManager::class) ); } if (isset($view->results) && $view->results) { diff --git a/module/VuFindTheme/src/VuFindTheme/Initializer.php b/module/VuFindTheme/src/VuFindTheme/Initializer.php index bbfba623472..42d7bef5cc0 100644 --- a/module/VuFindTheme/src/VuFindTheme/Initializer.php +++ b/module/VuFindTheme/src/VuFindTheme/Initializer.php @@ -123,13 +123,14 @@ class Initializer $this->serviceManager = $this->event->getApplication()->getServiceManager(); // Get the cookie manager from the service manager: - $this->cookieManager = $this->serviceManager->get('VuFind\CookieManager'); + $this->cookieManager = $this->serviceManager + ->get(\VuFind\Cookie\CookieManager::class); // Get base directory from tools object: - $this->tools = $this->serviceManager->get('VuFindTheme\ThemeInfo'); + $this->tools = $this->serviceManager->get(\VuFindTheme\ThemeInfo::class); // Set up mobile device detector: - $this->mobile = $this->serviceManager->get('VuFindTheme\Mobile'); + $this->mobile = $this->serviceManager->get(\VuFindTheme\Mobile::class); $this->mobile->enable(isset($this->config->mobile_theme)); } @@ -350,7 +351,8 @@ class Initializer $templatePathStack = []; // Grab the resource manager for tracking CSS, JS, etc.: - $resources = $this->serviceManager->get('VuFindTheme\ResourceContainer'); + $resources = $this->serviceManager + ->get(\VuFindTheme\ResourceContainer::class); // Set generator if necessary: if (isset($this->config->generator)) { @@ -431,8 +433,8 @@ class Initializer if (!empty($pathStack)) { try { - $translator = $this->serviceManager->get('Zend\Mvc\I18n\Translator'); - + $translator = $this->serviceManager + ->get(\Zend\Mvc\I18n\Translator::class); $pm = $translator->getPluginManager(); $pm->get('ExtendedIni')->addToPathStack($pathStack); } catch (\Zend\Mvc\I18n\Exception\BadMethodCallException $e) { @@ -444,13 +446,14 @@ class Initializer // Override the default cache with a theme-specific cache to avoid // key collisions in a multi-theme environment. try { - $cacheManager = $this->serviceManager->get('VuFind\Cache\Manager'); + $cacheManager = $this->serviceManager + ->get(\VuFind\Cache\Manager::class); $cacheName = $cacheManager->addLanguageCacheForTheme($theme); $translator->setCache($cacheManager->getCache($cacheName)); } catch (\Exception $e) { // Don't let a cache failure kill the whole application, but make // note of it: - $logger = $this->serviceManager->get('VuFind\Log\Logger'); + $logger = $this->serviceManager->get(\VuFind\Log\Logger::class); $logger->debug( 'Problem loading cache: ' . get_class($e) . ' exception: ' . $e->getMessage() -- GitLab