From d655040dda99250250102ac3ff421bb2ccc2da71 Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Thu, 17 Aug 2023 15:34:19 +0300 Subject: [PATCH 1/4] Add more files to clean up in reset_setup task. (#3036) Removing any .bak files ensures that the tests don't restore obsolete backups. .key files include the OAuth2 server test keys. --- build.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 48656043fe1..1ed70212e05 100644 --- a/build.xml +++ b/build.xml @@ -758,8 +758,13 @@ ${git_status} - + + + + + + From 02d596e5c9efb6f6f1a6e004ee2473d362518060 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Thu, 17 Aug 2023 19:33:13 +0200 Subject: [PATCH 2/4] Single quotes rule for php-cs-fixer (#3035) - Add single_quote rule to php-cs-fixer - Update code for new rule --- module/VuFind/functions/codecoverage.php | 2 +- .../VuFind/AjaxHandler/GetRecordDetails.php | 2 +- .../src/VuFind/AjaxHandler/GetVisData.php | 2 +- module/VuFind/src/VuFind/Auth/CAS.php | 8 +- module/VuFind/src/VuFind/Auth/ChoiceAuth.php | 4 +- module/VuFind/src/VuFind/Auth/LDAP.php | 10 +- module/VuFind/src/VuFind/Auth/Manager.php | 4 +- module/VuFind/src/VuFind/Auth/MultiAuth.php | 4 +- module/VuFind/src/VuFind/Auth/SIP2.php | 4 +- module/VuFind/src/VuFind/Auth/Shibboleth.php | 6 +- .../src/VuFind/Auth/ShibbolethFactory.php | 2 +- .../VuFind/src/VuFind/Autocomplete/Solr.php | 6 +- .../VuFind/src/VuFind/Autocomplete/SolrCN.php | 6 +- .../src/VuFind/Autocomplete/SolrPrefix.php | 2 +- .../src/VuFind/Cache/KeyGeneratorTrait.php | 2 +- .../src/VuFind/ChannelProvider/Random.php | 2 +- .../src/VuFind/Config/PathResolverFactory.php | 4 +- module/VuFind/src/VuFind/Config/Upgrade.php | 8 +- module/VuFind/src/VuFind/Config/Writer.php | 14 +- .../src/VuFind/Connection/LibGuides.php | 26 +- .../VuFind/Connection/OauthServiceTrait.php | 22 +- .../src/VuFind/Connection/OpenLibrary.php | 18 +- .../VuFind/src/VuFind/Connection/Oracle.php | 28 +- .../src/VuFind/Connection/Wikipedia.php | 48 +- .../VuFind/Content/AuthorNotes/Syndetics.php | 2 +- .../src/VuFind/Content/Covers/Bokinfo.php | 8 +- .../src/VuFind/Content/Covers/Buchhandel.php | 2 +- .../VuFind/src/VuFind/Content/Covers/Koha.php | 2 +- .../src/VuFind/Content/Covers/KohaFactory.php | 2 +- .../src/VuFind/Content/Covers/LocalFile.php | 6 +- .../src/VuFind/Content/Covers/Syndetics.php | 2 +- .../src/VuFind/Content/Excerpts/Syndetics.php | 4 +- .../src/VuFind/Content/ObalkyKnihService.php | 6 +- .../src/VuFind/Content/Reviews/Booksite.php | 4 +- .../src/VuFind/Content/Reviews/Guardian.php | 16 +- .../src/VuFind/Content/Reviews/Syndetics.php | 4 +- .../VuFind/Content/Summaries/Syndetics.php | 2 +- .../src/VuFind/Content/TOC/Syndetics.php | 4 +- .../src/VuFind/Controller/AbstractSearch.php | 2 +- .../VuFind/Controller/AjaxResponseTrait.php | 2 +- .../src/VuFind/Controller/CartController.php | 6 +- .../Controller/CollectionsController.php | 10 +- .../VuFind/Controller/ContentController.php | 2 +- .../src/VuFind/Controller/CoverController.php | 2 +- .../VuFind/Controller/HierarchyController.php | 6 +- .../src/VuFind/Controller/HoldsTrait.php | 2 +- .../VuFind/Controller/ILLRequestsTrait.php | 4 +- .../VuFind/Controller/InstallController.php | 68 +- .../Controller/LibraryCardsController.php | 4 +- .../Controller/MyResearchController.php | 4 +- .../VuFind/Controller/OverdriveController.php | 70 +- .../Controller/Plugin/AbstractRequestBase.php | 2 +- .../VuFind/Controller/Plugin/DbUpgrade.php | 6 +- .../src/VuFind/Controller/Plugin/Holds.php | 4 +- .../VuFind/Controller/Plugin/ILLRequests.php | 2 +- .../VuFind/Controller/Plugin/Permission.php | 2 +- .../Plugin/StorageRetrievalRequests.php | 2 +- .../StorageRetrievalRequestsTrait.php | 4 +- .../VuFind/Controller/UpgradeController.php | 20 +- .../src/VuFind/Cover/Layer/GridBackground.php | 2 +- module/VuFind/src/VuFind/Cover/Loader.php | 4 +- module/VuFind/src/VuFind/Db/Row/Resource.php | 4 +- module/VuFind/src/VuFind/Db/Table/Gateway.php | 4 +- .../src/VuFind/Db/Table/GatewayFactory.php | 2 +- .../src/VuFind/Db/Table/ResourceTags.php | 10 +- module/VuFind/src/VuFind/Db/Table/Search.php | 2 +- module/VuFind/src/VuFind/Db/Table/Tags.php | 2 +- .../DigitalContent/OverdriveConnector.php | 274 +++---- .../OverdriveConnectorFactory.php | 2 +- module/VuFind/src/VuFind/DoiLinker/Demo.php | 4 +- .../VuFind/src/VuFind/DoiLinker/Unpaywall.php | 6 +- .../Hierarchy/TreeDataFormatter/Xml.php | 2 +- .../Translator/Loader/ExtendedIniReader.php | 2 +- module/VuFind/src/VuFind/ILS/Connection.php | 18 +- .../src/VuFind/ILS/Driver/AbstractAPI.php | 10 +- module/VuFind/src/VuFind/ILS/Driver/Aleph.php | 134 ++-- .../VuFind/ILS/Driver/Aleph/Translator.php | 58 +- module/VuFind/src/VuFind/ILS/Driver/Alma.php | 20 +- .../VuFind/src/VuFind/ILS/Driver/Amicus.php | 192 ++--- module/VuFind/src/VuFind/ILS/Driver/Demo.php | 90 +-- .../src/VuFind/ILS/Driver/Evergreen.php | 104 +-- module/VuFind/src/VuFind/ILS/Driver/Folio.php | 24 +- .../src/VuFind/ILS/Driver/GeniePlus.php | 6 +- .../VuFind/src/VuFind/ILS/Driver/Horizon.php | 340 ++++---- .../src/VuFind/ILS/Driver/HorizonXMLAPI.php | 202 ++--- .../src/VuFind/ILS/Driver/Innovative.php | 36 +- module/VuFind/src/VuFind/ILS/Driver/Koha.php | 116 +-- .../src/VuFind/ILS/Driver/KohaILSDI.php | 334 ++++---- .../VuFind/src/VuFind/ILS/Driver/KohaRest.php | 2 +- .../src/VuFind/ILS/Driver/NewGenLib.php | 142 ++-- module/VuFind/src/VuFind/ILS/Driver/NoILS.php | 10 +- module/VuFind/src/VuFind/ILS/Driver/PAIA.php | 34 +- .../VuFind/src/VuFind/ILS/Driver/Polaris.php | 26 +- .../VuFind/src/VuFind/ILS/Driver/Symphony.php | 4 +- .../VuFind/src/VuFind/ILS/Driver/Unicorn.php | 18 +- .../VuFind/src/VuFind/ILS/Driver/Virtua.php | 724 +++++++++--------- .../VuFind/src/VuFind/ILS/Driver/Voyager.php | 592 +++++++------- .../src/VuFind/ILS/Driver/VoyagerRestful.php | 38 +- .../VuFind/src/VuFind/ILS/Driver/XCNCIP2.php | 30 +- module/VuFind/src/VuFind/ILS/Logic/Holds.php | 32 +- module/VuFind/src/VuFind/ImageLoader.php | 8 +- .../VuFind/src/VuFind/Log/LoggerFactory.php | 4 +- .../src/VuFind/Log/Writer/Office365.php | 10 +- module/VuFind/src/VuFind/OAI/Server.php | 4 +- .../src/VuFind/Recommend/EuropeanaResults.php | 4 +- .../VuFind/Recommend/OpenLibrarySubjects.php | 2 +- .../src/VuFind/Recommend/PubDateVisAjax.php | 4 +- .../src/VuFind/Recommend/RandomRecommend.php | 2 +- .../src/VuFind/RecordDriver/DefaultRecord.php | 8 +- module/VuFind/src/VuFind/RecordDriver/EDS.php | 4 +- module/VuFind/src/VuFind/RecordDriver/EIT.php | 2 +- .../RecordDriver/Feature/IlsAwareTrait.php | 4 +- .../Feature/MarcAdvancedTrait.php | 18 +- .../RecordDriver/Feature/MarcBasicTrait.php | 2 +- .../src/VuFind/RecordDriver/SolrOverdrive.php | 32 +- .../VuFind/src/VuFind/Resolver/Driver/Jop.php | 34 +- .../src/VuFind/Resolver/Driver/Redi.php | 12 +- .../VuFind/src/VuFind/Resolver/Driver/Sfx.php | 2 +- .../VuFind/Resolver/Driver/Threesixtylink.php | 8 +- .../Role/PermissionProvider/ServerParam.php | 4 +- module/VuFind/src/VuFind/SMS/Clickatell.php | 12 +- .../VuFind/src/VuFind/Search/Base/Options.php | 2 +- .../VuFind/src/VuFind/Search/Base/Params.php | 2 +- .../VuFind/src/VuFind/Search/Base/Results.php | 4 +- .../VuFind/src/VuFind/Search/EDS/Options.php | 2 +- .../VuFind/src/VuFind/Search/EDS/Results.php | 2 +- .../Search/Factory/BrowZineBackendFactory.php | 4 +- .../Factory/LibGuidesAZBackendFactory.php | 2 +- .../src/VuFind/Search/LibGuides/Options.php | 2 +- .../src/VuFind/Search/Primo/Options.php | 2 +- .../VuFind/src/VuFind/Search/Solr/Options.php | 2 +- .../VuFind/src/VuFind/Search/Solr/Results.php | 2 +- .../VuFind/Search/Solr/SpellingProcessor.php | 10 +- .../src/VuFind/Search/Summon/Options.php | 2 +- .../src/VuFind/Search/Summon/Params.php | 2 +- module/VuFind/src/VuFind/Session/File.php | 6 +- .../VuFind/src/VuFind/Sitemap/Generator.php | 4 +- module/VuFind/src/VuFind/Solr/Utils.php | 8 +- .../View/Helper/Bootstrap3/LayoutClass.php | 2 +- .../src/VuFind/View/Helper/Root/DateTime.php | 10 +- .../src/VuFind/View/Helper/Root/OpenUrl.php | 2 +- .../src/VuFind/View/Helper/Root/Overdrive.php | 6 +- .../View/Helper/Root/OverdriveFactory.php | 2 +- .../View/Helper/Root/PrintArrayHtml.php | 12 +- .../src/VuFind/View/Helper/Root/Printms.php | 8 +- .../src/VuFind/View/Helper/Root/Record.php | 10 +- .../VuFind/View/Helper/Root/SyndeticsPlus.php | 2 +- .../VuFind/src/VuFind/XSLT/Import/VuFind.php | 8 +- module/VuFind/src/VuFind/XSLT/Importer.php | 2 +- .../Feature/DemoDriverTestTrait.php | 4 +- .../VuFindTest/Integration/MinkTestCase.php | 2 +- .../VuFindTest/Mink/AccountActionsTest.php | 2 +- .../VuFindTest/Mink/AdvancedSearchTest.php | 20 +- .../src/VuFindTest/Mink/ApiTest.php | 6 +- .../src/VuFindTest/Mink/AuthorSearchTest.php | 4 +- .../VuFindTest/Mink/CombinedSearchTest.php | 6 +- .../src/VuFindTest/Mink/CookieConsentTest.php | 4 +- .../src/VuFindTest/Mink/FeedbackTest.php | 2 +- .../src/VuFindTest/Mink/HoldingsTest.php | 8 +- .../src/VuFindTest/Mink/HoldsTest.php | 16 +- .../VuFindTest/Mink/HomePageFacetsTest.php | 2 +- .../src/VuFindTest/Mink/IlsActionsTest.php | 12 +- .../src/VuFindTest/Mink/JumpToRecordTest.php | 2 +- .../src/VuFindTest/Mink/LibraryCardsTest.php | 4 +- .../src/VuFindTest/Mink/NextPrevNavTest.php | 12 +- .../src/VuFindTest/Mink/OAuth2Test.php | 6 +- .../src/VuFindTest/Mink/SavedSearchesTest.php | 10 +- .../src/VuFindTest/Mink/SearchLimitTest.php | 14 +- .../src/VuFindTest/Auth/DatabaseUnitTest.php | 4 +- .../CSV/ImportHelper/ScopusTest.php | 34 +- .../src/VuFindTest/Config/UpgradeTest.php | 16 +- .../VuFindTest/Connection/LibGuidesTest.php | 2 +- .../VuFindTest/Http/CachingDownloaderTest.php | 2 +- .../src/VuFindTest/ILS/Driver/AlephTest.php | 2 +- .../src/VuFindTest/ILS/Driver/AlmaTest.php | 8 +- .../src/VuFindTest/ILS/Driver/DAIATest.php | 38 +- .../src/VuFindTest/ILS/Driver/FolioTest.php | 96 +-- .../ILS/Driver/MultiBackendTest.php | 36 +- .../src/VuFindTest/ILS/Driver/PAIATest.php | 44 +- .../src/VuFindTest/ILS/Driver/XCNCIP2Test.php | 16 +- .../src/VuFindTest/Log/Writer/SlackTest.php | 6 +- .../Recommend/LibGuidesProfileTest.php | 2 +- .../Recommend/RandomRecommendTest.php | 62 +- .../Recommend/SummonBestBetsTest.php | 2 +- .../Recommend/SummonDatabasesTest.php | 2 +- .../VuFindTest/Recommend/SummonTopicsTest.php | 4 +- .../VuFindTest/Recommend/SwitchTabTest.php | 98 +-- .../VuFindTest/Recommend/SwitchTypeTest.php | 14 +- .../Record/FallbackLoader/SolrTest.php | 2 +- .../Record/FallbackLoader/SummonTest.php | 2 +- .../src/VuFindTest/Record/LoaderTest.php | 20 +- .../RecordDriver/DefaultRecordTest.php | 94 +-- .../RecordDriver/SolrDefaultTest.php | 4 +- .../RecordTab/CollectionHierarchyTreeTest.php | 4 +- .../RecordTab/ComponentPartsTest.php | 10 +- .../RecordTab/HoldingsWorldCatTest.php | 8 +- .../src/VuFindTest/RecordTab/MapTest.php | 22 +- .../RecordTab/SimilarItemsCarouselTest.php | 8 +- .../src/VuFindTest/RecordTab/TOCTest.php | 4 +- .../VuFindTest/RecordTab/UserCommentsTest.php | 2 +- .../src/VuFindTest/RecordTab/VersionsTest.php | 2 +- .../src/VuFindTest/Related/SimilarTest.php | 4 +- .../Related/WorldCatSimilarTest.php | 2 +- .../src/VuFindTest/Reserves/CsvReaderTest.php | 2 +- .../VuFindTest/Resolver/Driver/AlmaTest.php | 10 +- .../VuFindTest/Resolver/Driver/JopTest.php | 10 +- .../VuFindTest/Resolver/Driver/RediTest.php | 24 +- .../Role/PermissionDeniedManagerTest.php | 18 +- .../VuFindTest/Role/PermissionManagerTest.php | 4 +- .../Role/PermissionProvider/UserTest.php | 2 +- .../Search/Solr/CustomFilterListenerTest.php | 10 +- .../FilterFieldConversionListenerTest.php | 4 +- .../src/VuFindTest/Search/Solr/ParamsTest.php | 12 +- .../VuFindTest/Search/Solr/ResultsTest.php | 2 +- .../src/VuFindTest/Service/ReCaptchaTest.php | 2 +- .../src/VuFindTest/Solr/UtilsTest.php | 4 +- .../View/Helper/Root/CitationTest.php | 6 +- .../View/Helper/Root/GoogleAnalyticsTest.php | 4 +- .../View/Helper/Root/OpenUrlTest.php | 14 +- .../View/Helper/Root/PermissionTest.php | 18 +- .../View/Helper/Root/PrintArrayHtmlTest.php | 126 +-- .../Controller/FeedbackController.php | 4 +- .../VuFindAdmin/Controller/TagsController.php | 12 +- .../Command/Harvest/MergeMarcCommand.php | 4 +- .../Command/Import/WebCrawlCommand.php | 2 +- .../Command/Install/InstallCommand.php | 24 +- .../Command/Language/AbstractCommand.php | 2 +- .../Command/Language/CopyStringCommand.php | 2 +- .../Command/Language/NormalizeCommand.php | 2 +- .../Command/Util/DeletesCommand.php | 4 +- .../Command/Harvest/MergeMarcCommandTest.php | 2 +- .../Command/Language/NormalizeCommandTest.php | 4 +- .../Command/Util/CommitCommandTest.php | 2 +- .../Command/Util/DedupeCommandTest.php | 4 +- .../Command/Util/DeletesCommandTest.php | 6 +- .../Command/Util/IndexReservesCommandTest.php | 2 +- .../Command/Util/OptimizeCommandTest.php | 2 +- .../Command/Util/SuppressedCommandTest.php | 2 +- .../src/VuFindDevTools/LanguageHelper.php | 20 +- .../src/VuFindSearch/Backend/EDS/Backend.php | 2 +- .../src/VuFindSearch/Backend/EDS/Base.php | 12 +- .../VuFindSearch/Backend/EDS/Connector.php | 2 +- .../Backend/EDS/SearchRequestModel.php | 6 +- .../VuFindSearch/Backend/EIT/Connector.php | 4 +- .../VuFindSearch/Backend/EIT/QueryBuilder.php | 8 +- .../Backend/LibGuides/Connector.php | 4 +- .../Backend/LibGuides/QueryBuilder.php | 2 +- .../VuFindSearch/Backend/Primo/Connector.php | 114 +-- .../src/VuFindSearch/Backend/Solr/Backend.php | 6 +- .../Backend/Solr/Document/RawDocument.php | 2 +- .../Backend/Solr/LuceneSyntaxHelper.php | 6 +- .../Backend/Summon/QueryBuilder.php | 8 +- .../Backend/WorldCat/QueryBuilder.php | 8 +- .../src/VuFindSearch/Command/AbstractBase.php | 2 +- .../Backend/Blender/BackendTest.php | 2 +- .../VuFindTest/Backend/Solr/BackendTest.php | 4 +- .../Backend/Solr/QueryBuilderTest.php | 10 +- .../Backend/Solr/SearchHandlerTest.php | 12 +- .../VuFindTest/Command/RandomCommandTest.php | 6 +- .../Command/RetrieveBatchCommandTest.php | 8 +- .../Command/RetrieveCommandTest.php | 2 +- .../VuFindTest/Command/SimilarCommandTest.php | 4 +- .../src/VuFindTest/Query/QueryTest.php | 2 +- .../src/VuFindTest/SearchServiceTest.php | 2 +- .../src/VuFindTheme/ResourceContainer.php | 2 +- .../src/VuFindTheme/ScssCompiler.php | 2 +- tests/vufind.php-cs-fixer.php | 1 + tests/vufind_templates.php-cs-fixer.php | 1 + .../templates/Auth/AbstractBase/login.phtml | 2 +- .../templates/ContentBlock/FacetList.phtml | 2 +- .../Helpers/copy-to-clipboard-button.phtml | 6 +- .../templates/Helpers/openurl.phtml | 2 +- .../templates/Recommend/AuthorFacets.phtml | 2 +- .../templates/Recommend/MapSelection.phtml | 2 +- .../templates/Recommend/PubDateVisAjax.phtml | 2 +- .../templates/Recommend/RandomRecommend.phtml | 4 +- .../templates/Recommend/SideFacets.phtml | 2 +- .../Recommend/SideFacets/range-slider.phtml | 2 +- .../Recommend/SummonResultsDeferred.phtml | 2 +- .../templates/Recommend/VisualFacets.phtml | 2 +- .../AbstractBase/previewdata.phtml | 6 +- .../DefaultRecord/collection-info.phtml | 4 +- .../RecordDriver/DefaultRecord/core.phtml | 4 +- .../DefaultRecord/list-entry.phtml | 2 +- .../DefaultRecord/result-list.phtml | 4 +- .../RecordDriver/EDS/result-list.phtml | 2 +- .../RecordDriver/Pazpar2/result-list.phtml | 2 +- .../SolrAuthDefault/result-list.phtml | 4 +- .../RecordDriver/SolrOverdrive/core.phtml | 70 +- .../RecordDriver/SolrOverdrive/hold.phtml | 92 +-- .../SolrOverdrive/result-list.phtml | 8 +- .../SolrOverdrive/status-full.phtml | 16 +- .../templates/RecordTab/hierarchytree.phtml | 4 +- .../templates/RecordTab/holdingsils.phtml | 16 +- .../RecordTab/holdingsils/electronic.phtml | 2 +- .../RecordTab/holdingsils/extended.phtml | 24 +- .../RecordTab/holdingsils/standard.phtml | 22 +- .../bootstrap3/templates/RecordTab/map.phtml | 2 +- .../RecordTab/similaritemscarousel.phtml | 2 +- .../templates/RecordTab/usercomments.phtml | 6 +- .../templates/admin/config/home.phtml | 2 +- .../templates/admin/feedback/home.phtml | 2 +- themes/bootstrap3/templates/admin/home.phtml | 2 +- .../templates/admin/maintenance/home.phtml | 2 +- themes/bootstrap3/templates/admin/menu.phtml | 14 +- .../templates/admin/overdrive/home.phtml | 30 +- .../templates/admin/socialstats/home.phtml | 2 +- .../templates/admin/tags/home.phtml | 4 +- .../templates/admin/tags/list.phtml | 4 +- .../templates/admin/tags/manage.phtml | 16 +- .../templates/admin/tags/menu.phtml | 4 +- .../templates/ajax/status-available.phtml | 2 +- .../templates/ajax/status-full.phtml | 2 +- .../templates/ajax/status-unavailable.phtml | 2 +- .../templates/ajax/status-unknown.phtml | 2 +- .../templates/alphabrowse/home.phtml | 8 +- themes/bootstrap3/templates/cart/save.phtml | 2 +- .../templates/channels/channelList.phtml | 2 +- .../templates/checkouts/history.phtml | 2 +- .../templates/collection/view.phtml | 6 +- .../templates/combined/results-ajax.phtml | 2 +- .../templates/combined/results.phtml | 2 +- .../templates/devtools/language.phtml | 6 +- .../bootstrap3/templates/eds/advanced.phtml | 16 +- .../templates/externalauth/ezproxylogin.phtml | 2 +- themes/bootstrap3/templates/header.phtml | 12 +- themes/bootstrap3/templates/holds/edit.phtml | 2 +- themes/bootstrap3/templates/holds/list.phtml | 14 +- .../templates/layout/js-translations.phtml | 14 +- .../bootstrap3/templates/layout/layout.phtml | 10 +- .../templates/librarycards/home.phtml | 2 +- .../templates/librarycards/selectcard.phtml | 2 +- .../templates/myresearch/cataloglogin.phtml | 2 +- .../templates/myresearch/changeemail.phtml | 2 +- .../templates/myresearch/checkedout.phtml | 10 +- .../templates/myresearch/controls/sort.phtml | 2 +- .../templates/myresearch/delete.phtml | 4 +- .../templates/myresearch/edit.phtml | 4 +- .../templates/myresearch/editlist.phtml | 6 +- .../templates/myresearch/fines.phtml | 2 +- .../templates/myresearch/illrequests.phtml | 20 +- .../templates/myresearch/login.phtml | 2 +- .../templates/myresearch/menu.phtml | 2 +- .../templates/myresearch/mylist.phtml | 16 +- .../templates/myresearch/newpassword.phtml | 2 +- .../templates/myresearch/odmycontent.phtml | 2 +- .../templates/myresearch/profile.phtml | 2 +- .../templates/myresearch/schedulesearch.phtml | 14 +- .../myresearch/storageretrievalrequests.phtml | 18 +- .../bootstrap3/templates/primo/advanced.phtml | 10 +- .../bootstrap3/templates/record/addtag.phtml | 4 +- .../templates/record/ajaxview-accordion.phtml | 2 +- .../templates/record/ajaxview-tabs.phtml | 2 +- themes/bootstrap3/templates/record/hold.phtml | 24 +- .../templates/record/illrequest.phtml | 30 +- .../bootstrap3/templates/record/rating.phtml | 2 +- themes/bootstrap3/templates/record/save.phtml | 4 +- themes/bootstrap3/templates/record/sms.phtml | 2 +- .../record/storageretrievalrequest.phtml | 14 +- themes/bootstrap3/templates/record/view.phtml | 6 +- .../templates/search/advanced/layout.phtml | 32 +- .../templates/search/advanced/solr.phtml | 2 +- .../templates/search/controls/limit.phtml | 2 +- .../templates/search/controls/sort.phtml | 2 +- .../templates/search/history-table.phtml | 22 +- .../bootstrap3/templates/search/history.phtml | 16 +- themes/bootstrap3/templates/search/home.phtml | 2 +- .../templates/search/list-authorfacets.phtml | 2 +- .../bootstrap3/templates/search/newitem.phtml | 2 +- .../templates/search/reserves.phtml | 2 +- .../templates/search/reservessearch.phtml | 4 +- .../templates/search/results-scripts.phtml | 8 +- .../bootstrap3/templates/search/results.phtml | 4 +- .../templates/search/searchbox.phtml | 16 +- .../templates/search/versions-searchbox.phtml | 4 +- .../templates/search/home.phtml | 2 +- themes/root/templates/Email/record.phtml | 2 +- themes/root/templates/Email/share-link.phtml | 2 +- .../AbstractBase/export-bibtex.phtml | 10 +- .../AbstractBase/export-endnote.phtml | 6 +- .../AbstractBase/export-endnoteweb.phtml | 32 +- .../AbstractBase/export-refworks.phtml | 8 +- .../AbstractBase/export-ris.phtml | 6 +- .../DefaultRecord/result-email.phtml | 2 +- 384 files changed, 3413 insertions(+), 3411 deletions(-) diff --git a/module/VuFind/functions/codecoverage.php b/module/VuFind/functions/codecoverage.php index 801b2827026..b88ca19b58c 100644 --- a/module/VuFind/functions/codecoverage.php +++ b/module/VuFind/functions/codecoverage.php @@ -77,7 +77,7 @@ function setupVuFindRemoteCodeCoverage(array $modules): void $filter ); } catch (\Exception $e) { - $error("Failed to create collector: " . (string)$e); + $error('Failed to create collector: ' . (string)$e); } $outputDir .= '/' . urlencode($testName); diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetRecordDetails.php b/module/VuFind/src/VuFind/AjaxHandler/GetRecordDetails.php index bcffefa18b4..7cad8d7659c 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetRecordDetails.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetRecordDetails.php @@ -130,7 +130,7 @@ public function handleRequest(Params $params) ); $html = $this->renderer->render( - "record/ajaxview-" . $viewtype . ".phtml", + 'record/ajaxview-' . $viewtype . '.phtml', [ 'defaultTab' => $details['default'], 'driver' => $driver, diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetVisData.php b/module/VuFind/src/VuFind/AjaxHandler/GetVisData.php index 5d4118b9f0d..05707418c3a 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetVisData.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetVisData.php @@ -123,7 +123,7 @@ protected function processFacetValues($filters, $fields) ]; foreach ($values['data']['list'] as $current) { // Only retain numeric values! - if (preg_match("/^[0-9]+$/", $current['value'])) { + if (preg_match('/^[0-9]+$/', $current['value'])) { $newValues['data'][] = [$current['value'], $current['count']]; } diff --git a/module/VuFind/src/VuFind/Auth/CAS.php b/module/VuFind/src/VuFind/Auth/CAS.php index cc91c6fcc74..941a1b6e694 100644 --- a/module/VuFind/src/VuFind/Auth/CAS.php +++ b/module/VuFind/src/VuFind/Auth/CAS.php @@ -137,8 +137,8 @@ public function authenticate($request) // Has the user configured attributes to use for populating the user table? $attribsToCheck = [ - "cat_username", "cat_password", "email", "lastname", "firstname", - "college", "major", "home_library", + 'cat_username', 'cat_password', 'email', 'lastname', 'firstname', + 'college', 'major', 'home_library', ]; $catPassword = null; foreach ($attribsToCheck as $attribute) { @@ -255,14 +255,14 @@ protected function getRequiredAttributes() // Now extract user attribute values: $cas = $this->getConfig()->CAS; foreach ($cas as $key => $value) { - if (preg_match("/userattribute_[0-9]{1,}/", $key)) { + if (preg_match('/userattribute_[0-9]{1,}/', $key)) { $valueKey = 'userattribute_value_' . substr($key, 14); $sortedUserAttributes[$value] = $cas->$valueKey ?? null; // Throw an exception if attributes are missing/empty. if (empty($sortedUserAttributes[$value])) { throw new AuthException( - "User attribute value of " . $value . " is missing!" + 'User attribute value of ' . $value . ' is missing!' ); } } diff --git a/module/VuFind/src/VuFind/Auth/ChoiceAuth.php b/module/VuFind/src/VuFind/Auth/ChoiceAuth.php index 90ce05df8c9..4705c92cd96 100644 --- a/module/VuFind/src/VuFind/Auth/ChoiceAuth.php +++ b/module/VuFind/src/VuFind/Auth/ChoiceAuth.php @@ -105,8 +105,8 @@ protected function validateConfig() || !strlen($this->config->ChoiceAuth->choice_order) ) { throw new AuthException( - "One or more ChoiceAuth parameters are missing. " . - "Check your config.ini!" + 'One or more ChoiceAuth parameters are missing. ' . + 'Check your config.ini!' ); } } diff --git a/module/VuFind/src/VuFind/Auth/LDAP.php b/module/VuFind/src/VuFind/Auth/LDAP.php index 55e0e17ebcf..71ed6c173b3 100644 --- a/module/VuFind/src/VuFind/Auth/LDAP.php +++ b/module/VuFind/src/VuFind/Auth/LDAP.php @@ -62,7 +62,7 @@ protected function validateConfig() || empty($this->config->LDAP->$param) ) { throw new AuthException( - "One or more LDAP parameters are missing. Check your config.ini!" + 'One or more LDAP parameters are missing. Check your config.ini!' ); } } @@ -278,8 +278,8 @@ protected function processLDAPUser($username, $data) // Loop through LDAP response and map fields to database object based // on configuration settings: - for ($i = 0; $i < $data["count"]; $i++) { - for ($j = 0; $j < $data[$i]["count"]; $j++) { + for ($i = 0; $i < $data['count']; $i++) { + for ($j = 0; $j < $data[$i]['count']; $j++) { foreach ($fields as $field) { $configValue = $this->getSetting($field); if ($data[$i][$j] == $configValue && !empty($configValue)) { @@ -288,7 +288,7 @@ protected function processLDAPUser($username, $data) // if no separator is given map only the first value if (isset($separator)) { $tmp = []; - for ($k = 0; $k < $value["count"]; $k++) { + for ($k = 0; $k < $value['count']; $k++) { $tmp[] = $value[$k]; } $value = implode($separator, $tmp); @@ -296,7 +296,7 @@ protected function processLDAPUser($username, $data) $value = $value[0]; } - if ($field != "cat_password") { + if ($field != 'cat_password') { $user->$field = $value ?? ''; } else { $catPassword = $value; diff --git a/module/VuFind/src/VuFind/Auth/Manager.php b/module/VuFind/src/VuFind/Auth/Manager.php index 386a9a166b9..2f2cbc435bb 100644 --- a/module/VuFind/src/VuFind/Auth/Manager.php +++ b/module/VuFind/src/VuFind/Auth/Manager.php @@ -677,7 +677,7 @@ public function login($request) ) { if (!$this->csrf->isValid($request->getPost()->get('csrf'))) { $this->getAuth()->resetState(); - $this->logWarning("Invalid CSRF token passed to login"); + $this->logWarning('Invalid CSRF token passed to login'); throw new AuthException('authentication_error_technical'); } else { // After successful token verification, clear list to shrink session: @@ -793,7 +793,7 @@ public function connectLibraryCard($request, $user) { $auth = $this->getAuth(); if (!$auth->supportsConnectingLibraryCard()) { - throw new \Exception("Connecting of library cards is not supported"); + throw new \Exception('Connecting of library cards is not supported'); } $auth->connectLibraryCard($request, $user); } diff --git a/module/VuFind/src/VuFind/Auth/MultiAuth.php b/module/VuFind/src/VuFind/Auth/MultiAuth.php index d9de79a76a4..5f0f353e045 100644 --- a/module/VuFind/src/VuFind/Auth/MultiAuth.php +++ b/module/VuFind/src/VuFind/Auth/MultiAuth.php @@ -113,8 +113,8 @@ protected function validateConfig() { if (empty($this->config->MultiAuth->method_order)) { throw new AuthException( - "One or more MultiAuth parameters are missing. " . - "Check your config.ini!" + 'One or more MultiAuth parameters are missing. ' . + 'Check your config.ini!' ); } } diff --git a/module/VuFind/src/VuFind/Auth/SIP2.php b/module/VuFind/src/VuFind/Auth/SIP2.php index 15a31e31448..9da378c1868 100644 --- a/module/VuFind/src/VuFind/Auth/SIP2.php +++ b/module/VuFind/src/VuFind/Auth/SIP2.php @@ -78,7 +78,7 @@ public function authenticate($request) $msg_result = $mysip->get_message($in); // Make sure the response is 98 as expected - if (!preg_match("/^98/", $msg_result)) { + if (!preg_match('/^98/', $msg_result)) { $mysip->disconnect(); throw new AuthException('authentication_error_technical'); } @@ -95,7 +95,7 @@ public function authenticate($request) $msg_result = $mysip->get_message($in); // Make sure the response is 24 as expected - if (!preg_match("/^24/", $msg_result)) { + if (!preg_match('/^24/', $msg_result)) { $mysip->disconnect(); throw new AuthException('authentication_error_technical'); } diff --git a/module/VuFind/src/VuFind/Auth/Shibboleth.php b/module/VuFind/src/VuFind/Auth/Shibboleth.php index 140dcb7c0de..91e6123d227 100644 --- a/module/VuFind/src/VuFind/Auth/Shibboleth.php +++ b/module/VuFind/src/VuFind/Auth/Shibboleth.php @@ -162,7 +162,7 @@ protected function validateConfig() $shib = $this->config->Shibboleth; if (!isset($shib->username) || empty($shib->username)) { throw new AuthException( - "Shibboleth username is missing in your configuration file." + 'Shibboleth username is missing in your configuration file.' ); } @@ -387,14 +387,14 @@ protected function getRequiredAttributes($config) // Now extract user attribute values: foreach ($config as $key => $value) { - if (preg_match("/userattribute_[0-9]{1,}/", $key)) { + if (preg_match('/userattribute_[0-9]{1,}/', $key)) { $valueKey = 'userattribute_value_' . substr($key, 14); $sortedUserAttributes[$value] = $config[$valueKey] ?? null; // Throw an exception if attributes are missing/empty. if (empty($sortedUserAttributes[$value])) { throw new AuthException( - "User attribute value of " . $value . " is missing!" + 'User attribute value of ' . $value . ' is missing!' ); } } diff --git a/module/VuFind/src/VuFind/Auth/ShibbolethFactory.php b/module/VuFind/src/VuFind/Auth/ShibbolethFactory.php index 5024722aaf7..c7149c9a0e4 100644 --- a/module/VuFind/src/VuFind/Auth/ShibbolethFactory.php +++ b/module/VuFind/src/VuFind/Auth/ShibbolethFactory.php @@ -47,7 +47,7 @@ */ class ShibbolethFactory implements \Laminas\ServiceManager\Factory\FactoryInterface { - public const SHIBBOLETH_CONFIG_FILE_NAME = "Shibboleth"; + public const SHIBBOLETH_CONFIG_FILE_NAME = 'Shibboleth'; /** * Create an object diff --git a/module/VuFind/src/VuFind/Autocomplete/Solr.php b/module/VuFind/src/VuFind/Autocomplete/Solr.php index ce42471e781..2831ccc3265 100644 --- a/module/VuFind/src/VuFind/Autocomplete/Solr.php +++ b/module/VuFind/src/VuFind/Autocomplete/Solr.php @@ -175,9 +175,9 @@ protected function mungeQuery($query) { // Modify the query so it makes a nice, truncated autocomplete query: $forbidden = [':', '(', ')', '*', '+', '"', "'"]; - $query = str_replace($forbidden, " ", $query); - if (substr($query, -1) != " ") { - $query .= "*"; + $query = str_replace($forbidden, ' ', $query); + if (substr($query, -1) != ' ') { + $query .= '*'; } return $query; } diff --git a/module/VuFind/src/VuFind/Autocomplete/SolrCN.php b/module/VuFind/src/VuFind/Autocomplete/SolrCN.php index 1a7688afa8f..2febe3de2c2 100644 --- a/module/VuFind/src/VuFind/Autocomplete/SolrCN.php +++ b/module/VuFind/src/VuFind/Autocomplete/SolrCN.php @@ -68,17 +68,17 @@ protected function mungeQuery($query) { // Modify the query so it makes a nice, truncated autocomplete query: $forbidden = [':', '(', ')', '*', '+', '"']; - $query = str_replace($forbidden, " ", $query); + $query = str_replace($forbidden, ' ', $query); // Assign display fields and sort order based on the query -- if the // first character is a number, give Dewey priority; otherwise, give // LC priority: if (is_numeric(substr(trim($query), 0, 1))) { $this->setDisplayField(['dewey-full', 'callnumber-raw']); - $this->setSortField("dewey-sort,callnumber-sort"); + $this->setSortField('dewey-sort,callnumber-sort'); } else { $this->setDisplayField(['callnumber-raw', 'dewey-full']); - $this->setSortField("callnumber-sort,dewey-sort"); + $this->setSortField('callnumber-sort,dewey-sort'); } return $query; diff --git a/module/VuFind/src/VuFind/Autocomplete/SolrPrefix.php b/module/VuFind/src/VuFind/Autocomplete/SolrPrefix.php index 168a3be493c..09dd00e2893 100644 --- a/module/VuFind/src/VuFind/Autocomplete/SolrPrefix.php +++ b/module/VuFind/src/VuFind/Autocomplete/SolrPrefix.php @@ -155,7 +155,7 @@ public function getSuggestions($query) protected function mungeQuery($query) { $forbidden = [':', '(', ')', '*', '+', '"']; - return str_replace($forbidden, " ", $query); + return str_replace($forbidden, ' ', $query); } /** diff --git a/module/VuFind/src/VuFind/Cache/KeyGeneratorTrait.php b/module/VuFind/src/VuFind/Cache/KeyGeneratorTrait.php index 0801596e87a..a22cc763122 100644 --- a/module/VuFind/src/VuFind/Cache/KeyGeneratorTrait.php +++ b/module/VuFind/src/VuFind/Cache/KeyGeneratorTrait.php @@ -69,7 +69,7 @@ protected function getCacheKey($suffix = null) // transformed key should match the custom pattern. $key = preg_replace( "/([^a-z0-9_\+\-])+/Di", - "", + '', $key ); } diff --git a/module/VuFind/src/VuFind/ChannelProvider/Random.php b/module/VuFind/src/VuFind/ChannelProvider/Random.php index c669426f452..bc9e484804d 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/Random.php +++ b/module/VuFind/src/VuFind/ChannelProvider/Random.php @@ -138,7 +138,7 @@ public function getFromRecord(RecordDriver $driver, $channelToken = null) public function getFromSearch(Results $results, $channelToken = null) { $params = $results->getParams(); - if ("retain" !== $this->mode) { + if ('retain' !== $this->mode) { $randomParams = $this->paramManager->get($params->getSearchClassId()); } else { $randomParams = clone $params; diff --git a/module/VuFind/src/VuFind/Config/PathResolverFactory.php b/module/VuFind/src/VuFind/Config/PathResolverFactory.php index 3b3019f0315..9e10808384c 100644 --- a/module/VuFind/src/VuFind/Config/PathResolverFactory.php +++ b/module/VuFind/src/VuFind/Config/PathResolverFactory.php @@ -93,14 +93,14 @@ public function __invoke( while (!empty($currentDir)) { // check if the directory exists if (!($canonicalizedCurrentDir = realpath($currentDir))) { - trigger_error("Configured local directory does not exist: " . $currentDir, E_USER_WARNING); + trigger_error('Configured local directory does not exist: ' . $currentDir, E_USER_WARNING); break; } $currentDir = $canonicalizedCurrentDir; // check if the current directory was already included in the stack to avoid infinite loops if (in_array($currentDir, array_column($localDirs, 'directory'))) { - trigger_error("Current directory was already included in the stack: " . $currentDir, E_USER_WARNING); + trigger_error('Current directory was already included in the stack: ' . $currentDir, E_USER_WARNING); break; } diff --git a/module/VuFind/src/VuFind/Config/Upgrade.php b/module/VuFind/src/VuFind/Config/Upgrade.php index 2b22a7c7294..ec17dfaddc5 100644 --- a/module/VuFind/src/VuFind/Config/Upgrade.php +++ b/module/VuFind/src/VuFind/Config/Upgrade.php @@ -465,10 +465,10 @@ protected function checkTheme($setting, $default = null) unset($this->newConfigs['config.ini']['Site'][$setting]); } else { $this->addWarning( - "WARNING: This version of VuFind does not support " + 'WARNING: This version of VuFind does not support ' . "the {$theme} theme. Your config.ini [Site] {$setting} setting" . " has been reset to the default: {$default}. You may need to " - . "reimplement your custom theme." + . 'reimplement your custom theme.' ); $this->newConfigs['config.ini']['Site'][$setting] = $default; } @@ -1351,13 +1351,13 @@ protected function upgradeILS() { $driver = $this->newConfigs['config.ini']['Catalog']['driver'] ?? ''; if (empty($driver)) { - $this->addWarning("WARNING: Could not find ILS driver setting."); + $this->addWarning('WARNING: Could not find ILS driver setting.'); } elseif ('Sample' == $driver) { // No configuration file for Sample driver } elseif (!file_exists($this->oldDir . '/' . $driver . '.ini')) { $this->addWarning( "WARNING: Could not find {$driver}.ini file; " - . "check your ILS driver configuration." + . 'check your ILS driver configuration.' ); } else { $this->saveUnmodifiedConfig($driver . '.ini'); diff --git a/module/VuFind/src/VuFind/Config/Writer.php b/module/VuFind/src/VuFind/Config/Writer.php index deeba574a0d..0a103f4044f 100644 --- a/module/VuFind/src/VuFind/Config/Writer.php +++ b/module/VuFind/src/VuFind/Config/Writer.php @@ -97,8 +97,8 @@ public function set($section, $setting, $value) // Reset some flags and prepare to rewrite the content: $settingSet = false; - $currentSection = ""; - $this->content = ""; + $currentSection = ''; + $this->content = ''; // Process one line at a time... foreach ($lines as $line) { @@ -217,7 +217,7 @@ protected function buildContentValue($e) return 'true'; } elseif ($e === false) { return 'false'; - } elseif ($e == "") { + } elseif ($e == '') { return ''; } else { return '"' . str_replace('"', '\"', $e) . '"'; @@ -253,7 +253,7 @@ protected function buildContentLine($key, $value, $tab = 17) // omit them from the key names; any other index should be // explicitly set: $currentIndex = ($i === $autoIndex) ? '' : $i; - $retVal .= $key . '[' . $currentIndex . ']' . $tabStr . " = " + $retVal .= $key . '[' . $currentIndex . ']' . $tabStr . ' = ' . $this->buildContentValue($current) . "\n"; $autoIndex++; } @@ -261,7 +261,7 @@ protected function buildContentLine($key, $value, $tab = 17) } // Standard case: value is not an array: - return $key . $tabStr . " = " . $this->buildContentValue($value); + return $key . $tabStr . ' = ' . $this->buildContentValue($value); } /** @@ -301,12 +301,12 @@ protected function buildContentArrayLines($key, $value) */ protected function buildContent($assoc_arr, $comments) { - $content = ""; + $content = ''; foreach ($assoc_arr as $key => $elem) { if (isset($comments['sections'][$key]['before'])) { $content .= $comments['sections'][$key]['before']; } - $content .= "[" . $key . "]"; + $content .= '[' . $key . ']'; if (!empty($comments['sections'][$key]['inline'])) { $content .= "\t" . $comments['sections'][$key]['inline']; } diff --git a/module/VuFind/src/VuFind/Connection/LibGuides.php b/module/VuFind/src/VuFind/Connection/LibGuides.php index d3e9abc1b52..f767b80a57c 100644 --- a/module/VuFind/src/VuFind/Connection/LibGuides.php +++ b/module/VuFind/src/VuFind/Connection/LibGuides.php @@ -95,7 +95,7 @@ class LibGuides implements * * @var string */ - protected $userAgent = "VuFind"; + protected $userAgent = 'VuFind'; /** * Constructor @@ -124,7 +124,7 @@ public function __construct( public function getAccounts() { $tokenData = $this->authenticateWithClientCredentials( - $this->baseUrl . "/oauth/token", + $this->baseUrl . '/oauth/token', $this->clientId, $this->clientSecret ); @@ -140,18 +140,18 @@ public function getAccounts() $headers[] = "Authorization: {$tokenData->token_type} " . $tokenData->access_token; } - $headers[] = "User-Agent: " . $this->userAgent; + $headers[] = 'User-Agent: ' . $this->userAgent; $this->client->setHeaders($headers); - $this->client->setMethod("GET"); + $this->client->setMethod('GET'); $this->client->setUri( - $this->baseUrl . "/accounts?expand=profile,subjects" + $this->baseUrl . '/accounts?expand=profile,subjects' ); try { $response = $this->client->send(); } catch (Exception $ex) { $this->error( - "Exception during request: " . + 'Exception during request: ' . $ex->getMessage() ); return null; @@ -159,30 +159,30 @@ public function getAccounts() if ($response->isServerError()) { $this->error( - "LibGuides API HTTP Error: " . + 'LibGuides API HTTP Error: ' . $response->getStatusCode() ); - $this->debug("Request: " . $this->client->getRequest()); - $this->debug("Response: " . $this->client->getResponse()); + $this->debug('Request: ' . $this->client->getRequest()); + $this->debug('Response: ' . $this->client->getResponse()); return null; } $body = $response->getBody(); $returnVal = json_decode($body); $this->debug( - "Return from LibGuides API Call: " . print_r($returnVal, true) + 'Return from LibGuides API Call: ' . print_r($returnVal, true) ); if ($returnVal != null) { if (isset($returnVal->errorCode)) { // In some cases, this should be returned perhaps... - $this->error("LibGuides Error: " . $returnVal->errorCode); + $this->error('LibGuides Error: ' . $returnVal->errorCode); } return $returnVal; } else { $this->error( - "LibGuides API Error: Nothing returned from API call." + 'LibGuides API Error: Nothing returned from API call.' ); $this->debug( - "Body return from LibGuides API Call: " . print_r($body, true) + 'Body return from LibGuides API Call: ' . print_r($body, true) ); } return null; diff --git a/module/VuFind/src/VuFind/Connection/OauthServiceTrait.php b/module/VuFind/src/VuFind/Connection/OauthServiceTrait.php index 3f386390371..cabe350b788 100644 --- a/module/VuFind/src/VuFind/Connection/OauthServiceTrait.php +++ b/module/VuFind/src/VuFind/Connection/OauthServiceTrait.php @@ -72,16 +72,16 @@ public function authenticateWithClientCredentials( $clientId, $clientSecret ) { - $this->oauthServiceTraitDebug("connecting to API"); + $this->oauthServiceTraitDebug('connecting to API'); $tokenData = $this->tokenData; - $this->oauthServiceTraitDebug("Last API Token: " . print_r($tokenData, true)); + $this->oauthServiceTraitDebug('Last API Token: ' . print_r($tokenData, true)); if ( $tokenData == null || !isset($tokenData->access_token) || time() >= $tokenData->expirationTime ) { $authHeader = base64_encode( - $clientId . ":" . $clientSecret + $clientId . ':' . $clientSecret ); $headers = [ 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8', @@ -89,25 +89,25 @@ public function authenticateWithClientCredentials( ]; $this->client->setHeaders($headers); - $this->client->setMethod("POST"); - $this->client->setRawBody("grant_type=client_credentials"); + $this->client->setMethod('POST'); + $this->client->setRawBody('grant_type=client_credentials'); $response = $this->client ->setUri($oauthUrl) ->send(); if ($response->isServerError()) { $this->oauthServiceTraitError( - "API HTTP Error: " . + 'API HTTP Error: ' . $response->getStatusCode() ); - $this->oauthServiceTraitDebug("Request: " . $this->client->getRequest()); + $this->oauthServiceTraitDebug('Request: ' . $this->client->getRequest()); return false; } $body = $response->getBody(); $tokenData = json_decode($body); $this->oauthServiceTraitDebug( - "TokenData returned from API Call: " . print_r( + 'TokenData returned from API Call: ' . print_r( $tokenData, true ) @@ -115,7 +115,7 @@ public function authenticateWithClientCredentials( if ($tokenData != null) { if (isset($tokenData->errorCode)) { // In some cases, this should be returned perhaps... - $this->oauthServiceTraitError("API Error: " . $tokenData->errorCode); + $this->oauthServiceTraitError('API Error: ' . $tokenData->errorCode); return false; } else { $tokenData->expirationTime = time() @@ -125,10 +125,10 @@ public function authenticateWithClientCredentials( } } else { $this->oauthServiceTraitError( - "Error: Nothing returned from API call." + 'Error: Nothing returned from API call.' ); $this->oauthServiceTraitDebug( - "Body return from API Call: " . print_r($body, true) + 'Body return from API Call: ' . print_r($body, true) ); } } diff --git a/module/VuFind/src/VuFind/Connection/OpenLibrary.php b/module/VuFind/src/VuFind/Connection/OpenLibrary.php index 6ab833c0b25..6afcab5d65c 100644 --- a/module/VuFind/src/VuFind/Connection/OpenLibrary.php +++ b/module/VuFind/src/VuFind/Connection/OpenLibrary.php @@ -92,25 +92,25 @@ public function getSubjects( // normalise subject term $subject = $this->normaliseSubjectString($subject); if ($ebooks) { - $ebooks = "true"; + $ebooks = 'true'; } if ($details) { - $details = "true"; + $details = 'true'; } for ($i = 0; $i < count($subjectTypes); $i++) { if (empty($result)) { - $subjectType = ""; - $subjectType = $subjectTypes[$i] == "topic" ? "" : - $subjectTypes[$i] . ":"; + $subjectType = ''; + $subjectType = $subjectTypes[$i] == 'topic' ? '' : + $subjectTypes[$i] . ':'; // build url // ebooks parameter does not work at present, so limit has been set // to 50 to increase likelihood of full-text, public scans being // returned. see https://bugs.launchpad.net/openlibrary/+bug/709772 - $url = "http://openlibrary.org/subjects/" . $subjectType . $subject . - ".json?ebooks=" . $ebooks . "&details=" . $details . - "&offset=" . $offset . "&limit=50&published_in=" . $publishedIn; + $url = 'http://openlibrary.org/subjects/' . $subjectType . $subject . + '.json?ebooks=' . $ebooks . '&details=' . $details . + '&offset=' . $offset . '&limit=50&published_in=' . $publishedIn; // make API call $result = $this->processSubjectsApi($url, $limit, $publicFullText); @@ -185,7 +185,7 @@ protected function normaliseSubjectString($subject) // Normalise search term $subject = str_replace(['"', ',', '/'], '', $subject); $subject = trim(strtolower($subject)); - $subject = preg_replace("/\s+/", "_", $subject); + $subject = preg_replace("/\s+/", '_', $subject); return $subject; } } diff --git a/module/VuFind/src/VuFind/Connection/Oracle.php b/module/VuFind/src/VuFind/Connection/Oracle.php index 67ef0e72472..7103ecd2c82 100644 --- a/module/VuFind/src/VuFind/Connection/Oracle.php +++ b/module/VuFind/src/VuFind/Connection/Oracle.php @@ -338,8 +338,8 @@ public function simpleSelect($sql, $fields = []) { $stmt = $this->prepare($sql); foreach ($fields as $field => $datum) { - [$column, $type] = explode(":", $field); - $this->bindParam($stmt, ":" . $column, $datum, $type); + [$column, $type] = explode(':', $field); + $this->bindParam($stmt, ':' . $column, $datum, $type); } if ($this->exec($stmt)) { @@ -369,7 +369,7 @@ public function simpleDelete($table, $fields = []) // Split all the fields up into arrays foreach ($fields as $field => $datum) { - [$column, $type] = explode(":", $field); + [$column, $type] = explode(':', $field); $types[$column] = $type; $data[$column] = $datum; $clauses[] = "$column = :$column"; @@ -377,14 +377,14 @@ public function simpleDelete($table, $fields = []) // Prepare the SQL for child table - turn the columns in placeholders for // the bind - $sql = "DELETE FROM $table WHERE " . implode(" AND ", $clauses); + $sql = "DELETE FROM $table WHERE " . implode(' AND ', $clauses); $delete = $this->prepare($sql); // Bind Variables foreach (array_keys($data) as $column) { $this->bindParam( $delete, - ":" . $column, + ':' . $column, $data[$column], $types[$column] ); @@ -419,7 +419,7 @@ public function simpleInsert($table, $fields = []) // Split all the fields up into arrays foreach ($fields as $field => $datum) { - $tmp = explode(":", $field); + $tmp = explode(':', $field); $column = array_shift($tmp); // For binding @@ -430,21 +430,21 @@ public function simpleInsert($table, $fields = []) $columns[] = $column; // Dates are special if (count($tmp) > 0 && null !== $datum) { - $values[] = "TO_DATE(:$column, '" . implode(":", $tmp) . "')"; + $values[] = "TO_DATE(:$column, '" . implode(':', $tmp) . "')"; } else { $values[] = ":$column"; } } - $sql = "INSERT INTO $table (" . implode(", ", $columns) . ") VALUES (" . - implode(", ", $values) . ")"; + $sql = "INSERT INTO $table (" . implode(', ', $columns) . ') VALUES (' . + implode(', ', $values) . ')'; $insert = $this->prepare($sql); // Bind Variables foreach (array_keys($data) as $column) { $this->bindParam( $insert, - ":" . $column, + ':' . $column, $data[$column], $types[$column] ); @@ -474,8 +474,8 @@ public function simpleSql($sql, $fields = []) { $stmt = $this->prepare($sql); foreach ($fields as $field => $datum) { - [$column, $type] = explode(":", $field); - $this->bindParam($stmt, ":" . $column, $datum, $type); + [$column, $type] = explode(':', $field); + $this->bindParam($stmt, ':' . $column, $datum, $type); } if ($this->exec($stmt)) { $this->commit(); @@ -556,7 +556,7 @@ public function getLastSql() public function getHtmlError() { if ($this->lastError == null) { - return "No error found!"; + return 'No error found!'; } // Generic stuff @@ -587,7 +587,7 @@ public function getHtmlError() $output .= "Bind Variables:
\n"; foreach ($this->lastErrorFields as $k => $l) { if (is_array($l)) { - $output .= "$k => (" . implode(", ", $l) . ")
\n"; + $output .= "$k => (" . implode(', ', $l) . ")
\n"; } else { $output .= "$k => $l
\n"; } diff --git a/module/VuFind/src/VuFind/Connection/Wikipedia.php b/module/VuFind/src/VuFind/Connection/Wikipedia.php index eb243b092be..27c178bfaed 100644 --- a/module/VuFind/src/VuFind/Connection/Wikipedia.php +++ b/module/VuFind/src/VuFind/Connection/Wikipedia.php @@ -151,25 +151,25 @@ protected function extractImageFromInfoBox($infoboxStr) // Look through every row of the infobox foreach ($infobox as $row) { - $data = explode("=", $row); + $data = explode('=', $row); $key = trim(array_shift($data)); - $value = trim(implode("=", $data)); + $value = trim(implode('=', $data)); // At the moment we only want stuff related to the image. switch (strtolower($key)) { - case "img": - case "image": - case "image:": - case "image_name": - case "imagem": + case 'img': + case 'image': + case 'image:': + case 'image_name': + case 'imagem': case 'imagen': case 'immagine': $imageName = str_replace(' ', '_', $value); break; - case "caption": - case "img_capt": - case "image_caption": - case "legenda": + case 'caption': + case 'img_capt': + case 'image_caption': + case 'legenda': case 'textoimagen': $imageCaption = $value; break; @@ -203,7 +203,7 @@ protected function extractInfoBox($body) foreach ($infoboxTags as $tag) { if (substr($m, 0, strlen($tag) + 1) == '{' . $tag) { // We found an infobox!! - return "{" . $m . "}"; + return '{' . $m . '}'; } } } @@ -257,12 +257,12 @@ protected function stripImageAndFileLinks($body) // ... unless there's a better pattern? TODO // eg. [[File:Johann Sebastian Bach.jpg|thumb|Bach in a 1748 portrait by // [[Elias Gottlob Haussmann|Haussmann]]]] - $open = "\\["; - $close = "\\]"; - $content = "(?>[^\\[\\]]+)"; // Anything but [ or ] + $open = '\\['; + $close = '\\]'; + $content = '(?>[^\\[\\]]+)'; // Anything but [ or ] // We can either find content or recursive brackets: $recursive_match = "($content|(?R))*"; - $body .= "[[file:bad]]"; + $body .= '[[file:bad]]'; preg_match_all("/{$open}{$recursive_match}{$close}/Us", $body, $new_matches); // Loop through every match (link) we found if (is_array($new_matches)) { @@ -270,10 +270,10 @@ protected function stripImageAndFileLinks($body) foreach ((array)$nm as $n) { // If it's a file link get rid of it if ( - strtolower(substr($n, 0, 7)) == "[[file:" - || strtolower(substr($n, 0, 8)) == "[[image:" + strtolower(substr($n, 0, 7)) == '[[file:' + || strtolower(substr($n, 0, 8)) == '[[image:' ) { - $body = str_replace($n, "", $body); + $body = str_replace($n, '', $body); } } } @@ -291,7 +291,7 @@ protected function stripImageAndFileLinks($body) protected function sanitizeWikipediaBody($body) { // Cull our content back to everything before the first heading - $body = trim(substr($body, 0, strpos($body, "=="))); + $body = trim(substr($body, 0, strpos($body, '=='))); // Strip out links $body = $this->stripImageAndFileLinks($body); @@ -310,7 +310,7 @@ protected function sanitizeWikipediaBody($body) // Fix pronunciation guides $pattern[] = '/({{)pron-en\|([^}]*)(}})/Us'; - $replacement[] = $this->translate('pronounced') . " /$2/"; + $replacement[] = $this->translate('pronounced') . ' /$2/'; // Fix dashes $pattern[] = '/{{ndash}}/'; @@ -318,13 +318,13 @@ protected function sanitizeWikipediaBody($body) // Removes citations $pattern[] = '/({{)[^}]*(}})/Us'; - $replacement[] = ""; + $replacement[] = ''; // ... OR ... $pattern[] = '/.*<\/ref>/Us'; - $replacement[] = ""; + $replacement[] = ''; // $pattern[] = '//Us'; - $replacement[] = ""; + $replacement[] = ''; // Removes comments followed by carriage returns to avoid excess whitespace $pattern[] = '/\n*/Us'; diff --git a/module/VuFind/src/VuFind/Content/AuthorNotes/Syndetics.php b/module/VuFind/src/VuFind/Content/AuthorNotes/Syndetics.php index b4bb91cc5f9..438145b8896 100644 --- a/module/VuFind/src/VuFind/Content/AuthorNotes/Syndetics.php +++ b/module/VuFind/src/VuFind/Content/AuthorNotes/Syndetics.php @@ -113,7 +113,7 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) $anotes[$i]['Content'] = $sourceInfo['div']; } else { // Get the marc field for author notes (980) - $nodes = $xmldoc2->GetElementsbyTagName("Fld980"); + $nodes = $xmldoc2->GetElementsbyTagName('Fld980'); if (!$nodes->length) { // Skip fields with missing text continue; diff --git a/module/VuFind/src/VuFind/Content/Covers/Bokinfo.php b/module/VuFind/src/VuFind/Content/Covers/Bokinfo.php index 42cb4f472f1..714b67b72cf 100644 --- a/module/VuFind/src/VuFind/Content/Covers/Bokinfo.php +++ b/module/VuFind/src/VuFind/Content/Covers/Bokinfo.php @@ -84,7 +84,7 @@ public function getUrl($key, $size, $ids) ); $client->getRequest()->getHeaders() - ->addHeaderLine("Ocp-Apim-Subscription-Key", $key); + ->addHeaderLine('Ocp-Apim-Subscription-Key', $key); $resp = $client->send(); $body = $resp->getBody(); @@ -148,8 +148,8 @@ protected function testUrlFunction($url) */ protected function getImageUrl($rawXML) { - if (!str_contains($rawXML, "ResourceLink")) { - return ""; + if (!str_contains($rawXML, 'ResourceLink')) { + return ''; } // This is already wrapped in try..catch @@ -157,7 +157,7 @@ protected function getImageUrl($rawXML) foreach ($xml->getDocNamespaces() as $strPrefix => $strNamespace) { if (strlen($strPrefix) == 0) { - $strPrefix = "_"; // Assign an arbitrary namespace prefix. + $strPrefix = '_'; // Assign an arbitrary namespace prefix. } $xml->registerXPathNamespace($strPrefix, $strNamespace); } diff --git a/module/VuFind/src/VuFind/Content/Covers/Buchhandel.php b/module/VuFind/src/VuFind/Content/Covers/Buchhandel.php index 564041b299b..b0db55d10f8 100644 --- a/module/VuFind/src/VuFind/Content/Covers/Buchhandel.php +++ b/module/VuFind/src/VuFind/Content/Covers/Buchhandel.php @@ -95,7 +95,7 @@ public function getUrl($key, $size, $ids) $lsize = substr($size, 0, 1); break; default: - $lsize = "s"; + $lsize = 's'; break; } diff --git a/module/VuFind/src/VuFind/Content/Covers/Koha.php b/module/VuFind/src/VuFind/Content/Covers/Koha.php index f22553a2188..b3bac69bd81 100644 --- a/module/VuFind/src/VuFind/Content/Covers/Koha.php +++ b/module/VuFind/src/VuFind/Content/Covers/Koha.php @@ -87,7 +87,7 @@ public function getUrl($key, $size, $ids) } $url = $this->url . '?'; if (in_array($size, $this->thumbnailSizes)) { - $url .= "thumbnail=1&"; + $url .= 'thumbnail=1&'; } $url .= 'biblionumber=' . urlencode($ids['recordid']); return $url; diff --git a/module/VuFind/src/VuFind/Content/Covers/KohaFactory.php b/module/VuFind/src/VuFind/Content/Covers/KohaFactory.php index 5c2bc9be956..9b080379302 100644 --- a/module/VuFind/src/VuFind/Content/Covers/KohaFactory.php +++ b/module/VuFind/src/VuFind/Content/Covers/KohaFactory.php @@ -72,7 +72,7 @@ public function __invoke( $config = $container->get(\VuFind\Config\PluginManager::class) ->get('config'); if (empty($config->Content->koha_cover_url)) { - throw new \Exception("Koha cover URL must be provided."); + throw new \Exception('Koha cover URL must be provided.'); } return new $requestedName($config->Content->koha_cover_url); } diff --git a/module/VuFind/src/VuFind/Content/Covers/LocalFile.php b/module/VuFind/src/VuFind/Content/Covers/LocalFile.php index 16be77f280a..be6162809f8 100644 --- a/module/VuFind/src/VuFind/Content/Covers/LocalFile.php +++ b/module/VuFind/src/VuFind/Content/Covers/LocalFile.php @@ -45,7 +45,7 @@ class LocalFile extends \VuFind\Content\AbstractCover * * @var array */ - protected $imageExtensions = ["gif", "jpg", "jpeg", "png", "tif", "tiff"]; + protected $imageExtensions = ['gif', 'jpg', 'jpeg', 'png', 'tif', 'tiff']; /** * MIME types allowed to be loaded from disk. @@ -53,7 +53,7 @@ class LocalFile extends \VuFind\Content\AbstractCover * @var array */ protected $allowedMimeTypes = [ - "image/gif", "image/jpeg", "image/png", "image/tiff", + 'image/gif', 'image/jpeg', 'image/png', 'image/tiff', ]; /** @@ -89,7 +89,7 @@ public function getUrl($key, $size, $ids) // Validate MIME type if we have a valid file path. if ($fileName && file_exists($fileName)) { if (in_array(mime_content_type($fileName), $this->allowedMimeTypes)) { - return "file://" . $fileName; + return 'file://' . $fileName; } } // If we got this far, we couldn't find a match. diff --git a/module/VuFind/src/VuFind/Content/Covers/Syndetics.php b/module/VuFind/src/VuFind/Content/Covers/Syndetics.php index f53a4fa8e38..8329b73800b 100644 --- a/module/VuFind/src/VuFind/Content/Covers/Syndetics.php +++ b/module/VuFind/src/VuFind/Content/Covers/Syndetics.php @@ -85,7 +85,7 @@ public function getUrl($key, $size, $ids) $url = $this->useSSL ? 'https://secure.syndetics.com' : 'http://syndetics.com'; - $url .= "/index.aspx?type=xw12"; + $url .= '/index.aspx?type=xw12'; if (isset($ids['isbn']) && $ids['isbn']->isValid()) { $isbn = $ids['isbn']->get13(); $url .= "&isbn={$isbn}"; diff --git a/module/VuFind/src/VuFind/Content/Excerpts/Syndetics.php b/module/VuFind/src/VuFind/Content/Excerpts/Syndetics.php index 27329db3769..000677989ab 100644 --- a/module/VuFind/src/VuFind/Content/Excerpts/Syndetics.php +++ b/module/VuFind/src/VuFind/Content/Excerpts/Syndetics.php @@ -113,7 +113,7 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) $excerpt[$i]['Content'] = $sourceInfo['div']; } else { // Get the marc field for excerpts (520) - $nodes = $xmldoc2->GetElementsbyTagName("Fld520"); + $nodes = $xmldoc2->GetElementsbyTagName('Fld520'); if (!$nodes->length) { // Skip excerpts with missing text continue; @@ -122,7 +122,7 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) = html_entity_decode($xmldoc2->saveXML($nodes->item(0))); // Get the marc field for copyright (997) - $nodes = $xmldoc->GetElementsbyTagName("Fld997"); + $nodes = $xmldoc->GetElementsbyTagName('Fld997'); if ($nodes->length) { $excerpt[$i]['Copyright'] = html_entity_decode( $xmldoc2->saveXML($nodes->item(0)) diff --git a/module/VuFind/src/VuFind/Content/ObalkyKnihService.php b/module/VuFind/src/VuFind/Content/ObalkyKnihService.php index 93ba923b089..077b0ded36c 100644 --- a/module/VuFind/src/VuFind/Content/ObalkyKnihService.php +++ b/module/VuFind/src/VuFind/Content/ObalkyKnihService.php @@ -94,7 +94,7 @@ public function __construct(\Laminas\Config\Config $config) || !isset($config->books_endpoint) ) { throw new \Exception( - "Configuration for ObalkyKnih.cz service is not valid" + 'Configuration for ObalkyKnih.cz service is not valid' ); } $this->baseUrls = $config->base_url; @@ -177,7 +177,7 @@ public function getData(array $ids): ?\stdClass */ protected function getFromService(array $ids): ?\stdClass { - $param = "multi"; + $param = 'multi'; $query = []; $isbn = null; if (!empty($ids['isbns'])) { @@ -212,7 +212,7 @@ function ($isbn) { $this->logWarning('All ObalkyKnih servers are down.'); return null; } - $url .= $this->endpoints['books'] . "?"; + $url .= $this->endpoints['books'] . '?'; $url .= http_build_query([$param => json_encode([$query])]); $client = $this->getHttpClient($url); try { diff --git a/module/VuFind/src/VuFind/Content/Reviews/Booksite.php b/module/VuFind/src/VuFind/Content/Reviews/Booksite.php index 7fcd1c96f39..afac2c8e327 100644 --- a/module/VuFind/src/VuFind/Content/Reviews/Booksite.php +++ b/module/VuFind/src/VuFind/Content/Reviews/Booksite.php @@ -90,13 +90,13 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) $response = $this->getHttpClient($url)->send(); if (!$response->isSuccess()) { $this->logWarning( - "Reviews: " . $response->getStatusCode() . " " + 'Reviews: ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase() . " $url" ); return $reviews; // still empty } $this->debug( - "Reviews: " . $response->getStatusCode() . " " + 'Reviews: ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase() . " $url" ); diff --git a/module/VuFind/src/VuFind/Content/Reviews/Guardian.php b/module/VuFind/src/VuFind/Content/Reviews/Guardian.php index 256859f9f49..33449dcd852 100644 --- a/module/VuFind/src/VuFind/Content/Reviews/Guardian.php +++ b/module/VuFind/src/VuFind/Content/Reviews/Guardian.php @@ -59,13 +59,13 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) { // Base request URL: $url - = "http://content.guardianapis.com/search?order-by=newest&format=json" . - "&show-fields=all&reference=isbn%2F" . $isbnObj->get13(); + = 'http://content.guardianapis.com/search?order-by=newest&format=json' . + '&show-fields=all&reference=isbn%2F' . $isbnObj->get13(); // Only add api-key if one has been provided in config.ini. If no key is // provided, a link to the Guardian can still be shown. if (strlen($key) > 0) { - $url = $url . "&api-key=" . $key; + $url = $url . '&api-key=' . $key; } $this->debug('Guardian request: ' . $url); @@ -82,7 +82,7 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) $i = 0; foreach ($data['response']['results'] as $review) { $result[$i]['Date'] = $review['webPublicationDate']; - $result[$i]['Summary'] = $review['fields']['headline'] . ". " . + $result[$i]['Summary'] = $review['fields']['headline'] . '. ' . preg_replace( '/

|

]*>|<\/p>/', '', @@ -97,14 +97,14 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) = 'http://image.guardian.co.uk/sys-images/Guardian/' . 'Pix/pictures/2010/03/01/poweredbyguardianBLACK.png'; - $result[$i]['Copyright'] = "" . + $result[$i]['Copyright'] = '' . ""; + 'alt="Powered by the Guardian" />'; $result[$i]['Source'] = $review['fields']['byline']; // Only return Content if the body tag contains a usable review - $redist = "Redistribution rights for this field are unavailable"; + $redist = 'Redistribution rights for this field are unavailable'; if ( (strlen($review['fields']['body']) > 0) && (!strstr($review['fields']['body'], $redist)) diff --git a/module/VuFind/src/VuFind/Content/Reviews/Syndetics.php b/module/VuFind/src/VuFind/Content/Reviews/Syndetics.php index 2c22aa366f4..23217a3174b 100644 --- a/module/VuFind/src/VuFind/Content/Reviews/Syndetics.php +++ b/module/VuFind/src/VuFind/Content/Reviews/Syndetics.php @@ -144,7 +144,7 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) $review[$i]['Content'] = $sourceInfo['div']; } else { // Get the marc field for reviews (520) - $nodes = $xmldoc2->GetElementsbyTagName("Fld520"); + $nodes = $xmldoc2->GetElementsbyTagName('Fld520'); if (!$nodes->length) { // Skip reviews with missing text continue; @@ -157,7 +157,7 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) ); // Get the marc field for copyright (997) - $nodes = $xmldoc2->GetElementsbyTagName("Fld997"); + $nodes = $xmldoc2->GetElementsbyTagName('Fld997'); if ($nodes->length) { $review[$i]['Copyright'] = html_entity_decode($xmldoc2->saveXML($nodes->item(0))); diff --git a/module/VuFind/src/VuFind/Content/Summaries/Syndetics.php b/module/VuFind/src/VuFind/Content/Summaries/Syndetics.php index 8b0ebeda524..35fe21a4f36 100644 --- a/module/VuFind/src/VuFind/Content/Summaries/Syndetics.php +++ b/module/VuFind/src/VuFind/Content/Summaries/Syndetics.php @@ -113,7 +113,7 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) $summaries[] = $sourceInfo['div']; } else { // Get the marc field for summaries. (520) - $nodes = $xmldoc2->GetElementsbyTagName("Fld520"); + $nodes = $xmldoc2->GetElementsbyTagName('Fld520'); foreach ($nodes as $node) { $summaries[] = preg_replace( '/|]*>|<\/a>/', diff --git a/module/VuFind/src/VuFind/Content/TOC/Syndetics.php b/module/VuFind/src/VuFind/Content/TOC/Syndetics.php index d931759dc41..92a1b6fc468 100644 --- a/module/VuFind/src/VuFind/Content/TOC/Syndetics.php +++ b/module/VuFind/src/VuFind/Content/TOC/Syndetics.php @@ -112,7 +112,7 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) $toc = $sourceInfo['div']; } else { // Get the marc field for toc (970) - $nodes = $xmldoc2->GetElementsbyTagName("Fld970"); + $nodes = $xmldoc2->GetElementsbyTagName('Fld970'); foreach ($nodes as $node) { $li = ''; @@ -120,7 +120,7 @@ public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) // Chapter labels. $nodeList = $node->getElementsByTagName('l'); if ($nodeList->length > 0) { - $li .= sprintf("%s. ", $nodeList->item(0)->nodeValue); + $li .= sprintf('%s. ', $nodeList->item(0)->nodeValue); } // Chapter title. diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php index b7a96957e55..332c8c1e58e 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php +++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php @@ -131,7 +131,7 @@ protected function redirectToSavedSearch($id) if (empty($search)) { // User is trying to view a saved search from another session // (deliberate or expired) or associated with another user. - throw new \Exception("Attempt to access invalid search ID"); + throw new \Exception('Attempt to access invalid search ID'); } // If we got this far, the user is allowed to view the search, so we can diff --git a/module/VuFind/src/VuFind/Controller/AjaxResponseTrait.php b/module/VuFind/src/VuFind/Controller/AjaxResponseTrait.php index 7380df95e6c..7d029ecc379 100644 --- a/module/VuFind/src/VuFind/Controller/AjaxResponseTrait.php +++ b/module/VuFind/src/VuFind/Controller/AjaxResponseTrait.php @@ -186,7 +186,7 @@ protected function callAjaxMethod($method, $type = 'application/json') public static function storeError($errno, $errstr, $errfile, $errline) { self::$php_errors[] = "ERROR [$errno] - " . $errstr . "
\n" - . " Occurred in " . $errfile . " on line " . $errline . "."; + . ' Occurred in ' . $errfile . ' on line ' . $errline . '.'; return true; } } diff --git a/module/VuFind/src/VuFind/Controller/CartController.php b/module/VuFind/src/VuFind/Controller/CartController.php index c145b57ec50..c1ccf2d296f 100644 --- a/module/VuFind/src/VuFind/Controller/CartController.php +++ b/module/VuFind/src/VuFind/Controller/CartController.php @@ -170,9 +170,9 @@ public function homeAction() } else { $addItems = $this->getCart()->addItems($ids); if (!$addItems['success']) { - $msg = $this->translate('bookbag_full_msg') . ". " - . $addItems['notAdded'] . " " - . $this->translate('items_already_in_bookbag') . "."; + $msg = $this->translate('bookbag_full_msg') . '. ' + . $addItems['notAdded'] . ' ' + . $this->translate('items_already_in_bookbag') . '.'; $this->flashMessenger()->addMessage($msg, 'info'); } } diff --git a/module/VuFind/src/VuFind/Controller/CollectionsController.php b/module/VuFind/src/VuFind/Controller/CollectionsController.php index 8be7b9ec486..7b8b8b336a8 100644 --- a/module/VuFind/src/VuFind/Controller/CollectionsController.php +++ b/module/VuFind/src/VuFind/Controller/CollectionsController.php @@ -116,7 +116,7 @@ protected function getBrowseDelimiter() protected function showBrowseAlphabetic() { // Process incoming parameters: - $source = "hierarchy"; + $source = 'hierarchy'; $from = $this->params()->fromQuery('from', ''); $page = $this->params()->fromQuery('page', 0); $limit = $this->getBrowseLimit(); @@ -151,9 +151,9 @@ protected function showBrowseAlphabetic() $delimiter = $this->getBrowseDelimiter(); foreach ($result['Browse']['items'] as $rkey => $collection) { $collectionIdNamePair - = explode($delimiter, $collection["heading"]); + = explode($delimiter, $collection['heading']); $finalresult[$rkey]['displayText'] = $collectionIdNamePair[0]; - $finalresult[$rkey]['count'] = $collection["count"]; + $finalresult[$rkey]['count'] = $collection['count']; $finalresult[$rkey]['value'] = $collectionIdNamePair[1]; } $view->result = $finalresult; @@ -175,7 +175,7 @@ protected function showBrowseIndex() $appliedFilters = $this->params()->fromQuery('filter', []); $limit = $this->getBrowseLimit(); - $browseField = "hierarchy_browse"; + $browseField = 'hierarchy_browse'; $searchObject = $this->serviceLocator ->get(\VuFind\Search\Results\PluginManager::class)->get('Solr'); @@ -309,7 +309,7 @@ protected function normalizeForBrowse($val) { $valNormalized = iconv('UTF-8', 'US-ASCII//TRANSLIT//IGNORE', $val); $valNormalized = strtolower($valNormalized); - $valNormalized = preg_replace("/[^a-zA-Z0-9\s]/", "", $valNormalized); + $valNormalized = preg_replace("/[^a-zA-Z0-9\s]/", '', $valNormalized); $valNormalized = trim($valNormalized); return $valNormalized; } diff --git a/module/VuFind/src/VuFind/Controller/ContentController.php b/module/VuFind/src/VuFind/Controller/ContentController.php index 57eb76ee47c..fdc6f017ab4 100644 --- a/module/VuFind/src/VuFind/Controller/ContentController.php +++ b/module/VuFind/src/VuFind/Controller/ContentController.php @@ -64,7 +64,7 @@ class ContentController extends AbstractBase public function contentAction() { $page = $this->params()->fromRoute('page'); - $pathPrefix = "templates/content/"; + $pathPrefix = 'templates/content/'; $pageLocator = $this->serviceLocator ->get(\VuFind\Content\PageLocator::class); $data = $pageLocator->determineTemplateAndRenderer($pathPrefix, $page); diff --git a/module/VuFind/src/VuFind/Controller/CoverController.php b/module/VuFind/src/VuFind/Controller/CoverController.php index 01f1bd2d4fe..639f4fa5a50 100644 --- a/module/VuFind/src/VuFind/Controller/CoverController.php +++ b/module/VuFind/src/VuFind/Controller/CoverController.php @@ -181,7 +181,7 @@ protected function displayImage($type = null, $image = null) $coverImageTtl = (60 * 60 * 24 * 14); // 14 days $headers->addHeaderLine( 'Cache-Control', - "maxage=" . $coverImageTtl + 'maxage=' . $coverImageTtl ); $headers->addHeaderLine( 'Pragma', diff --git a/module/VuFind/src/VuFind/Controller/HierarchyController.php b/module/VuFind/src/VuFind/Controller/HierarchyController.php index 1afb113634e..f968e882744 100644 --- a/module/VuFind/src/VuFind/Controller/HierarchyController.php +++ b/module/VuFind/src/VuFind/Controller/HierarchyController.php @@ -107,8 +107,8 @@ public function searchtreeAction() $limitReached = ($limit > 0 && count($resultIDs) > $limit); $returnArray = [ - "limitReached" => $limitReached, - "results" => array_slice($resultIDs, 0, $limit), + 'limitReached' => $limitReached, + 'results' => array_slice($resultIDs, 0, $limit), ]; return $this->outputJSON(json_encode($returnArray)); } @@ -144,7 +144,7 @@ public function gettreeAction() // If we got this far, something went wrong: return $this->output( - "" . $this->translate("hierarchy_tree_error") . "" + '' . $this->translate('hierarchy_tree_error') . '' ); } diff --git a/module/VuFind/src/VuFind/Controller/HoldsTrait.php b/module/VuFind/src/VuFind/Controller/HoldsTrait.php index 32a98479821..04cd0fbb8da 100644 --- a/module/VuFind/src/VuFind/Controller/HoldsTrait.php +++ b/module/VuFind/src/VuFind/Controller/HoldsTrait.php @@ -98,7 +98,7 @@ public function holdAction() $gatheredDetails ) : []; $extraHoldFields = isset($checkHolds['extraHoldFields']) - ? explode(":", $checkHolds['extraHoldFields']) : []; + ? explode(':', $checkHolds['extraHoldFields']) : []; $requestGroupNeeded = in_array('requestGroup', $extraHoldFields) && !empty($requestGroups) diff --git a/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php b/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php index ceb4c8eb854..70e331789c2 100644 --- a/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php +++ b/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php @@ -93,7 +93,7 @@ public function illRequestAction() // Send various values to the view so we can build the form: $extraFields = isset($checkRequests['extraFields']) - ? explode(":", $checkRequests['extraFields']) : []; + ? explode(':', $checkRequests['extraFields']) : []; // Process form submissions if necessary: if (null !== $this->params()->fromPost('placeILLRequest')) { @@ -139,7 +139,7 @@ public function illRequestAction() ->getDefaultRequiredDate($checkRequests); $defaultRequiredDate = $this->serviceLocator->get(\VuFind\Date\Converter::class) - ->convertToDisplayDate("U", $defaultRequiredDate); + ->convertToDisplayDate('U', $defaultRequiredDate); // Get pickup libraries $pickupLibraries = $catalog->getILLPickUpLibraries( diff --git a/module/VuFind/src/VuFind/Controller/InstallController.php b/module/VuFind/src/VuFind/Controller/InstallController.php index e0f246385ce..9569c0a2e29 100644 --- a/module/VuFind/src/VuFind/Controller/InstallController.php +++ b/module/VuFind/src/VuFind/Controller/InstallController.php @@ -295,9 +295,9 @@ public function fixdependenciesAction() // Is our version new enough? if (!$this->phpVersionIsNewEnough()) { - $msg = "VuFind requires PHP version " . $this->getMinimalPhpVersion() - . " or newer; you are running " . phpversion() - . ". Please upgrade."; + $msg = 'VuFind requires PHP version ' . $this->getMinimalPhpVersion() + . ' or newer; you are running ' . phpversion() + . '. Please upgrade.'; $this->flashMessenger()->addMessage($msg, 'error'); $problems++; } @@ -305,11 +305,11 @@ public function fixdependenciesAction() // Is the mbstring library missing? if (!function_exists('mb_substr')) { $msg - = "Your PHP installation appears to be missing the mbstring plug-in." - . " For better language support, it is recommended that you add" - . " this. For details on how to do this, see " - . "https://vufind.org/wiki/installation " - . "and look at the PHP installation instructions for your platform."; + = 'Your PHP installation appears to be missing the mbstring plug-in.' + . ' For better language support, it is recommended that you add' + . ' this. For details on how to do this, see ' + . 'https://vufind.org/wiki/installation ' + . 'and look at the PHP installation instructions for your platform.'; $this->flashMessenger()->addMessage($msg, 'error'); $problems++; } @@ -317,11 +317,11 @@ public function fixdependenciesAction() // Is the GD library missing? if (!is_callable('imagecreatefromstring')) { $msg - = "Your PHP installation appears to be missing the GD plug-in. " - . "For better graphics support, it is recommended that you add this." - . " For details on how to do this, see " - . "https://vufind.org/wiki/installation " - . "and look at the PHP installation instructions for your platform."; + = 'Your PHP installation appears to be missing the GD plug-in. ' + . 'For better graphics support, it is recommended that you add this.' + . ' For details on how to do this, see ' + . 'https://vufind.org/wiki/installation ' + . 'and look at the PHP installation instructions for your platform.'; $this->flashMessenger()->addMessage($msg, 'error'); $problems++; } @@ -329,11 +329,11 @@ public function fixdependenciesAction() // Is the openssl library missing? if (!function_exists('openssl_encrypt')) { $msg - = "Your PHP installation appears to be missing the openssl plug-in." - . " For better security support, it is recommended that you add" - . " this. For details on how to do this, see " - . "https://vufind.org/wiki/installation " - . "and look at the PHP installation instructions for your platform."; + = 'Your PHP installation appears to be missing the openssl plug-in.' + . ' For better security support, it is recommended that you add' + . ' this. For details on how to do this, see ' + . 'https://vufind.org/wiki/installation ' + . 'and look at the PHP installation instructions for your platform.'; $this->flashMessenger()->addMessage($msg, 'error'); $problems++; } @@ -341,10 +341,10 @@ public function fixdependenciesAction() // Is the XSL library missing? if (!class_exists('XSLTProcessor')) { $msg - = "Your PHP installation appears to be missing the XSL plug-in." - . " For details on how to do this, see " - . "https://vufind.org/wiki/installation " - . "and look at the PHP installation instructions for your platform."; + = 'Your PHP installation appears to be missing the XSL plug-in.' + . ' For details on how to do this, see ' + . 'https://vufind.org/wiki/installation ' + . 'and look at the PHP installation instructions for your platform.'; $this->flashMessenger()->addMessage($msg, 'error'); $problems++; } @@ -352,10 +352,10 @@ public function fixdependenciesAction() // Is the sodium extension missing? if (!defined('SODIUM_LIBRARY_VERSION')) { $msg - = "Your PHP installation appears to be missing the sodium plug-in." - . " For details on how to do this, see " - . "https://vufind.org/wiki/installation " - . "and look at the PHP installation instructions for your platform."; + = 'Your PHP installation appears to be missing the sodium plug-in.' + . ' For details on how to do this, see ' + . 'https://vufind.org/wiki/installation ' + . 'and look at the PHP installation instructions for your platform.'; $this->flashMessenger()->addMessage($msg, 'error'); $problems++; } @@ -492,21 +492,21 @@ protected function getPreCommands($view, $escapedPass) $create = 'CREATE DATABASE ' . $view->dbname; // Special case: PostgreSQL: if ($view->driver == 'pgsql') { - $escape = "ALTER DATABASE " . $view->dbname + $escape = 'ALTER DATABASE ' . $view->dbname . " SET bytea_output='escape'"; - $cuser = "CREATE USER " . $view->dbuser + $cuser = 'CREATE USER ' . $view->dbuser . " WITH PASSWORD {$escapedPass}"; - $grant = "GRANT ALL PRIVILEGES ON DATABASE " + $grant = 'GRANT ALL PRIVILEGES ON DATABASE ' . "{$view->dbname} TO {$view->dbuser} "; return [$create, $escape, $cuser, $grant]; } // Default: MySQL: $user = "CREATE USER '{$view->dbuser}'@'{$view->vufindhost}' " . "IDENTIFIED BY {$escapedPass}"; - $grant = "GRANT SELECT,INSERT,UPDATE,DELETE ON " + $grant = 'GRANT SELECT,INSERT,UPDATE,DELETE ON ' . $view->dbname . ".* TO '{$view->dbuser}'@'{$view->vufindhost}' " - . "WITH GRANT OPTION"; + . 'WITH GRANT OPTION'; $use = "USE {$view->dbname}"; return [$create, $user, $grant, 'FLUSH PRIVILEGES', $use]; } @@ -523,9 +523,9 @@ protected function getPostCommands($view) { // Special case: PostgreSQL: if ($view->driver == 'pgsql') { - $grantTables = "GRANT ALL PRIVILEGES ON ALL TABLES IN " + $grantTables = 'GRANT ALL PRIVILEGES ON ALL TABLES IN ' . "SCHEMA public TO {$view->dbuser} "; - $grantSequences = "GRANT ALL PRIVILEGES ON ALL SEQUENCES" + $grantSequences = 'GRANT ALL PRIVILEGES ON ALL SEQUENCES' . " IN SCHEMA public TO {$view->dbuser} "; return [$grantTables, $grantSequences]; } @@ -693,7 +693,7 @@ public function fixsolrAction() $this->getRequest()->getServer()->get('HTTP_HOST'), $config->Index->url ); - $view->core = $config->Index->default_core ?? "biblio"; + $view->core = $config->Index->default_core ?? 'biblio'; $view->configFile = $configFile; return $view; } diff --git a/module/VuFind/src/VuFind/Controller/LibraryCardsController.php b/module/VuFind/src/VuFind/Controller/LibraryCardsController.php index 2aa9b92a7ab..5637fca356a 100644 --- a/module/VuFind/src/VuFind/Controller/LibraryCardsController.php +++ b/module/VuFind/src/VuFind/Controller/LibraryCardsController.php @@ -302,8 +302,8 @@ protected function processEditLibraryCard($user) && !$this->getAuthManager()->allowsUserIlsLogin() ) { throw new \Exception( - "Illegal configuration: " - . "password-based library cards and disabled user login" + 'Illegal configuration: ' + . 'password-based library cards and disabled user login' ); } $catalog = $this->getILS(); diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php index 7e7c3b2280c..7a34876c339 100644 --- a/module/VuFind/src/VuFind/Controller/MyResearchController.php +++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php @@ -1321,7 +1321,7 @@ public function storageRetrievalRequestsAction() ); if ( $cancelSRR - && $cancelSRR['function'] != "getCancelStorageRetrievalRequestLink" + && $cancelSRR['function'] != 'getCancelStorageRetrievalRequestLink' && isset($current['cancel_details']) ) { // Enable cancel form if necessary: @@ -1394,7 +1394,7 @@ public function illRequestsAction() ); if ( $cancelStatus - && $cancelStatus['function'] != "getCancelILLRequestLink" + && $cancelStatus['function'] != 'getCancelILLRequestLink' && isset($current['cancel_details']) ) { // Enable cancel form if necessary: diff --git a/module/VuFind/src/VuFind/Controller/OverdriveController.php b/module/VuFind/src/VuFind/Controller/OverdriveController.php index aef64976ce3..315141d8545 100644 --- a/module/VuFind/src/VuFind/Controller/OverdriveController.php +++ b/module/VuFind/src/VuFind/Controller/OverdriveController.php @@ -51,7 +51,7 @@ public function __construct(ServiceLocatorInterface $sm) $this->connector = $sm->get(\VuFind\DigitalContent\OverdriveConnector::class); parent::__construct($sm); - $this->debug("ODRC constructed"); + $this->debug('ODRC constructed'); } /** @@ -62,7 +62,7 @@ public function __construct(ServiceLocatorInterface $sm) */ public function mycontentAction() { - $this->debug("ODC mycontent action"); + $this->debug('ODC mycontent action'); // Force login if (!is_array($patron = $this->catalogLogin())) { return $patron; @@ -76,11 +76,11 @@ public function mycontentAction() $odAccessResult = $this->connector->getAccess(); if (!($odAccessResult->status ?? false)) { - $this->debug("result:" . print_r($odAccessResult, true)); + $this->debug('result:' . print_r($odAccessResult, true)); $this->flashMessenger()->addErrorMessage( $this->translate( $odAccessResult->code ?? 'An error has occurred', - ["%%message%%" => $odAccessResult->msg ?? ''] + ['%%message%%' => $odAccessResult->msg ?? ''] ) ); $checkoutsUnavailable = true; @@ -150,12 +150,12 @@ public function mycontentAction() */ public function getStatusAction() { - $this->debug("ODC getStatus action"); + $this->debug('ODC getStatus action'); $ids = $this->params()->fromPost( 'id', $this->params()->fromQuery('id', []) ); - $this->debug("ODRC availability for :" . print_r($ids, true)); + $this->debug('ODRC availability for :' . print_r($ids, true)); $result = $this->connector->getAvailabilityBulk($ids); $view = $this->createViewModel(compact('ids', 'result')); $view->setTemplate('RecordDriver/SolrOverdrive/status-full'); @@ -176,12 +176,12 @@ public function getStatusAction() */ public function holdAction() { - $this->debug("ODC Hold action"); + $this->debug('ODC Hold action'); if (!is_array($patron = $this->catalogLogin())) { return $patron; } - $this->debug("patron: " . print_r($patron, true)); + $this->debug('patron: ' . print_r($patron, true)); $od_id = $this->params()->fromQuery('od_id'); $rec_id = $this->params()->fromQuery('rec_id'); @@ -213,72 +213,72 @@ public function holdAction() // was loaded. $avail = $driver->getOverdriveAvailability(); if ($avail->copiesAvailable > 0) { - $action = "checkoutConfirm"; + $action = 'checkoutConfirm'; } else { - $action = "holdConfirm"; + $action = 'holdConfirm'; } } $result = null; $actionTitleCode = ''; - if ($action == "checkoutConfirm") { + if ($action == 'checkoutConfirm') { $result = $this->connector->getResultObject(); // Check to make sure they don't already have this checked out. // Shouldn't need to refresh. if ($checkout = $this->connector->getCheckout($od_id, false)) { $result->status = false; $result->data->checkout = $checkout; - $result->code = "OD_CODE_ALREADY_CHECKED_OUT"; + $result->code = 'OD_CODE_ALREADY_CHECKED_OUT'; } elseif ($hold = $this->connector->getHold($od_id, false)) { $result->status = false; $result->data->hold = $hold; - $result->code = "OD_CODE_ALREADY_ON_HOLD"; + $result->code = 'OD_CODE_ALREADY_ON_HOLD'; } else { $result->status = true; } - $actionTitleCode = "od_checkout"; - } elseif ($action == "holdConfirm") { + $actionTitleCode = 'od_checkout'; + } elseif ($action == 'holdConfirm') { $result = $this->connector->getResultObject(); // Check to make sure they don't already have this checked out. // Shouldn't need to refresh. if ($checkout = $this->connector->getCheckout($od_id, false)) { $result->status = false; $result->data->checkout = $checkout; - $result->code = "OD_CODE_ALREADY_CHECKED_OUT"; + $result->code = 'OD_CODE_ALREADY_CHECKED_OUT'; $this->debug("title already checked out: $od_id"); } elseif ($hold = $this->connector->getHold($od_id, false)) { $result->status = false; $result->data->hold = $hold; - $result->code = "OD_CODE_ALREADY_ON_HOLD"; + $result->code = 'OD_CODE_ALREADY_ON_HOLD'; $this->debug("title already on hold: $od_id"); } else { $result->status = true; } - $actionTitleCode = "od_hold"; - } elseif ($action == "cancelHoldConfirm") { - $actionTitleCode = "od_cancel_hold"; - } elseif ($action == "returnTitleConfirm") { - $actionTitleCode = "od_early_return"; - } elseif ($action == "getTitleConfirm") { + $actionTitleCode = 'od_hold'; + } elseif ($action == 'cancelHoldConfirm') { + $actionTitleCode = 'od_cancel_hold'; + } elseif ($action == 'returnTitleConfirm') { + $actionTitleCode = 'od_early_return'; + } elseif ($action == 'getTitleConfirm') { // Get only formats that are available... $formats = $driver->getAvailableDigitalFormats(); - $actionTitleCode = "od_get_title"; - } elseif ($action == "doCheckout") { - $actionTitleCode = "od_checkout"; + $actionTitleCode = 'od_get_title'; + } elseif ($action == 'doCheckout') { + $actionTitleCode = 'od_checkout'; $result = $this->connector->doOverdriveCheckout($od_id); - } elseif ($action == "placeHold") { - $actionTitleCode = "od_hold"; + } elseif ($action == 'placeHold') { + $actionTitleCode = 'od_hold'; $email = $this->params()->fromPost('email'); $result = $this->connector->placeOverDriveHold($od_id, $email); - } elseif ($action == "cancelHold") { - $actionTitleCode = "od_cancel_hold"; + } elseif ($action == 'cancelHold') { + $actionTitleCode = 'od_cancel_hold'; $result = $this->connector->cancelHold($od_id); - } elseif ($action == "returnTitle") { - $actionTitleCode = "od_early_return"; + } elseif ($action == 'returnTitle') { + $actionTitleCode = 'od_early_return'; $result = $this->connector->returnResource($od_id); - } elseif ($action == "getTitle") { - $actionTitleCode = "od_get_title"; + } elseif ($action == 'getTitle') { + $actionTitleCode = 'od_get_title'; $this->debug( - "Get Title action. Getting downloadlink using" . + 'Get Title action. Getting downloadlink using' . $this->getServerUrl('overdrive-hold') ); $result = $this->connector->getDownloadLink( diff --git a/module/VuFind/src/VuFind/Controller/Plugin/AbstractRequestBase.php b/module/VuFind/src/VuFind/Controller/Plugin/AbstractRequestBase.php index 745d4193e5b..5cae344a61c 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/AbstractRequestBase.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/AbstractRequestBase.php @@ -306,7 +306,7 @@ public function getDefaultRequiredDate( ) { // Load config: $dateArray = isset($checkHolds['defaultRequiredDate']) - ? explode(":", $checkHolds['defaultRequiredDate']) + ? explode(':', $checkHolds['defaultRequiredDate']) : [0, 1, 0]; // Process special "driver" prefix and adjust default date diff --git a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php index fdbbe9a0fd7..6b948eb26ff 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php @@ -346,10 +346,10 @@ public function fixCharsetAndCollationProblems($tables, $logsql = false) // Change column to appropriate character encoding: $sql = "ALTER TABLE `$table` MODIFY `$column` " . $details['Type'] - . " COLLATE " . $newSettings['collation'] + . ' COLLATE ' . $newSettings['collation'] . (strtoupper($details['Null']) == 'NO' ? ' NOT NULL' : '') . $currentDefault - . ";"; + . ';'; $sqlcommands .= $this->query($sql, $logsql); } // Adjust table character set and collation: @@ -824,7 +824,7 @@ protected function defaultMatches($currentDefault, $sql) } } - preg_match("/.* DEFAULT (.*)$/", $sql, $matches); + preg_match('/.* DEFAULT (.*)$/', $sql, $matches); $expectedDefault = $matches[1] ?? null; if (null !== $expectedDefault) { $expectedDefault = trim(rtrim($expectedDefault, ','), "'"); diff --git a/module/VuFind/src/VuFind/Controller/Plugin/Holds.php b/module/VuFind/src/VuFind/Controller/Plugin/Holds.php index dae8db12598..d42f50b5a8f 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/Holds.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/Holds.php @@ -66,7 +66,7 @@ public function addCancelDetails( // Generate Form Details for cancelling Holds if Cancelling Holds // is enabled if ($cancelStatus) { - if ($cancelStatus['function'] == "getCancelHoldLink") { + if ($cancelStatus['function'] == 'getCancelHoldLink') { // Build OPAC URL $ilsDetails['cancel_link'] = $catalog->getCancelHoldLink($ilsDetails, $patron); @@ -130,7 +130,7 @@ public function cancelHolds($catalog, $patron) if (!empty($details)) { // Confirm? - if ($params->fromPost('confirm') === "0") { + if ($params->fromPost('confirm') === '0') { if ($params->fromPost('cancelAll') !== null) { return $this->getController()->confirm( 'hold_cancel_all', diff --git a/module/VuFind/src/VuFind/Controller/Plugin/ILLRequests.php b/module/VuFind/src/VuFind/Controller/Plugin/ILLRequests.php index 08479a7a5f2..886e3b3bba9 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/ILLRequests.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/ILLRequests.php @@ -113,7 +113,7 @@ public function cancelILLRequests($catalog, $patron) if (!empty($details)) { // Confirm? - if ($params->fromPost('confirm') === "0") { + if ($params->fromPost('confirm') === '0') { $url = $this->getController()->url() ->fromRoute('myresearch-illrequests'); if ($params->fromPost('cancelAll') !== null) { diff --git a/module/VuFind/src/VuFind/Controller/Plugin/Permission.php b/module/VuFind/src/VuFind/Controller/Plugin/Permission.php index 0f053eb17e1..86a0f41bf31 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/Permission.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/Permission.php @@ -168,7 +168,7 @@ public function check( if ($exception instanceof \Exception) { throw $exception; } - $this->logError("Permission configuration problem."); + $this->logError('Permission configuration problem.'); throw new \Exception("$exceptionClass is not an exception!"); default: throw new ForbiddenException($exceptionDescription); diff --git a/module/VuFind/src/VuFind/Controller/Plugin/StorageRetrievalRequests.php b/module/VuFind/src/VuFind/Controller/Plugin/StorageRetrievalRequests.php index f9ea6a81f8c..38dce3a4f9d 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/StorageRetrievalRequests.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/StorageRetrievalRequests.php @@ -113,7 +113,7 @@ public function cancelStorageRetrievalRequests($catalog, $patron) if (!empty($details)) { // Confirm? - if ($params->fromPost('confirm') === "0") { + if ($params->fromPost('confirm') === '0') { $url = $this->getController()->url() ->fromRoute('myresearch-storageretrievalrequests'); if ($params->fromPost('cancelAll') !== null) { diff --git a/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php b/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php index 1e38fa7a730..08d10df4082 100644 --- a/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php +++ b/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php @@ -94,7 +94,7 @@ public function storageRetrievalRequestAction() // Send various values to the view so we can build the form: $pickup = $catalog->getPickUpLocations($patron, $gatheredDetails); $extraFields = isset($checkRequests['extraFields']) - ? explode(":", $checkRequests['extraFields']) : []; + ? explode(':', $checkRequests['extraFields']) : []; // Check that there are pick up locations to choose from if the field is // required: @@ -158,7 +158,7 @@ public function storageRetrievalRequestAction() ->getDefaultRequiredDate($checkRequests); $defaultRequiredDate = $this->serviceLocator->get(\VuFind\Date\Converter::class) - ->convertToDisplayDate("U", $defaultRequiredDate); + ->convertToDisplayDate('U', $defaultRequiredDate); try { $defaultPickup = $catalog->getDefaultPickUpLocation($patron, $gatheredDetails); diff --git a/module/VuFind/src/VuFind/Controller/UpgradeController.php b/module/VuFind/src/VuFind/Controller/UpgradeController.php index 80fd1ee5928..d2fe92cd9f4 100644 --- a/module/VuFind/src/VuFind/Controller/UpgradeController.php +++ b/module/VuFind/src/VuFind/Controller/UpgradeController.php @@ -379,7 +379,7 @@ protected function upgradeMySQL($adapter) } $this->dbUpgrade()->setAdapter($this->getRootDbAdapter()); $this->session->warnings->append( - "Removed deprecated column(s) from table(s): " + 'Removed deprecated column(s) from table(s): ' . implode(', ', array_keys($deprecatedColumns)) ); } @@ -403,7 +403,7 @@ protected function upgradeMySQL($adapter) } $this->dbUpgrade()->setAdapter($this->getRootDbAdapter()); $this->session->warnings->append( - "Created missing table(s): " . implode(', ', $missingTables) + 'Created missing table(s): ' . implode(', ', $missingTables) ); } $sql .= $this->dbUpgrade() @@ -421,7 +421,7 @@ protected function upgradeMySQL($adapter) } $this->dbUpgrade()->setAdapter($this->getRootDbAdapter()); $this->session->warnings->append( - "Added column(s) to table(s): " + 'Added column(s) to table(s): ' . implode(', ', array_keys($missingCols)) ); } @@ -440,7 +440,7 @@ protected function upgradeMySQL($adapter) } $this->dbUpgrade()->setAdapter($this->getRootDbAdapter()); $this->session->warnings->append( - "Modified column(s) in table(s): " + 'Modified column(s) in table(s): ' . implode(', ', array_keys($modifiedCols)) ); } @@ -458,7 +458,7 @@ protected function upgradeMySQL($adapter) } $this->dbUpgrade()->setAdapter($this->getRootDbAdapter()); $this->session->warnings->append( - "Added constraint(s) to table(s): " + 'Added constraint(s) to table(s): ' . implode(', ', array_keys($missingConstraints)) ); } @@ -477,7 +477,7 @@ protected function upgradeMySQL($adapter) } $this->dbUpgrade()->setAdapter($this->getRootDbAdapter()); $this->session->warnings->append( - "Modified constraint(s) in table(s): " + 'Modified constraint(s) in table(s): ' . implode(', ', array_keys($modifiedConstraints)) ); } @@ -495,7 +495,7 @@ protected function upgradeMySQL($adapter) } $this->dbUpgrade()->setAdapter($this->getRootDbAdapter()); $this->session->warnings->append( - "Modified key(s) in table(s): " + 'Modified key(s) in table(s): ' . implode(', ', array_keys($modifiedKeys)) ); } @@ -512,7 +512,7 @@ protected function upgradeMySQL($adapter) } $this->dbUpgrade()->setAdapter($this->getRootDbAdapter()); $this->session->warnings->append( - "Modified character set(s)/collation(s) in table(s): " + 'Modified character set(s)/collation(s) in table(s): ' . implode(', ', array_keys($colProblems)) ); } @@ -664,7 +664,7 @@ public function getdbcredentialsAction() $factory = $this->serviceLocator ->get(AdapterFactory::class); $db = $factory->getAdapter($dbrootuser, $pass); - $db->query("SELECT * FROM user;"); + $db->query('SELECT * FROM user;'); $this->session->dbRootUser = $dbrootuser; $this->session->dbRootPass = $pass; return $this->forwardTo('Upgrade', 'FixDatabase'); @@ -782,7 +782,7 @@ public function fixmetadataAction() $problem->assignMetadata($driver, $converter)->save(); } catch (RecordMissingException $e) { $this->session->warnings->append( - "Unable to load metadata for record " + 'Unable to load metadata for record ' . "{$problem->source}:{$problem->record_id}" ); } diff --git a/module/VuFind/src/VuFind/Cover/Layer/GridBackground.php b/module/VuFind/src/VuFind/Cover/Layer/GridBackground.php index 5ec42b6e548..8c8c1755a93 100644 --- a/module/VuFind/src/VuFind/Cover/Layer/GridBackground.php +++ b/module/VuFind/src/VuFind/Cover/Layer/GridBackground.php @@ -120,7 +120,7 @@ protected function renderGrid($im, $pattern, $color, $settings) $u = $k % 2 ? $boxWidth : -$boxWidth; $v = $k / 2 < 1 ? $boxHeight : -$boxHeight; for ($i = 0; $i < 16; $i++) { - if ($bc[$i] == "1") { + if ($bc[$i] == '1') { imagefilledrectangle( $im, $x, diff --git a/module/VuFind/src/VuFind/Cover/Loader.php b/module/VuFind/src/VuFind/Cover/Loader.php index cc42de8205c..a7a983823eb 100644 --- a/module/VuFind/src/VuFind/Cover/Loader.php +++ b/module/VuFind/src/VuFind/Cover/Loader.php @@ -672,7 +672,7 @@ protected function processImageURLForSource($url, $allowCache, $source) protected function processImageURL($url, $cache = true) { // Check to see if url is a file path - if (substr($url, 0, 7) == "file://") { + if (substr($url, 0, 7) == 'file://') { $imagePath = substr($url, 7); // Display the image: @@ -700,7 +700,7 @@ protected function processImageURL($url, $cache = true) // Write image data to disk: if (!@file_put_contents($tempFile, $image)) { - throw new \Exception("Unable to write to image directory."); + throw new \Exception('Unable to write to image directory.'); } // Move temporary file to final location: diff --git a/module/VuFind/src/VuFind/Db/Row/Resource.php b/module/VuFind/src/VuFind/Db/Row/Resource.php index 72c264db015..c8976e718bf 100644 --- a/module/VuFind/src/VuFind/Db/Row/Resource.php +++ b/module/VuFind/src/VuFind/Db/Row/Resource.php @@ -223,7 +223,7 @@ public function assignMetadata($driver, \VuFind\Date\Converter $converter) $driver->tryMethod('getSortTitle'), 0, 255, - "UTF-8" + 'UTF-8' ); if (empty($this->title)) { $this->title = $driver->getBreadcrumb(); @@ -234,7 +234,7 @@ public function assignMetadata($driver, \VuFind\Date\Converter $converter) $driver->tryMethod('getPrimaryAuthor'), 0, 255, - "UTF-8" + 'UTF-8' ); if (!empty($author)) { $this->author = $author; diff --git a/module/VuFind/src/VuFind/Db/Table/Gateway.php b/module/VuFind/src/VuFind/Db/Table/Gateway.php index 3759dfa30d6..17d65a9c7c1 100644 --- a/module/VuFind/src/VuFind/Db/Table/Gateway.php +++ b/module/VuFind/src/VuFind/Db/Table/Gateway.php @@ -91,7 +91,7 @@ public function __construct( public function initializeFeatures($cfg) { // Special case for PostgreSQL sequences: - if ($this->adapter->getDriver()->getDatabasePlatformName() == "Postgresql") { + if ($this->adapter->getDriver()->getDatabasePlatformName() == 'Postgresql') { $maps = $cfg['vufind']['pgsql_seq_mapping'] ?? null; if (isset($maps[$this->table])) { if (!is_object($this->featureSet)) { @@ -120,7 +120,7 @@ public function createRow() // from a sequence: if ( $this->adapter - && $this->adapter->getDriver()->getDatabasePlatformName() == "Postgresql" + && $this->adapter->getDriver()->getDatabasePlatformName() == 'Postgresql' && $obj instanceof \VuFind\Db\Row\RowGateway ) { // Do we have a sequence feature? diff --git a/module/VuFind/src/VuFind/Db/Table/GatewayFactory.php b/module/VuFind/src/VuFind/Db/Table/GatewayFactory.php index f14a9952023..05414ff9338 100644 --- a/module/VuFind/src/VuFind/Db/Table/GatewayFactory.php +++ b/module/VuFind/src/VuFind/Db/Table/GatewayFactory.php @@ -57,7 +57,7 @@ protected function getRowPrototype(ContainerInterface $container, $requestedName { $rowManager = $container->get(\VuFind\Db\Row\PluginManager::class); // Map Table class to matching Row class. - $name = str_replace("\\Table\\", "\\Row\\", $requestedName); + $name = str_replace('\\Table\\', '\\Row\\', $requestedName); return $rowManager->has($name) ? $rowManager->get($name) : null; } diff --git a/module/VuFind/src/VuFind/Db/Table/ResourceTags.php b/module/VuFind/src/VuFind/Db/Table/ResourceTags.php index ef22befae82..d8de7e700ba 100644 --- a/module/VuFind/src/VuFind/Db/Table/ResourceTags.php +++ b/module/VuFind/src/VuFind/Db/Table/ResourceTags.php @@ -515,7 +515,7 @@ public function getUniqueResources( $select->join( ['r' => 'resource'], 'resource_tags.resource_id = r.id', - ["title" => "title"] + ['title' => 'title'] ); if (null !== $userId) { $select->where->equalTo('resource_tags.user_id', $userId); @@ -640,7 +640,7 @@ public function getUniqueUsers($userId = null, $resourceId = null, $tagId = null $select->join( ['u' => 'user'], 'resource_tags.user_id = u.id', - ["username" => "username"] + ['username' => 'username'] ); if (null !== $userId) { $select->where->equalTo('resource_tags.user_id', $userId); @@ -700,7 +700,7 @@ public function getResourceTags( ) { $order = (null !== $order) ? [$order] - : ["username", "tag", "title"]; + : ['username', 'tag', 'title']; $sql = $this->getSql(); $select = $sql->select(); @@ -715,12 +715,12 @@ public function getResourceTags( $select->join( ['u' => 'user'], 'resource_tags.user_id = u.id', - ["username" => "username"] + ['username' => 'username'] ); $select->join( ['r' => 'resource'], 'resource_tags.resource_id = r.id', - ["title" => "title"] + ['title' => 'title'] ); if (null !== $userId) { $select->where->equalTo('resource_tags.user_id', $userId); diff --git a/module/VuFind/src/VuFind/Db/Table/Search.php b/module/VuFind/src/VuFind/Db/Table/Search.php index 117de9d3074..001c05ddce7 100644 --- a/module/VuFind/src/VuFind/Db/Table/Search.php +++ b/module/VuFind/src/VuFind/Db/Table/Search.php @@ -83,7 +83,7 @@ public function initializeFeatures($cfg) { // Special case for PostgreSQL inserts -- we need to provide an extra // clue so that the database knows how to write bytea data correctly: - if ($this->adapter->getDriver()->getDatabasePlatformName() == "Postgresql") { + if ($this->adapter->getDriver()->getDatabasePlatformName() == 'Postgresql') { if (!is_object($this->featureSet)) { $this->featureSet = new Feature\FeatureSet(); } diff --git a/module/VuFind/src/VuFind/Db/Table/Tags.php b/module/VuFind/src/VuFind/Db/Table/Tags.php index 980e264ff84..0520c17e3e9 100644 --- a/module/VuFind/src/VuFind/Db/Table/Tags.php +++ b/module/VuFind/src/VuFind/Db/Table/Tags.php @@ -256,7 +256,7 @@ function ($select) use ( ? 'tag' : new Expression('lower(tag)'), 'cnt' => new Expression( 'COUNT(DISTINCT(?))', - ["rt.user_id"], + ['rt.user_id'], [Expression::TYPE_IDENTIFIER] ), ] diff --git a/module/VuFind/src/VuFind/DigitalContent/OverdriveConnector.php b/module/VuFind/src/VuFind/DigitalContent/OverdriveConnector.php index e2b0c93f209..d8ab286cacd 100644 --- a/module/VuFind/src/VuFind/DigitalContent/OverdriveConnector.php +++ b/module/VuFind/src/VuFind/DigitalContent/OverdriveConnector.php @@ -145,7 +145,7 @@ public function __construct( protected function getSessionContainer() { if (null === $this->sessionContainer || !$this->sessionContainer) { - error_log("NO SESSION CONTAINER"); + error_log('NO SESSION CONTAINER'); } return $this->sessionContainer; } @@ -182,15 +182,15 @@ public function getUser() public function getAccess($refresh = false) { if (!$user = $this->getUser()) { - return $this->getResultObject(false, "User not logged in."); + return $this->getResultObject(false, 'User not logged in.'); } $odAccess = $this->getSessionContainer()->odAccess; if ($refresh || empty($odAccess)) { if ( $this->connectToPatronAPI( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], true ) ) { @@ -199,7 +199,7 @@ public function getAccess($refresh = false) } else { $result = $this->getResultObject(); // There is some problem with the account - $result->code = "od_account_problem"; + $result->code = 'od_account_problem'; $conf = $this->getConfig(); if ($conf->noAccessString) { @@ -210,7 +210,7 @@ public function getAccess($refresh = false) ) ) { // This user should not have access to OD - $result->code = "od_account_noaccess"; + $result->code = 'od_account_noaccess'; } } // odAccessMessage is set in the session by the API call above @@ -241,7 +241,7 @@ public function getAvailability($overDriveId) { $result = $this->getResultObject(); if (!$overDriveId) { - $this->logWarning("no overdrive content ID was passed in."); + $this->logWarning('no overdrive content ID was passed in.'); return $result; } @@ -260,7 +260,7 @@ public function getAvailability($overDriveId) $availabilityUrl .= "$overDriveId/availability"; $res = $this->callUrl($availabilityUrl); - if ($res->errorCode == "NotFound") { + if ($res->errorCode == 'NotFound') { if ($conf->consortiumSupport && !$this->getUser()) { // Consortium support is turned on but user is not logged in; // if the title is not found it probably means that it's only @@ -298,7 +298,7 @@ public function getAvailabilityBulk($overDriveIds = []) $result = $this->getResultObject(); $loginRequired = false; if (count($overDriveIds) < 1) { - $this->logWarning("no overdrive content ID was passed in."); + $this->logWarning('no overdrive content ID was passed in.'); return false; } @@ -315,15 +315,15 @@ public function getAvailabilityBulk($overDriveIds = []) } } $baseUrl = $conf->discURL; - $availabilityPath = "/v2/collections/"; + $availabilityPath = '/v2/collections/'; $availabilityPath .= "$collectionToken/availability?products="; $availabilityUrl = $baseUrl . $availabilityPath . - implode(",", $overDriveIds); + implode(',', $overDriveIds); $res = $this->callUrl($availabilityUrl); if (!$res) { $result->code = 'od_code_connection_failed'; } else { - if ($res->errorCode == "NotFound" || $res->totalItems == 0) { + if ($res->errorCode == 'NotFound' || $res->totalItems == 0) { if ($loginRequired) { // Consortium support is turned on but user is not logged in. // If the title is not found it could mean that it's only @@ -332,12 +332,12 @@ public function getAvailabilityBulk($overDriveIds = []) $result->code = 'od_code_login_for_avail'; } else { $result->status = false; - $this->logWarning("resources not found"); + $this->logWarning('resources not found'); } } else { $result->status = true; foreach ($res->availability as $item) { - $this->debug("item:" . print_r($item, true)); + $this->debug('item:' . print_r($item, true)); $result->data[strtolower($item->reserveId)] = $item; } // Now look for items not returned @@ -374,7 +374,7 @@ public function getAvailabilityBulk($overDriveIds = []) */ public function getCollectionToken() { - $collectionToken = $this->getCachedData("collectionToken"); + $collectionToken = $this->getCachedData('collectionToken'); $userCollectionToken = $this->getSessionContainer( )->userCollectionToken; $this->debug("collectionToken from cache: $collectionToken"); @@ -382,12 +382,12 @@ public function getCollectionToken() $conf = $this->getConfig(); if ($conf->consortiumSupport && $user = $this->getUser()) { if (empty($userCollectionToken)) { - $this->debug("getting new user collectionToken"); + $this->debug('getting new user collectionToken'); $baseUrl = $conf->circURL; $patronURL = "$baseUrl/v1/patrons/me"; $res = $this->callPatronUrl( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], $patronURL ); if ($res) { @@ -401,14 +401,14 @@ public function getCollectionToken() return $userCollectionToken; } if (empty($collectionToken)) { - $this->debug("getting new collectionToken"); + $this->debug('getting new collectionToken'); $baseUrl = $conf->discURL; $libraryID = $conf->libraryID; $libraryURL = "$baseUrl/v1/libraries/$libraryID"; $res = $this->callUrl($libraryURL); if ($res) { $collectionToken = $res->collectionToken; - $this->putCachedData("collectionToken", $collectionToken); + $this->putCachedData('collectionToken', $collectionToken); } else { return false; } @@ -428,9 +428,9 @@ public function doOverdriveCheckout($overDriveId) { $result = $this->getResultObject(); - $this->debug("doOverdriveCheckout: overdriveID: " . $overDriveId); + $this->debug('doOverdriveCheckout: overdriveID: ' . $overDriveId); if (!$user = $this->getUser()) { - $this->error("user is not logged in", false, true); + $this->error('user is not logged in', false, true); return $result; } if ($config = $this->getConfig()) { @@ -440,16 +440,16 @@ public function doOverdriveCheckout($overDriveId) ]; $response = $this->callPatronUrl( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], $url, $params, - "POST" + 'POST' ); if (!empty($response)) { if (isset($response->reserveId)) { - $expires = ""; + $expires = ''; if ($dt = new \DateTime($response->expires)) { $expires = $dt->format( (string)$config->displayDateFormat @@ -480,10 +480,10 @@ public function doOverdriveCheckout($overDriveId) */ public function placeOverDriveHold($overDriveId, $email) { - $this->debug("placeOverdriveHold"); + $this->debug('placeOverdriveHold'); $holdResult = $this->getResultObject(); if (!$user = $this->getUser()) { - $this->error("user is not logged in", false, true); + $this->error('user is not logged in', false, true); return $holdResult; } @@ -499,11 +499,11 @@ public function placeOverDriveHold($overDriveId, $email) ]; $response = $this->callPatronUrl( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], $url, $params, - "POST" + 'POST' ); if (!empty($response)) { @@ -532,19 +532,19 @@ public function placeOverDriveHold($overDriveId, $email) public function cancelHold($overDriveId) { $holdResult = $this->getResultObject(); - $this->debug("OverdriveConnector: cancelHold"); + $this->debug('OverdriveConnector: cancelHold'); if (!$user = $this->getUser()) { - $this->error("user is not logged in", false, true); + $this->error('user is not logged in', false, true); return $holdResult; } if ($config = $this->getConfig()) { $url = $config->circURL . "/v1/patrons/me/holds/$overDriveId"; $response = $this->callPatronUrl( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], $url, null, - "DELETE" + 'DELETE' ); // Because this is a DELETE Call, we are just looking for a boolean @@ -569,17 +569,17 @@ public function returnResource($resourceID) { $result = $this->getResultObject(); if (!$user = $this->getUser()) { - $this->error("user is not logged in", false, true); + $this->error('user is not logged in', false, true); return $result; } if ($config = $this->getConfig()) { $url = $config->circURL . "/v1/patrons/me/checkouts/$resourceID"; $response = $this->callPatronUrl( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], $url, null, - "DELETE" + 'DELETE' ); // Because this is a DELETE Call, we are just looking for a boolean @@ -608,7 +608,7 @@ public function getDownloadLink($overDriveId, $format, $errorURL) $result = $this->getResultObject(); $downloadLink = false; if (!$user = $this->getUser()) { - $this->error("user is not logged in", false, true); + $this->error('user is not logged in', false, true); return $result; } $checkout = $this->getCheckout($overDriveId, false); @@ -617,7 +617,7 @@ public function getDownloadLink($overDriveId, $format, $errorURL) // or it is locked in and they are requesting the format that // is already locked in. if ($template = $this->getLinkTemplate($checkout, $format)) { - $this->debug("template: " . print_r($template, true)); + $this->debug('template: ' . print_r($template, true)); $downloadLink = $template->downloadLinkV2->href; $this->debug("found the link: $downloadLink"); } elseif (!$checkout->isFormatLockedIn) { @@ -637,24 +637,24 @@ public function getDownloadLink($overDriveId, $format, $errorURL) // for this format; means that they are requesting the wrong // format for the locked-in resource. $result->msg - = "The title appears to be already locked in for a different format"; + = 'The title appears to be already locked in for a different format'; $result->status = false; - $this->debug("locked in for another format."); + $this->debug('locked in for another format.'); return $result; } if ($downloadLink) { - $this->debug("dll true"); - $url = str_replace("{errorurl}", $errorURL, $downloadLink); - $url = str_replace("{errorpageurl}", $errorURL, $url); - $url = str_replace("{successurl}", $errorURL, $url); + $this->debug('dll true'); + $url = str_replace('{errorurl}', $errorURL, $downloadLink); + $url = str_replace('{errorpageurl}', $errorURL, $url); + $url = str_replace('{successurl}', $errorURL, $url); $this->debug("getting download link using: $url"); $response = $this->callPatronUrl( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], $url, null, - "GET" + 'GET' ); if (!empty($response)) { @@ -663,16 +663,16 @@ public function getDownloadLink($overDriveId, $format, $errorURL) $result->data->downloadLink = $response->links->contentlink->href; } else { - $this->debug("problem getting link:" . $response->message); + $this->debug('problem getting link:' . $response->message); $result->msg - = "Could not get download link for resourceID " + = 'Could not get download link for resourceID ' . "[$overDriveId]: " . $response->message; } } else { $result->code = 'od_code_connection_failed'; } } else { - $this->debug("dll false"); + $this->debug('dll false'); } return $result; } @@ -709,16 +709,16 @@ public function lockinResource($overDriveId, $format) $result = $this->getResultObject(); if (!$user = $this->getUser()) { - $this->error("user is not logged in", false, true); + $this->error('user is not logged in', false, true); return $result; } // Shouldn't need to refresh. This should be in the cache if it exists $checkout = $this->getCheckout($overDriveId, false); if (!$checkout) { $result->msg - = "Could not find a checkout for this resource ID for - this user."; - $this->debug("title not checked out."); + = 'Could not find a checkout for this resource ID for + this user.'; + $this->debug('title not checked out.'); return $result; } // Double-check this format is an option. @@ -732,7 +732,7 @@ public function lockinResource($overDriveId, $format) $result->msg = "Could not lock in Overdrive resourceID [$overDriveId]:" . " This format ($format) doesn't appear to be available " . - "for this resource."; + 'for this resource.'; return $result; } else { $params = [ @@ -744,18 +744,18 @@ public function lockinResource($overDriveId, $format) $url = $config->circURL . "/v1/patrons/me/checkouts/$overDriveId/formats"; $response = $this->callPatronUrl( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], $url, $params, - "POST" + 'POST' ); if (!empty($response)) { if (isset($response->linkTemplates)) { $result->status = true; $result->data->linkTemplates = $response->linkTemplates; - $this->debug("title locked in:"); + $this->debug('title locked in:'); } else { $result->msg = "Could not lock in Overdrive resourceID [$overDriveId]: " @@ -780,8 +780,8 @@ public function getConfig() $conf = new \stdClass(); if (!$this->recordConfig) { $this->error( - "Could not locate the Overdrive Record Driver " - . "configuration." + 'Could not locate the Overdrive Record Driver ' + . 'configuration.' ); return false; } @@ -830,16 +830,16 @@ public function getConfig() public function getFormatNames() { return [ - 'ebook-kindle' => "od_ebook-kindle", - 'ebook-overdrive' => "od_ebook-overdrive", - 'ebook-epub-adobe' => "od_ebook-epub-adobe", - 'ebook-epub-open' => "od_ebook-epub-open", - 'ebook-pdf-adobe' => "od_ebook-pdf-adobe", - 'ebook-pdf-open' => "od_ebook-pdf-open", - 'ebook-mediado' => "od_ebook-mediado", - 'audiobook-overdrive' => "od_audiobook-overdrive", - 'audiobook-mp3' => "od_audiobook-mp3", - 'video-streaming' => "od_video-streaming", + 'ebook-kindle' => 'od_ebook-kindle', + 'ebook-overdrive' => 'od_ebook-overdrive', + 'ebook-epub-adobe' => 'od_ebook-epub-adobe', + 'ebook-epub-open' => 'od_ebook-epub-open', + 'ebook-pdf-adobe' => 'od_ebook-pdf-adobe', + 'ebook-pdf-open' => 'od_ebook-pdf-open', + 'ebook-mediado' => 'od_ebook-mediado', + 'audiobook-overdrive' => 'od_audiobook-overdrive', + 'audiobook-mp3' => 'od_audiobook-mp3', + 'video-streaming' => 'od_video-streaming', ]; } @@ -856,15 +856,15 @@ public function getMetadata($overDriveIds = []) { $metadata = []; if (!$overDriveIds || count($overDriveIds) < 1) { - $this->logWarning("no overdrive content IDs were passed in."); + $this->logWarning('no overdrive content IDs were passed in.'); return []; } if ($conf = $this->getConfig()) { $productsKey = $this->getCollectionToken(); $baseUrl = $conf->discURL; $metadataUrl = "$baseUrl/v1/collections/$productsKey/"; - $metadataUrl .= "bulkmetadata?reserveIds=" . implode( - ",", + $metadataUrl .= 'bulkmetadata?reserveIds=' . implode( + ',', $overDriveIds ); $res = $this->callUrl($metadataUrl); @@ -891,7 +891,7 @@ public function getMetadata($overDriveIds = []) */ public function getCheckout($overDriveId, $refresh = true) { - $this->debug("get Overdrive checkout"); + $this->debug('get Overdrive checkout'); $result = $this->getCheckouts($refresh); if ($result->status) { $checkouts = $result->data; @@ -925,13 +925,13 @@ public function getCheckout($overDriveId, $refresh = true) */ public function getHold($overDriveId, $refresh = true) { - $this->debug("get Overdrive hold"); + $this->debug('get Overdrive hold'); $result = $this->getHolds($refresh); if ($result->status) { $holds = $result->data; foreach ($holds as $hold) { if (strtolower($hold->reserveId) == strtolower($overDriveId)) { - $this->debug("hold found"); + $this->debug('hold found'); return $hold; } } @@ -951,11 +951,11 @@ public function getHold($overDriveId, $refresh = true) public function getCheckouts($refresh = true) { // The checkouts are cached in the session, but we can force a refresh - $this->debug("get Overdrive Checkouts"); + $this->debug('get Overdrive Checkouts'); $result = $this->getResultObject(); if (!$user = $this->getUser()) { - $this->error("user is not logged in"); + $this->error('user is not logged in'); return $result; } @@ -965,8 +965,8 @@ public function getCheckouts($refresh = true) $url = $config->circURL . '/v1/patrons/me/checkouts'; $response = $this->callPatronUrl( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], $url, false ); @@ -992,7 +992,7 @@ public function getCheckouts($refresh = true) } } } else { - $this->debug("found Overdrive Checkouts in session"); + $this->debug('found Overdrive Checkouts in session'); $result->status = true; $result->msg = []; $result->data = $this->getSessionContainer()->checkouts; @@ -1010,10 +1010,10 @@ public function getCheckouts($refresh = true) */ public function getHolds($refresh = true) { - $this->debug("get Overdrive Holds"); + $this->debug('get Overdrive Holds'); $result = $this->getResultObject(); if (!$user = $this->getUser()) { - $this->error("user is not logged in"); + $this->error('user is not logged in'); return $result; } @@ -1023,8 +1023,8 @@ public function getHolds($refresh = true) $url = $config->circURL . '/v1/patrons/me/holds'; $response = $this->callPatronUrl( - $user["cat_username"], - $user["cat_password"], + $user['cat_username'], + $user['cat_password'], $url ); @@ -1061,7 +1061,7 @@ public function getHolds($refresh = true) } } } else { - $this->debug("found Overdrive Holds in cache"); + $this->debug('found Overdrive Holds in cache'); $result->status = true; $result->message = []; $result->data = $this->getSessionContainer()->holds; @@ -1086,7 +1086,7 @@ protected function callUrl( $url, $headers = null, $checkToken = true, - $requestType = "GET" + $requestType = 'GET' ) { $this->debug("chktoken: $checkToken"); if (!$checkToken || $this->connectToAPI()) { @@ -1096,7 +1096,7 @@ protected function callUrl( $client = $this->getHttpClient($url); } catch (Exception $e) { $this->error( - "error while setting up the client: " . $e->getMessage() + 'error while setting up the client: ' . $e->getMessage() ); return false; } @@ -1109,7 +1109,7 @@ protected function callUrl( $headers[] = "Authorization: {$tokenData->token_type} " . $tokenData->access_token; } - $headers[] = "User-Agent: VuFind"; + $headers[] = 'User-Agent: VuFind'; } $client->setHeaders($headers); $client->setMethod($requestType); @@ -1119,7 +1119,7 @@ protected function callUrl( $response = $client->send(); } catch (Exception $ex) { $this->error( - "Exception during request: " . + 'Exception during request: ' . $ex->getMessage() ); return false; @@ -1127,33 +1127,33 @@ protected function callUrl( if ($response->isServerError()) { $this->error( - "Overdrive HTTP Error: " . + 'Overdrive HTTP Error: ' . $response->getStatusCode() ); - $this->debug("Request: " . $client->getRequest()); - $this->debug("Response: " . $client->getResponse()); + $this->debug('Request: ' . $client->getRequest()); + $this->debug('Response: ' . $client->getResponse()); return false; } $body = $response->getBody(); $returnVal = json_decode($body); $this->debug( - "Return from OD API Call: " . print_r($returnVal, true) + 'Return from OD API Call: ' . print_r($returnVal, true) ); if ($returnVal != null) { if (isset($returnVal->errorCode)) { // In some cases, this should be returned perhaps... - $this->error("Overdrive Error: " . $returnVal->errorCode); + $this->error('Overdrive Error: ' . $returnVal->errorCode); return $returnVal; } else { return $returnVal; } } else { $this->error( - "Overdrive Error: Nothing returned from API call." + 'Overdrive Error: Nothing returned from API call.' ); $this->debug( - "Body return from OD API Call: " . print_r($body, true) + 'Body return from OD API Call: ' . print_r($body, true) ); } } @@ -1170,17 +1170,17 @@ protected function callUrl( */ protected function connectToAPI($forceNewConnection = false) { - $this->debug("connecting to API"); + $this->debug('connecting to API'); $conf = $this->getConfig(); $tokenData = $this->getSessionContainer()->tokenData; - $this->debug("API Token from session: " . print_r($tokenData, true)); + $this->debug('API Token from session: ' . print_r($tokenData, true)); if ( $forceNewConnection || $tokenData == null || !isset($tokenData->access_token) || time() >= $tokenData->expirationTime ) { $authHeader = base64_encode( - $conf->clientKey . ":" . $conf->clientSecret + $conf->clientKey . ':' . $conf->clientSecret ); $headers = [ 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8', @@ -1191,28 +1191,28 @@ protected function connectToAPI($forceNewConnection = false) $client = $this->getHttpClient(); } catch (Exception $e) { $this->error( - "error while setting up the client: " . $e->getMessage() + 'error while setting up the client: ' . $e->getMessage() ); return false; } $client->setHeaders($headers); - $client->setMethod("POST"); - $client->setRawBody("grant_type=client_credentials"); + $client->setMethod('POST'); + $client->setRawBody('grant_type=client_credentials'); $response = $client->setUri($conf->tokenURL)->send(); if ($response->isServerError()) { $this->error( - "Overdrive HTTP Error: " . + 'Overdrive HTTP Error: ' . $response->getStatusCode() ); - $this->debug("Request: " . $client->getRequest()); + $this->debug('Request: ' . $client->getRequest()); return false; } $body = $response->getBody(); $tokenData = json_decode($body); $this->debug( - "TokenData returned from OD API Call: " . print_r( + 'TokenData returned from OD API Call: ' . print_r( $tokenData, true ) @@ -1220,7 +1220,7 @@ protected function connectToAPI($forceNewConnection = false) if ($tokenData != null) { if (isset($tokenData->errorCode)) { // In some cases, this should be returned perhaps... - $this->error("Overdrive Error: " . $tokenData->errorCode); + $this->error('Overdrive Error: ' . $tokenData->errorCode); return false; } else { $tokenData->expirationTime = time() @@ -1230,10 +1230,10 @@ protected function connectToAPI($forceNewConnection = false) } } else { $this->error( - "Overdrive Error: Nothing returned from API call." + 'Overdrive Error: Nothing returned from API call.' ); $this->debug( - "Body return from OD API Call: " . print_r($body, true) + 'Body return from OD API Call: ' . print_r($body, true) ); } } @@ -1261,7 +1261,7 @@ protected function callPatronUrl( $patronPin, $url, $params = null, - $requestType = "GET" + $requestType = 'GET' ) { $this->debug("calling patronURL: $url"); if ($this->connectToPatronAPI($patronBarcode, $patronPin, false)) { @@ -1270,14 +1270,14 @@ protected function callPatronUrl( ' ' . $patronTokenData->access_token; $headers = [ "Authorization: $authorizationData", - "User-Agent: VuFind", - "Content-Type: application/json", + 'User-Agent: VuFind', + 'Content-Type: application/json', ]; try { $client = $this->getHttpClient(); } catch (Exception $e) { $this->error( - "error while setting up the client: " . $e->getMessage() + 'error while setting up the client: ' . $e->getMessage() ); return false; } @@ -1296,13 +1296,13 @@ protected function callPatronUrl( $client->setRawBody($postData); $this->debug("patronURL data sent: $postData"); } - $this->debug("patronURL method: " . $client->getMethod()); - $this->debug("client: " . $client->getRequest()); + $this->debug('patronURL method: ' . $client->getMethod()); + $this->debug('client: ' . $client->getRequest()); try { $response = $client->send(); } catch (Exception $ex) { $this->error( - "Exception during request: " . + 'Exception during request: ' . $ex->getMessage() ); return false; @@ -1311,13 +1311,13 @@ protected function callPatronUrl( // if all goes well for DELETE, the code will be 204 // and response is empty. - if ($requestType == "DELETE") { + if ($requestType == 'DELETE') { if ($response->getStatusCode() == 204) { - $this->debug("DELETE Patron call appears to have worked."); + $this->debug('DELETE Patron call appears to have worked.'); return true; } else { $this->error( - "DELETE Patron call failed. HTTP return code: " . + 'DELETE Patron call failed. HTTP return code: ' . $response->getStatusCode() ); return false; @@ -1325,7 +1325,7 @@ protected function callPatronUrl( } $returnVal = json_decode($body); - $this->debug("response from call: " . print_r($returnVal, true)); + $this->debug('response from call: ' . print_r($returnVal, true)); if ($returnVal != null) { if ( @@ -1335,17 +1335,17 @@ protected function callPatronUrl( return $returnVal; } else { $this->debug( - "Overdrive API problem: " . $returnVal->message + 'Overdrive API problem: ' . $returnVal->message ); } } else { $this->error( - "Overdrive Error: Nothing returned from API call." + 'Overdrive Error: Nothing returned from API call.' ); return false; } } else { - $this->error("Overdrive Error: Not connected to the Patron API."); + $this->error('Overdrive Error: Not connected to the Patron API.'); } return false; } @@ -1373,31 +1373,31 @@ protected function connectToPatronAPI( || ($patronTokenData->expirationTime && time() >= $patronTokenData->expirationTime) ) { - $this->debug("connecting to patron API for new token."); + $this->debug('connecting to patron API for new token.'); $url = $config->patronTokenURL; $websiteId = $config->websiteID; $ilsname = $config->ILSname; $authHeader = base64_encode( - $config->clientKey . ":" . $config->clientSecret + $config->clientKey . ':' . $config->clientSecret ); $headers = [ - "Content-Type: application/x-www-form-urlencoded;charset=UTF-8", + 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8', "Authorization: Basic $authHeader", - "User-Agent: VuFind", + 'User-Agent: VuFind', ]; try { $client = $this->getHttpClient($url); } catch (Exception $e) { $this->error( - "error while setting up the client: " . $e->getMessage() + 'error while setting up the client: ' . $e->getMessage() ); return false; } $client->setHeaders($headers); - $client->setMethod("POST"); + $client->setMethod('POST'); if ($patronPin == null) { $postFields = "grant_type=password&username={$patronBarcode}"; - $postFields .= "&password=ignore&password_required=false"; + $postFields .= '&password=ignore&password_required=false'; $postFields .= "&scope=websiteId:{$websiteId}%20"; $postFields .= "authorizationname:{$ilsname}"; } else { @@ -1416,7 +1416,7 @@ protected function connectToPatronAPI( + $patronTokenData->expires_in; } else { $this->debug( - "problem with OD patron API token Call: " . + 'problem with OD patron API token Call: ' . print_r( $patronTokenData, true @@ -1564,7 +1564,7 @@ protected function removeCachedData($key) * * @return object */ - public function getResultObject($status = false, $msg = "", $code = "") + public function getResultObject($status = false, $msg = '', $code = '') { return (object)[ 'status' => $status, diff --git a/module/VuFind/src/VuFind/DigitalContent/OverdriveConnectorFactory.php b/module/VuFind/src/VuFind/DigitalContent/OverdriveConnectorFactory.php index 849abf9c180..d63b7f7cd29 100644 --- a/module/VuFind/src/VuFind/DigitalContent/OverdriveConnectorFactory.php +++ b/module/VuFind/src/VuFind/DigitalContent/OverdriveConnectorFactory.php @@ -102,7 +102,7 @@ public function __invoke( $connector->setCacheStorage( $container->get(\VuFind\Cache\Manager::class)->getCache( 'object', - "Overdrive" + 'Overdrive' ) ); diff --git a/module/VuFind/src/VuFind/DoiLinker/Demo.php b/module/VuFind/src/VuFind/DoiLinker/Demo.php index 383b71b062c..b62a070a034 100644 --- a/module/VuFind/src/VuFind/DoiLinker/Demo.php +++ b/module/VuFind/src/VuFind/DoiLinker/Demo.php @@ -64,9 +64,9 @@ public function getLinks(array $doiArray) foreach ($doiArray as $doi) { $icon = $this->icons[rand(0, count($this->icons) - 1)]; $response[$doi][] = [ - 'link' => "https://vufind.org", + 'link' => 'https://vufind.org', 'label' => "Demonstrating DOI link for $doi with icon " - . ($icon ?? "[null]"), + . ($icon ?? '[null]'), 'localIcon' => $icon, ]; } diff --git a/module/VuFind/src/VuFind/DoiLinker/Unpaywall.php b/module/VuFind/src/VuFind/DoiLinker/Unpaywall.php index f3ff794c45a..95b98d07731 100644 --- a/module/VuFind/src/VuFind/DoiLinker/Unpaywall.php +++ b/module/VuFind/src/VuFind/DoiLinker/Unpaywall.php @@ -74,11 +74,11 @@ public function __construct($config) { if (!isset($config->unpaywall_email)) { throw new \Exception( - "Missing configuration for Unpaywall DOI linker: unpaywall_email" + 'Missing configuration for Unpaywall DOI linker: unpaywall_email' ); } $this->email = $config->unpaywall_email; - $this->apiUrl = $config->unpaywall_api_url ?? "https://api.unpaywall.org/v2"; + $this->apiUrl = $config->unpaywall_api_url ?? 'https://api.unpaywall.org/v2'; } /** @@ -125,7 +125,7 @@ public function getLinks(array $doiArray) */ protected function callApi($doi) { - $url = $this->apiUrl . "/" . urlencode($doi) . "?" + $url = $this->apiUrl . '/' . urlencode($doi) . '?' . http_build_query(['email' => $this->email]); $client = $this->httpService->createClient($url); $response = $client->send(); diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Xml.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Xml.php index f306adf0122..f5625b46fc1 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Xml.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Xml.php @@ -63,7 +63,7 @@ public function getData() */ protected function formatNode($record, $parentID = null) { - $isCollection = $this->isCollection($record) ? "true" : "false"; + $isCollection = $this->isCollection($record) ? 'true' : 'false'; return '' . '' diff --git a/module/VuFind/src/VuFind/I18n/Translator/Loader/ExtendedIniReader.php b/module/VuFind/src/VuFind/I18n/Translator/Loader/ExtendedIniReader.php index aa579adace0..1e8d96c2b8d 100644 --- a/module/VuFind/src/VuFind/I18n/Translator/Loader/ExtendedIniReader.php +++ b/module/VuFind/src/VuFind/I18n/Translator/Loader/ExtendedIniReader.php @@ -63,7 +63,7 @@ public function getTextDomain($input, $convertBlanks = true) // Split the string on the equals sign, keeping a max of two chunks: $parts = explode('=', $current, 2); $key = trim($parts[0]); - if ($key != "" && substr($key, 0, 1) != ';') { + if ($key != '' && substr($key, 0, 1) != ';') { // Trim outermost double quotes off the value if present: if (isset($parts[1])) { $value = preg_replace( diff --git a/module/VuFind/src/VuFind/ILS/Connection.php b/module/VuFind/src/VuFind/ILS/Connection.php index 397e3beac47..b88eb593741 100644 --- a/module/VuFind/src/VuFind/ILS/Connection.php +++ b/module/VuFind/src/VuFind/ILS/Connection.php @@ -337,7 +337,7 @@ public function checkFunction($function, $params = null) ) ? $this->getDriver()->getConfig($function, $params) : false; // See if we have a corresponding check method to analyze the response: - $checkMethod = "checkMethod" . $function; + $checkMethod = 'checkMethod' . $function; if (!method_exists($this, $checkMethod)) { return false; } @@ -374,12 +374,12 @@ protected function checkMethodHolds($functionConfig, $params) // the full parameter expected by placeHold() but should contain the // necessary details for determining eligibility. if ( - $this->getHoldsMode() != "none" + $this->getHoldsMode() != 'none' && $this->checkCapability('placeHold', [$params ?: []]) && isset($functionConfig['HMACKeys']) ) { - $response = ['function' => "placeHold"]; - $response['HMACKeys'] = explode(":", $functionConfig['HMACKeys']); + $response = ['function' => 'placeHold']; + $response['HMACKeys'] = explode(':', $functionConfig['HMACKeys']); if (isset($functionConfig['defaultRequiredDate'])) { $response['defaultRequiredDate'] = $functionConfig['defaultRequiredDate']; @@ -405,7 +405,7 @@ protected function checkMethodHolds($functionConfig, $params) } else { $id = $params['id'] ?? null; if ($this->checkCapability('getHoldLink', [$id, []])) { - $response = ['function' => "getHoldLink"]; + $response = ['function' => 'getHoldLink']; } } return $response; @@ -438,13 +438,13 @@ protected function checkMethodcancelHolds($functionConfig, $params) && $this->config->cancel_holds_enabled == true && $this->checkCapability('cancelHolds', [$params ?: []]) ) { - $response = ['function' => "cancelHolds"]; + $response = ['function' => 'cancelHolds']; } elseif ( isset($this->config->cancel_holds_enabled) && $this->config->cancel_holds_enabled == true && $this->checkCapability('getCancelHoldLink', [$params ?: []]) ) { - $response = ['function' => "getCancelHoldLink"]; + $response = ['function' => 'getCancelHoldLink']; } return $response; } @@ -475,13 +475,13 @@ protected function checkMethodRenewals($functionConfig, $params) && $this->config->renewals_enabled == true && $this->checkCapability('renewMyItems', [$params ?: []]) ) { - $response = ['function' => "renewMyItems"]; + $response = ['function' => 'renewMyItems']; } elseif ( isset($this->config->renewals_enabled) && $this->config->renewals_enabled == true && $this->checkCapability('renewMyItemsLink', [$params ?: []]) ) { - $response = ['function' => "renewMyItemsLink"]; + $response = ['function' => 'renewMyItemsLink']; } return $response; } diff --git a/module/VuFind/src/VuFind/ILS/Driver/AbstractAPI.php b/module/VuFind/src/VuFind/ILS/Driver/AbstractAPI.php index 43ccd60a6f9..26abd2c7922 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/AbstractAPI.php +++ b/module/VuFind/src/VuFind/ILS/Driver/AbstractAPI.php @@ -127,8 +127,8 @@ protected function failureCodeIsAllowed(int $code, $allowedFailureCodes): bool * @throws ILSException */ public function makeRequest( - $method = "GET", - $path = "/", + $method = 'GET', + $path = '/', $params = [], $headers = [], $allowedFailureCodes = [] @@ -161,8 +161,8 @@ public function makeRequest( try { $response = $client->send(); } catch (\Exception $e) { - $this->logError("Unexpected " . $e::class . ": " . (string)$e); - throw new ILSException("Error during send operation."); + $this->logError('Unexpected ' . $e::class . ': ' . (string)$e); + throw new ILSException('Error during send operation.'); } $code = $response->getStatusCode(); if ( @@ -173,7 +173,7 @@ public function makeRequest( "Unexpected error response; code: $code, body: " . $response->getBody() ); - throw new ILSException("Unexpected error code."); + throw new ILSException('Unexpected error code.'); } if ($jsonLog = ($this->config['API']['json_log_file'] ?? false)) { if (APPLICATION_ENV !== 'development') { diff --git a/module/VuFind/src/VuFind/ILS/Driver/Aleph.php b/module/VuFind/src/VuFind/ILS/Driver/Aleph.php index fc076b4bab0..6d1d18bb3a7 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Aleph.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Aleph.php @@ -226,8 +226,8 @@ class Aleph extends AbstractBase implements * * @var string */ - protected $queuePositionRegex = "/Waiting in position " - . "(?[0-9]+) in queue;/"; + protected $queuePositionRegex = '/Waiting in position ' + . '(?[0-9]+) in queue;/'; /** * Constructor @@ -439,10 +439,10 @@ protected function doRestDLFRequest( $url = $this->appendQueryString($url, $params); $result = $this->doHTTPRequest($url, $method, $body); $replyCode = (string)$result->{'reply-code'}; - if ($replyCode != "0000") { + if ($replyCode != '0000') { $replyText = (string)$result->{'reply-text'}; $this->logError( - "DLF request failed", + 'DLF request failed', [ 'url' => $url, 'reply-code' => $replyCode, 'reply-message' => $replyText, @@ -465,11 +465,11 @@ protected function doRestDLFRequest( */ protected function appendQueryString($url, $params) { - $sep = (!str_contains($url, "?")) ? '?' : '&'; + $sep = (!str_contains($url, '?')) ? '?' : '&'; if ($params != null) { foreach ($params as $key => $value) { - $url .= $sep . $key . "=" . urlencode($value); - $sep = "&"; + $url .= $sep . $key . '=' . urlencode($value); + $sep = '&'; } } return $url; @@ -543,7 +543,7 @@ protected function parseId($id) } else { throw new \Exception( "Invalid record identifier '$id' " - . "without library base" + . 'without library base' ); } return $result; @@ -599,21 +599,21 @@ public function getStatus($id) */ public function getStatusesX($bib, $ids) { - $doc_nums = ""; - $sep = ""; + $doc_nums = ''; + $sep = ''; foreach ($ids as $id) { $doc_nums .= $sep . $id; - $sep = ","; + $sep = ','; } $xml = $this->doXRequest( - "publish_avail", + 'publish_avail', ['library' => $bib, 'doc_num' => $doc_nums], false ); $holding = []; foreach ($xml->xpath('/publish-avail/OAI-PMH') as $rec) { - $identifier = $rec->xpath(".//identifier/text()"); - $id = ((count($this->bib) > 1) ? $bib . "-" : "") + $identifier = $rec->xpath('.//identifier/text()'); + $id = ((count($this->bib) > 1) ? $bib . '-' : '') . substr($identifier[0], strrpos($identifier[0], ':') + 1); $temp = []; foreach ($rec->xpath(".//datafield[@tag='AVA']") as $datafield) { @@ -762,11 +762,11 @@ public function getHolding($id, array $patron = null, array $options = []) } $matches = []; $dueDateWithStatusRegEx - = "/([0-9]*\\/[a-zA-Z0-9]*\\/[0-9]*);([a-zA-Z ]*)/"; - $dueDateRegEx = "/([0-9]*\\/[a-zA-Z0-9]*\\/[0-9]*)/"; + = '/([0-9]*\\/[a-zA-Z0-9]*\\/[0-9]*);([a-zA-Z ]*)/'; + $dueDateRegEx = '/([0-9]*\\/[a-zA-Z0-9]*\\/[0-9]*)/'; if (preg_match($dueDateWithStatusRegEx, $status, $matches)) { $duedate = $this->parseDate($matches[1]); - $requested = (trim($matches[2]) == "Requested"); + $requested = (trim($matches[2]) == 'Requested'); } elseif (preg_match($dueDateRegEx, $status, $matches)) { $duedate = $this->parseDate($matches[1]); } else { @@ -871,7 +871,7 @@ public function getMyTransactions($user, $params = [], $history = false) $z13 = $item->z13; $z30 = $item->z30; $group = $item->xpath('@href'); - $group = substr(strrchr($group[0], "/"), 1); + $group = substr(strrchr($group[0], '/'), 1); $renew = $item->xpath('@renew'); $location = (string)$z36->{$prefix . 'pickup_location'}; @@ -899,7 +899,7 @@ public function getMyTransactions($user, $params = [], $history = false) 'reqnum' => $reqnum, 'barcode' => $barcode, 'duedate' => $this->parseDate($due), - 'renewable' => $renew[0] == "Y", + 'renewable' => $renew[0] == 'Y', ]; if ($history) { $issued = (string)$z36->{$prefix . 'loan-date'}; @@ -999,7 +999,7 @@ public function getMyHolds($user) $delete = $item->xpath('@delete'); $href = $item->xpath('@href'); $item_id = substr($href[0], strrpos($href[0], '/') + 1); - $type = "hold"; + $type = 'hold'; $location = (string)$z37->{'z37-pickup-location'}; $reqnum = (string)$z37->{'z37-doc-number'} . (string)$z37->{'z37-item-sequence'} @@ -1012,18 +1012,18 @@ public function getMyHolds($user) $isbn = (string)$z13->{'z13-isbn-issn'}; $barcode = (string)$z30->{'z30-barcode'}; // remove superfluous spaces in status - $status = preg_replace("/\s[\s]+/", " ", $item->status); + $status = preg_replace("/\s[\s]+/", ' ', $item->status); $position = null; // Extract position in the hold queue from item status if (preg_match($this->queuePositionRegex, $status, $matches)) { $position = $matches['position']; } - if ($holddate == "00000000") { + if ($holddate == '00000000') { $holddate = null; } else { $holddate = $this->parseDate($holddate); } - $delete = ($delete[0] == "Y"); + $delete = ($delete[0] == 'Y'); // Secondary, Aleph-specific identifier that may be useful for // local customizations $adm_id = (string)$z30->{'z30-doc-number'}; @@ -1094,7 +1094,7 @@ public function cancelHolds($details) 'holds', $id, ], null, - "DELETE" + 'DELETE' ); $count++; $items[$id] = ['success' => true, 'status' => 'cancel_hold_ok']; @@ -1126,7 +1126,7 @@ public function getMyFines($user) $xml = $this->doRestDLFRequest( ['patron', $user['id'], 'circulationActions', 'cash'], - ["view" => "full"] + ['view' => 'full'] ); foreach ($xml->xpath('//cash') as $item) { @@ -1144,21 +1144,21 @@ public function getMyFines($user) $cachetype = strtolower((string)($item->attributes()->type ?? '')); $mult = $cachetype == 'debit' ? -100 : 100; $amount - = (float)(preg_replace("/[\(\)]/", "", (string)$z31->{'z31-sum'})) + = (float)(preg_replace("/[\(\)]/", '', (string)$z31->{'z31-sum'})) * $mult; $cashref = (string)$z31->{'z31-sequence'}; $finesList["$cashref"] = [ - "title" => $title, - "barcode" => $barcode, - "amount" => $amount, - "transactiondate" => $transactiondate, - "transactiontype" => $transactiontype, - "checkout" => $this->parseDate($checkout), - "balance" => $amount, - "id" => $id, - "printLink" => "test", - "fine" => $description, + 'title' => $title, + 'barcode' => $barcode, + 'amount' => $amount, + 'transactiondate' => $transactiondate, + 'transactiontype' => $transactiontype, + 'checkout' => $this->parseDate($checkout), + 'balance' => $amount, + 'id' => $id, + 'printLink' => 'test', + 'fine' => $description, ]; } ksort($finesList); @@ -1200,7 +1200,7 @@ public function getMyProfileX($user) $user['college'] = $this->useradm; } $xml = $this->doXRequest( - "bor-info", + 'bor-info', [ 'loans' => 'N', 'cash' => 'N', 'hold' => 'N', 'library' => $user['college'], 'bor_id' => $user['id'], @@ -1218,14 +1218,14 @@ public function getMyProfileX($user) $credit_sum = (string)$xml->z305->{'z305-sum'}; $credit_sign = (string)$xml->z305->{'z305-credit-debit'}; $name = (string)$xml->z303->{'z303-name'}; - if (strstr($name, ",")) { - [$lastname, $firstname] = explode(",", $name); + if (strstr($name, ',')) { + [$lastname, $firstname] = explode(',', $name); } else { $lastname = $name; - $firstname = ""; + $firstname = ''; } if ($credit_sign == null) { - $credit_sign = "C"; + $credit_sign = 'C'; } $recordList = compact('firstname', 'lastname'); if (isset($user['email'])) { @@ -1269,18 +1269,18 @@ public function getMyProfileDLF($user) } } $fullName = $profile['fullname']; - if (!str_contains($fullName, ",")) { + if (!str_contains($fullName, ',')) { $profile['lastname'] = $fullName; - $profile['firstname'] = ""; + $profile['firstname'] = ''; } else { [$profile['lastname'], $profile['firstname']] - = explode(",", $fullName); + = explode(',', $fullName); } $xml = $this->doRestDLFRequest( ['patron', $user['id'], 'patronStatus', 'registration'] ); - $status = $xml->xpath("//institution/z305-bor-status"); - $expiry = $xml->xpath("//institution/z305-expiry-date"); + $status = $xml->xpath('//institution/z305-bor-status'); + $expiry = $xml->xpath('//institution/z305-expiry-date'); $profile['expiration_date'] = $this->parseDate($expiry[0]); $profile['group'] = $status[0]; return $profile; @@ -1301,7 +1301,7 @@ public function getMyProfileDLF($user) public function patronLogin($user, $password) { if ($password == null) { - $temp = ["id" => $user]; + $temp = ['id' => $user]; $temp['college'] = $this->useradm; return $this->getMyProfile($temp); } @@ -1322,11 +1322,11 @@ public function patronLogin($user, $password) } $patron = []; $name = $xml->z303->{'z303-name'}; - if (strstr($name, ",")) { - [$lastName, $firstName] = explode(",", $name); + if (strstr($name, ',')) { + [$lastName, $firstName] = explode(',', $name); } else { $lastName = $name; - $firstName = ""; + $firstName = ''; } $email_addr = $xml->z304->{'z304-email-address'}; $id = $xml->z303->{'z303-id'}; @@ -1385,7 +1385,7 @@ public function getHoldingInfoForItem($patronId, $id, $group) } $date = $xml->xpath('//last-interest-date/text()'); $date = $date[0]; - $date = "" . substr($date, 6, 2) . "." . substr($date, 4, 2) . "." + $date = '' . substr($date, 6, 2) . '.' . substr($date, 4, 2) . '.' . substr($date, 0, 4); return [ 'pickup-locations' => $locations, 'last-interest-date' => $date, @@ -1485,7 +1485,7 @@ public function placeHold($details) 'hold', ], null, - "PUT", + 'PUT', $body ); } catch (Aleph\RestfulException $exception) { @@ -1516,23 +1516,23 @@ public function barcodeToID($bar) foreach ($this->bib as $base) { try { $xml = $this->doXRequest( - "find", - ["base" => $base, "request" => "BAR=$bar"], + 'find', + ['base' => $base, 'request' => "BAR=$bar"], false ); - $docs = (int)$xml->{"no_records"}; + $docs = (int)$xml->{'no_records'}; if ($docs == 1) { - $set = (string)$xml->{"set_number"}; + $set = (string)$xml->{'set_number'}; $result = $this->doXRequest( - "present", - ["set_number" => $set, "set_entry" => "1"], + 'present', + ['set_number' => $set, 'set_entry' => '1'], false ); $id = $result->xpath('//doc_number/text()'); if (count($this->bib) == 1) { return $id[0]; } else { - return $base . "-" . $id[0]; + return $base . '-' . $id[0]; } } } catch (\Exception $ex) { @@ -1550,9 +1550,9 @@ public function barcodeToID($bar) */ public function parseDate($date) { - if ($date == null || $date == "") { - return ""; - } elseif (preg_match("/^[0-9]{8}$/", $date) === 1) { // 20120725 + if ($date == null || $date == '') { + return ''; + } elseif (preg_match('/^[0-9]{8}$/', $date) === 1) { // 20120725 return $this->dateConverter->convertToDisplayDate('Ynd', $date); } elseif (preg_match("/^[0-9]+\/[A-Za-z]{3}\/[0-9]{4}$/", $date) === 1) { // 13/jan/2012 @@ -1599,7 +1599,7 @@ public function supportsMethod($method, $params) */ public function getConfig($func, $params = []) { - if ($func == "Holds") { + if ($func == 'Holds') { $holdsConfig = $this->config['Holds'] ?? []; $defaults = [ 'HMACKeys' => 'id:item_id', @@ -1649,16 +1649,16 @@ public function getPickUpLocations($patron, $holdInfo = null) ); foreach ($details['pickup-locations'] as $key => $value) { $pickupLocations[] = [ - "locationID" => $key, - "locationDisplay" => $value, + 'locationID' => $key, + 'locationDisplay' => $value, ]; } } else { $default = $this->getDefaultPickUpLocation($patron); if (!empty($default)) { $pickupLocations[] = [ - "locationID" => $default, - "locationDisplay" => $default, + 'locationID' => $default, + 'locationDisplay' => $default, ]; } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/Aleph/Translator.php b/module/VuFind/src/VuFind/ILS/Driver/Aleph/Translator.php index 351b6e30819..d4595deb233 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Aleph/Translator.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Aleph/Translator.php @@ -78,15 +78,15 @@ public function __construct($configArray) $this->charset = $configArray['util']['charset']; $this->table15 = $this->parsetable( $configArray['util']['tab15'], - get_class($this) . "::tab15Callback" + get_class($this) . '::tab15Callback' ); $this->table40 = $this->parsetable( $configArray['util']['tab40'], - get_class($this) . "::tab40Callback" + get_class($this) . '::tab40Callback' ); $this->table_sub_library = $this->parsetable( $configArray['util']['tab_sub_library'], - get_class($this) . "::tabSubLibraryCallback" + get_class($this) . '::tabSubLibraryCallback' ); } @@ -101,19 +101,19 @@ public function __construct($configArray) public function parsetable($file, $callback) { $result = []; - $file_handle = fopen($file, "r, ccs=UTF-8"); - $rgxp = ""; + $file_handle = fopen($file, 'r, ccs=UTF-8'); + $rgxp = ''; while (!feof($file_handle)) { $line = fgets($file_handle); $line = rtrim($line); - if (preg_match("/!!/", $line)) { + if (preg_match('/!!/', $line)) { $line = rtrim($line); $rgxp = static::regexp($line); } - if (preg_match("/!.*/", $line) || $rgxp == "" || $line == "") { + if (preg_match('/!.*/', $line) || $rgxp == '' || $line == '') { } else { $line = str_pad($line, 80); - $matches = ""; + $matches = ''; if (preg_match($rgxp, $line, $matches)) { call_user_func_array( $callback, @@ -136,10 +136,10 @@ public function parsetable($file, $callback) */ public function tab40Translate($collection, $sublib) { - $findme = $collection . "|" . $sublib; + $findme = $collection . '|' . $sublib; $desc = $this->table40[$findme]; if ($desc == null) { - $findme = $collection . "|"; + $findme = $collection . '|'; $desc = $this->table40[$findme]; } return $desc; @@ -170,15 +170,15 @@ public function tab15Translate($slc, $isc, $ipsc) { $tab15 = $this->tabSubLibraryTranslate($slc); if ($tab15 == null) { - echo "tab15 is null!
"; + echo 'tab15 is null!
'; } - $findme = $tab15["tab15"] . "|" . $isc . "|" . $ipsc; + $findme = $tab15['tab15'] . '|' . $isc . '|' . $ipsc; $result = $this->table15[$findme] ?? null; if ($result == null) { - $findme = $tab15["tab15"] . "||" . $ipsc; + $findme = $tab15['tab15'] . '||' . $ipsc; $result = $this->table15[$findme]; } - $result["sub_lib_desc"] = $tab15["desc"]; + $result['sub_lib_desc'] = $tab15['desc']; return $result; } @@ -195,18 +195,18 @@ public static function tab15Callback($matches, &$tab15, $charset) { $lib = $matches[1]; $no1 = $matches[2]; - if ($no1 == "##") { - $no1 = ""; + if ($no1 == '##') { + $no1 = ''; } $no2 = $matches[3]; - if ($no2 == "##") { - $no2 = ""; + if ($no2 == '##') { + $no2 = ''; } $desc = iconv($charset, 'UTF-8', $matches[5]); - $key = trim($lib) . "|" . trim($no1) . "|" . trim($no2); + $key = trim($lib) . '|' . trim($no1) . '|' . trim($no2); $tab15[trim($key)] = [ - "desc" => trim($desc), "loan" => $matches[6], "request" => $matches[8], - "opac" => $matches[10], + 'desc' => trim($desc), 'loan' => $matches[6], 'request' => $matches[8], + 'opac' => $matches[10], ]; } @@ -223,10 +223,10 @@ public static function tab40Callback($matches, &$tab40, $charset) { $code = trim($matches[1]); $sub = trim($matches[2]); - $sub = trim(preg_replace("/#/", "", $sub)); + $sub = trim(preg_replace('/#/', '', $sub)); $desc = trim(iconv($charset, 'UTF-8', $matches[4])); - $key = $code . "|" . $sub; - $tab40[trim($key)] = [ "desc" => $desc ]; + $key = $code . '|' . $sub; + $tab40[trim($key)] = [ 'desc' => $desc ]; } /** @@ -246,7 +246,7 @@ public static function tabSubLibraryCallback( $sublib = trim($matches[1]); $desc = trim(iconv($charset, 'UTF-8', $matches[5])); $tab = trim($matches[6]); - $tab_sub_library[$sublib] = [ "desc" => $desc, "tab15" => $tab ]; + $tab_sub_library[$sublib] = [ 'desc' => $desc, 'tab15' => $tab ]; } /** @@ -258,10 +258,10 @@ public static function tabSubLibraryCallback( */ public static function regexp($string) { - $string = preg_replace("/\\-/", ")\\s(", $string); - $string = preg_replace("/!/", ".", $string); - $string = preg_replace("/[<>]/", "", $string); - $string = "/(" . $string . ")/"; + $string = preg_replace('/\\-/', ')\\s(', $string); + $string = preg_replace('/!/', '.', $string); + $string = preg_replace('/[<>]/', '', $string); + $string = '/(' . $string . ')/'; return $string; } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/Alma.php b/module/VuFind/src/VuFind/ILS/Driver/Alma.php index cd8c2934ee4..50302f20241 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Alma.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Alma.php @@ -915,12 +915,12 @@ public function getMyFines($patron) $created = (string)$fee->creation_time; $checkout = (string)$fee->status_time; $fineList[] = [ - "title" => (string)($fee->title ?? ''), - "amount" => round(floatval($fee->original_amount) * 100), - "balance" => round(floatval($fee->balance) * 100), - "createdate" => $this->parseDate($created, true), - "checkout" => $this->parseDate($checkout, true), - "fine" => $this->getTranslatableString($fee->type), + 'title' => (string)($fee->title ?? ''), + 'amount' => round(floatval($fee->original_amount) * 100), + 'balance' => round(floatval($fee->balance) * 100), + 'createdate' => $this->parseDate($created, true), + 'checkout' => $this->parseDate($checkout, true), + 'fine' => $this->getTranslatableString($fee->type), ]; } return $fineList; @@ -1681,14 +1681,14 @@ public function parseDate($date, $withTime = false) $date = substr($date, 0, -1); } - $compactDate = "/^[0-9]{8}$/"; // e. g. 20120725 + $compactDate = '/^[0-9]{8}$/'; // e. g. 20120725 $euroName = "/^[0-9]+\/[A-Za-z]{3}\/[0-9]{4}$/"; // e. g. 13/jan/2012 $euro = "/^[0-9]+\/[0-9]+\/[0-9]{4}$/"; // e. g. 13/7/2012 $euroPad = "/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{2,4}$/"; // e. g. 13/07/2012 - $datestamp = "/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/"; // e. g. 2012-07-13 - $timestamp = "/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$/"; + $datestamp = '/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/'; // e. g. 2012-07-13 + $timestamp = '/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$/'; $timestampMs - = "/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z$/"; + = '/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z$/'; // e. g. 2017-07-09T18:00:00 if ($date == null || $date == '') { diff --git a/module/VuFind/src/VuFind/ILS/Driver/Amicus.php b/module/VuFind/src/VuFind/ILS/Driver/Amicus.php index fa0c8e3a4fc..dc019627701 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Amicus.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Amicus.php @@ -118,7 +118,7 @@ protected function pickStatus($statusArray) // driver. if ($this->statusRankings == false) { // Execute SQL - $sql = "SELECT * FROM T_HLDG_STUS_TYP"; + $sql = 'SELECT * FROM T_HLDG_STUS_TYP'; try { $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute(); @@ -189,8 +189,8 @@ protected function determineAvailability($statusArray) */ protected function sacaStatus($copyId) { - $circulacion = "SELECT COUNT(*) AS PRESTADO " . - "FROM CIRT_ITM " . + $circulacion = 'SELECT COUNT(*) AS PRESTADO ' . + 'FROM CIRT_ITM ' . "WHERE CPY_ID_NBR = '$copyId'"; //$holds = "SELECT COUNT(*) AS PRESTADO FROM CIRTN_HLD " . @@ -208,9 +208,9 @@ protected function sacaStatus($copyId) while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { $prestados = $row['PRESTADO']; if ($row['PRESTADO'] == 0) { - $prestados = "Disponible"; + $prestados = 'Disponible'; } else { - $prestados = "No disponible"; + $prestados = 'No disponible'; } } return $prestados; @@ -228,8 +228,8 @@ protected function sacaStatus($copyId) protected function sacaFecha($copyId) { $circulacion = "SELECT to_char(CIRT_ITM_DUE_DTE,'dd-mm-yyyy') AS FECHADEV, " - . "ROUND(CIRT_ITM_DUE_DTE - SYSDATE) AS DIFERENCIA " - . "FROM CIRT_ITM " + . 'ROUND(CIRT_ITM_DUE_DTE - SYSDATE) AS DIFERENCIA ' + . 'FROM CIRT_ITM ' . "WHERE CPY_ID_NBR = '$copyId'"; $fecha = 0; $diferencia = 0; @@ -260,8 +260,8 @@ protected function sacaFecha($copyId) */ protected function sacaReservas($holdingId) { - $reservas = "SELECT COUNT(*) as reservados " . - "FROM CIRTN_HLD " . + $reservas = 'SELECT COUNT(*) as reservados ' . + 'FROM CIRTN_HLD ' . "WHERE CPY_ID_NBR = '$holdingId'"; $reservados = 0; @@ -296,17 +296,17 @@ public function getStatus($id) // items and holdings records. The second (a rare case) obtains // information from the holdings record when no items are available. - $items = "select BIB_ITM_NBR, ILL_CDE as ON_RESERVE, " . - "T_LCTN_NME_BUO.TBL_LNG_ENG_TXT " . - "as LOCATION, SHLF_LIST_SRT_FORM as CALLNUMBER, CPY_ID_NBR as " . - "CPY_ID_NBR " . - "from CPY_ID, SHLF_LIST, T_LCTN_NME_BUO " . - "where CPY_ID.SHLF_LIST_KEY_NBR = SHLF_LIST.SHLF_LIST_KEY_NBR " . - "and CPY_ID.LCTN_NME_CDE = T_LCTN_NME_BUO.TBL_VLU_CDE " . + $items = 'select BIB_ITM_NBR, ILL_CDE as ON_RESERVE, ' . + 'T_LCTN_NME_BUO.TBL_LNG_ENG_TXT ' . + 'as LOCATION, SHLF_LIST_SRT_FORM as CALLNUMBER, CPY_ID_NBR as ' . + 'CPY_ID_NBR ' . + 'from CPY_ID, SHLF_LIST, T_LCTN_NME_BUO ' . + 'where CPY_ID.SHLF_LIST_KEY_NBR = SHLF_LIST.SHLF_LIST_KEY_NBR ' . + 'and CPY_ID.LCTN_NME_CDE = T_LCTN_NME_BUO.TBL_VLU_CDE ' . "and CPY_ID.BIB_ITM_NBR = '$id'"; - $multipleLoc = "SELECT COUNT(DISTINCT(SHLF_LIST_KEY_NBR)) AS multiple " . - "FROM CPY_ID " . + $multipleLoc = 'SELECT COUNT(DISTINCT(SHLF_LIST_KEY_NBR)) AS multiple ' . + 'FROM CPY_ID ' . "WHERE CPY_ID.BIB_ITM_NBR = '$id'"; try { @@ -344,9 +344,9 @@ public function getStatus($id) $reservados = $this->sacaReservas($row['CPY_ID_NBR']); if (!isset($data[$row['BIB_ITM_NBR']])) { if ($multiple != 1) { - $multiple = $this->translate("Multiple Locations"); - $textoLoc = $this->translate("Multiple"); - $textoSign = $this->translate("Multiple Locations"); + $multiple = $this->translate('Multiple Locations'); + $textoLoc = $this->translate('Multiple'); + $textoSign = $this->translate('Multiple Locations'); $data[$row['BIB_ITM_NBR']] = [ 'id' => $id, 'status' => $prestados, @@ -358,10 +358,10 @@ public function getStatus($id) } else { $multiple = $row['LOCATION']; if ($multiple == 'Deposito2') { - $multiple = "Depósito2"; + $multiple = 'Depósito2'; } if ($multiple == 'Deposito') { - $multiple = "Depósito"; + $multiple = 'Depósito'; } $data[$row['BIB_ITM_NBR']] = [ 'id' => $id, @@ -386,9 +386,9 @@ public function getStatus($id) 'id' => $id, 'status' => $prestados, 'status_array' => [$prestados], - 'location' => $this->translate("No copies"), + 'location' => $this->translate('No copies'), 'reserve' => $reservados, - 'callnumber' => $this->translate("No copies"), + 'callnumber' => $this->translate('No copies'), ]; break; } @@ -456,15 +456,15 @@ public function getHolding($id, array $patron = null, array $options = []) { include_once 'File/MARC.php'; - $items = "select CPY_ID.BRCDE_NBR, CPY_ID.BIB_ITM_NBR, " . - "T_LCTN_NME_BUO.TBL_LNG_ENG_TXT " . - "as LOCATION, SHLF_LIST_SRT_FORM as CALLNUMBER, CPY_ID.CPY_ID_NBR as " . - "CPY_ID_NBR " . - "from CPY_ID, SHLF_LIST, T_LCTN_NME_BUO " . - "where CPY_ID.SHLF_LIST_KEY_NBR = SHLF_LIST.SHLF_LIST_KEY_NBR " . - "AND CPY_ID.LCTN_NME_CDE = T_LCTN_NME_BUO.TBL_VLU_CDE " . + $items = 'select CPY_ID.BRCDE_NBR, CPY_ID.BIB_ITM_NBR, ' . + 'T_LCTN_NME_BUO.TBL_LNG_ENG_TXT ' . + 'as LOCATION, SHLF_LIST_SRT_FORM as CALLNUMBER, CPY_ID.CPY_ID_NBR as ' . + 'CPY_ID_NBR ' . + 'from CPY_ID, SHLF_LIST, T_LCTN_NME_BUO ' . + 'where CPY_ID.SHLF_LIST_KEY_NBR = SHLF_LIST.SHLF_LIST_KEY_NBR ' . + 'AND CPY_ID.LCTN_NME_CDE = T_LCTN_NME_BUO.TBL_VLU_CDE ' . "and CPY_ID.BIB_ITM_NBR = '$id' " . - "order by SHLF_LIST_SRT_FORM ASC, CPY_ID.CPY_ID_NBR ASC"; + 'order by SHLF_LIST_SRT_FORM ASC, CPY_ID.CPY_ID_NBR ASC'; $possibleQueries = [$items]; @@ -485,10 +485,10 @@ public function getHolding($id, array $patron = null, array $options = []) // Determine Location $loc = $row['LOCATION']; if ($loc == 'Deposito2') { - $loc = "Depósito2"; + $loc = 'Depósito2'; } if ($loc == 'Deposito') { - $loc = "Depósito"; + $loc = 'Depósito'; } $status = $this->sacaStatus($row['CPY_ID_NBR']); @@ -533,10 +533,10 @@ public function getHolding($id, array $patron = null, array $options = []) public function getPurchaseHistory($id) { $sql = "select REPLACE(REPLACE(CPY_STMT_TXT,'a',''),'Fondos: ','') as " . - "ENUMCHRON " . - "from CPY_ID " . + 'ENUMCHRON ' . + 'from CPY_ID ' . "WHERE CPY_ID.BIB_ITM_NBR = '$id' " . - "order by CPY_ID.SHLF_LIST_KEY_NBR ASC, CPY_ID.CPY_ID_NBR ASC"; + 'order by CPY_ID.SHLF_LIST_KEY_NBR ASC, CPY_ID.CPY_ID_NBR ASC'; $data = []; try { $sqlStmt = $this->db->prepare($sql); @@ -564,8 +564,8 @@ public function getPurchaseHistory($id) */ public function patronLogin($barcode, $lname) { - $sql = "SELECT LOGIN , PASSWORD AS FIRST_NAME " . - "FROM LV_USER " . + $sql = 'SELECT LOGIN , PASSWORD AS FIRST_NAME ' . + 'FROM LV_USER ' . "WHERE PASSWORD = '$lname' AND LOGIN = '$barcode'"; try { @@ -610,9 +610,9 @@ public function getMyTransactions($patron) $transList = []; $sql = "SELECT TO_CHAR(CIRT_ITM.CIRT_ITM_DUE_DTE,'DD/MM/YYYY') " . - "AS DUEDATE, CIRT_ITM.BIB_ITM_NBR AS BIB_ID " . - "FROM LV_USER, CIRT_ITM " . - "WHERE LV_USER.PRSN_NBR = CIRT_ITM.PRSN_NBR " . + 'AS DUEDATE, CIRT_ITM.BIB_ITM_NBR AS BIB_ID ' . + 'FROM LV_USER, CIRT_ITM ' . + 'WHERE LV_USER.PRSN_NBR = CIRT_ITM.PRSN_NBR ' . "AND LV_USER.LOGIN = '" . $patron['id'] . "'"; try { $sqlStmt = $this->db->prepare($sql); @@ -643,12 +643,12 @@ public function getMyFines($patron) $fineList = []; $sql = "SELECT UNIQUE TO_CHAR(CIRT_ITM.CIRT_ITM_CHRG_OUT_DTE,'DD/MM/YYYY') " - . "AS ORIG_CHARGE_DATE, " + . 'AS ORIG_CHARGE_DATE, ' . "TO_CHAR(CIRT_ITM.CIRT_ITM_DUE_DTE,'DD/MM/YYYY') AS DUE_DATE, " - . "CIRT_ITM.BIB_ITM_NBR AS BIB_ID " - . "FROM CIRT_ITM, LV_USER " - . "WHERE CIRT_ITM.PRSN_NBR = LV_USER.PRSN_NBR " - . "AND CIRT_ITM_DUE_DTE < SYSDATE " + . 'CIRT_ITM.BIB_ITM_NBR AS BIB_ID ' + . 'FROM CIRT_ITM, LV_USER ' + . 'WHERE CIRT_ITM.PRSN_NBR = LV_USER.PRSN_NBR ' + . 'AND CIRT_ITM_DUE_DTE < SYSDATE ' . "AND LV_USER.LOGIN='" . $patron['id'] . "'"; try { $sqlStmt = $this->db->prepare($sql); @@ -679,13 +679,13 @@ public function getMyHolds($patron) { $holdList = []; - $sql = "SELECT CIRTN_HLD.BIB_ITM_NBR AS BIB_ID, " . - "CIRTN_HLD.CIRTN_HLD_LCTN_ORG_NBR AS PICKUP_LOCATION, " . - "CIRTN_HLD.CIRTN_HLD_TYP_CDE AS HOLD_RECALL_TYPE, " . + $sql = 'SELECT CIRTN_HLD.BIB_ITM_NBR AS BIB_ID, ' . + 'CIRTN_HLD.CIRTN_HLD_LCTN_ORG_NBR AS PICKUP_LOCATION, ' . + 'CIRTN_HLD.CIRTN_HLD_TYP_CDE AS HOLD_RECALL_TYPE, ' . "TO_CHAR(CIRTN_HLD.TME_HLD_END_DTE,'DD/MM/YYYY') AS EXPIRE_DATE, " . "TO_CHAR(CIRTN_HLD.CIRTN_HLD_CRTE_DTE,'DD/MM/YYYY') AS " . - "CREATE_DATE FROM CIRTN_HLD, LV_USER " . - "WHERE CIRTN_HLD.PRSN_NBR = LV_USER.PRSN_NBR " . + 'CREATE_DATE FROM CIRTN_HLD, LV_USER ' . + 'WHERE CIRTN_HLD.PRSN_NBR = LV_USER.PRSN_NBR ' . "AND LV_USER.LOGIN = '" . $patron['id'] . "'"; try { $sqlStmt = $this->db->prepare($sql); @@ -715,22 +715,22 @@ public function getMyHolds($patron) */ public function getMyProfile($patron) { - $sql = "SELECT DISTINCT PRSN.PRSN_NBR AS UNO, (SELECT p1.PRSN_CMCTN_NBR " . - "FROM PRSN_CMCTN p1 " . - "WHERE p1.prsn_nbr = PRSN.prsn_nbr AND PRSN_CMCTN_TYP_CDE = 7) tfno, " . - "(SELECT p1.PRSN_CMCTN_NBR FROM PRSN_CMCTN p1 WHERE p1.prsn_nbr = " . - "PRSN.prsn_nbr AND " . - "PRSN_CMCTN_TYP_CDE = 1) email, " . - "PRSN.PRSN_SRNME_SRT_FORM AS LAST_NAME, PRSN.PRSN_1ST_NME_SRT_FORM " . - "AS FIRST_NAME, " . + $sql = 'SELECT DISTINCT PRSN.PRSN_NBR AS UNO, (SELECT p1.PRSN_CMCTN_NBR ' . + 'FROM PRSN_CMCTN p1 ' . + 'WHERE p1.prsn_nbr = PRSN.prsn_nbr AND PRSN_CMCTN_TYP_CDE = 7) tfno, ' . + '(SELECT p1.PRSN_CMCTN_NBR FROM PRSN_CMCTN p1 WHERE p1.prsn_nbr = ' . + 'PRSN.prsn_nbr AND ' . + 'PRSN_CMCTN_TYP_CDE = 1) email, ' . + 'PRSN.PRSN_SRNME_SRT_FORM AS LAST_NAME, PRSN.PRSN_1ST_NME_SRT_FORM ' . + 'AS FIRST_NAME, ' . "CONCAT(PSTL_ADR_ST_NME,CONCAT(' ',CONCAT(PSTL_ADR_ST_NBR,CONCAT(' ', " . "CONCAT(PSTL_ADR_FLR_NBR,CONCAT(' ',PSTL_ADR_RM_NBR)))))) " . - "AS ADDRESS_LINE1, PRSN_PSTL_ADR.PSTL_ADR_CTY_NME " . - "AS ADDRESS_LINE2, PRSN_PSTL_ADR.PSTL_ADR_PSTL_CDE AS ZIP_POSTAL " . - "FROM PRSN, PRSN_CMCTN, PRSN_PSTL_ADR, LV_USER " . - "WHERE PRSN_CMCTN.PRSN_nbr = PRSN.PRSN_NBR (+) " . - "AND PRSN.PRSN_NBR = PRSN_PSTL_ADR.PRSN_NBR (+) " . - "AND LV_USER.PRSN_NBR = PRSN.PRSN_NBR " . + 'AS ADDRESS_LINE1, PRSN_PSTL_ADR.PSTL_ADR_CTY_NME ' . + 'AS ADDRESS_LINE2, PRSN_PSTL_ADR.PSTL_ADR_PSTL_CDE AS ZIP_POSTAL ' . + 'FROM PRSN, PRSN_CMCTN, PRSN_PSTL_ADR, LV_USER ' . + 'WHERE PRSN_CMCTN.PRSN_nbr = PRSN.PRSN_NBR (+) ' . + 'AND PRSN.PRSN_NBR = PRSN_PSTL_ADR.PRSN_NBR (+) ' . + 'AND LV_USER.PRSN_NBR = PRSN.PRSN_NBR ' . "AND LV_USER.LOGIN = UPPER('" . $patron['id'] . "')"; try { @@ -805,8 +805,8 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) $enddate = date('d-m-Y', strtotime('now')); $startdate = date('d-m-Y', strtotime("-$daysOld day")); - $sql = "select count(distinct BIB_ITM_NBR) as count " . - "from CPY_ID " . + $sql = 'select count(distinct BIB_ITM_NBR) as count ' . + 'from CPY_ID ' . "where CPY_ID.CRTN_DTE >= to_date('$startdate', 'dd-mm-yyyy') " . "and CPY_ID.CRTN_DTE < to_date('$enddate', 'dd-mm-yyyy')"; try { @@ -822,15 +822,15 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) $limit = ($limit) ? $limit : 20; $startRow = (($page - 1) * $limit) + 1; $endRow = ($page * $limit); - $sql = "select * from " . - "(select a.*, rownum rnum from " . - "(select CPY_ID.BIB_ITM_NBR as BIB_ID, CPY_ID.CRTN_DTE " . - "as CREATE_DATE " . - "from CPY_ID " . + $sql = 'select * from ' . + '(select a.*, rownum rnum from ' . + '(select CPY_ID.BIB_ITM_NBR as BIB_ID, CPY_ID.CRTN_DTE ' . + 'as CREATE_DATE ' . + 'from CPY_ID ' . "where CPY_ID.CRTN_DTE >= to_date('$startdate', 'dd-mm-yyyy') " . "and CPY_ID.CRTN_DTE < to_date('$enddate', 'dd-mm-yyyy') " . - "group by CPY_ID.BIB_ITM_NBR, CPY_ID.CRTN_DTE " . - "order by CPY_ID.CRTN_DTE desc) a " . + 'group by CPY_ID.BIB_ITM_NBR, CPY_ID.CRTN_DTE ' . + 'order by CPY_ID.CRTN_DTE desc) a ' . "where rownum <= $endRow) " . "where rnum >= $startRow"; try { @@ -857,9 +857,9 @@ public function getFunds() { $list = []; - $sql = "select distinct * from " . - "(select initcap(lower(FUND.FUND_NME)) as name from FUND) " . - "order by name"; + $sql = 'select distinct * from ' . + '(select initcap(lower(FUND.FUND_NME)) as name from FUND) ' . + 'order by name'; try { $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute(); @@ -891,20 +891,20 @@ public function findReserves($course, $inst, $dept) { $recordList = []; - $dept = str_replace("'", "", $dept); - $dept = str_replace("\"", "", $dept); - $dept = str_replace(":", "", $dept); - $dept = str_replace(",", "", $dept); - $dept = str_replace(".", "", $dept); - $dept = str_replace(";", "", $dept); - $dept = str_replace("*", "%", $dept); - - $sql = "select distinct(BIB_ITM_NBR) as BIB_ID " . - "FROM CPY_ID, SHLF_LIST " . - "WHERE CPY_ID.SHLF_LIST_KEY_NBR = SHLF_LIST.SHLF_LIST_KEY_NBR " . - "AND UPPER(SUBSTR(SHLF_LIST.SHLF_LIST_STRNG_TEXT,3,20)) LIKE " . + $dept = str_replace("'", '', $dept); + $dept = str_replace('"', '', $dept); + $dept = str_replace(':', '', $dept); + $dept = str_replace(',', '', $dept); + $dept = str_replace('.', '', $dept); + $dept = str_replace(';', '', $dept); + $dept = str_replace('*', '%', $dept); + + $sql = 'select distinct(BIB_ITM_NBR) as BIB_ID ' . + 'FROM CPY_ID, SHLF_LIST ' . + 'WHERE CPY_ID.SHLF_LIST_KEY_NBR = SHLF_LIST.SHLF_LIST_KEY_NBR ' . + 'AND UPPER(SUBSTR(SHLF_LIST.SHLF_LIST_STRNG_TEXT,3,20)) LIKE ' . "UPPER('" . $dept . "%') " . - "AND ROWNUM <= 1000"; + 'AND ROWNUM <= 1000'; try { $sqlStmt = $this->db->prepare($sql); @@ -960,10 +960,10 @@ function findReserves($course, $inst, $dept) public function getSuppressedRecords() { $list = []; - $sql = "SELECT BIB_AUT_ITM_NBR as BIB_ID " . - "FROM CTLGG_TRSTN_ACTVT_LOG " . - "WHERE STATS_TRSTN_TYP_CDE = 4 " . - "AND trstn_log_tmest >= SYSDATE -30"; + $sql = 'SELECT BIB_AUT_ITM_NBR as BIB_ID ' . + 'FROM CTLGG_TRSTN_ACTVT_LOG ' . + 'WHERE STATS_TRSTN_TYP_CDE = 4 ' . + 'AND trstn_log_tmest >= SYSDATE -30'; try { $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute(); diff --git a/module/VuFind/src/VuFind/ILS/Driver/Demo.php b/module/VuFind/src/VuFind/ILS/Driver/Demo.php index ab55cfb1dee..ce4b422f06f 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Demo.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Demo.php @@ -142,21 +142,21 @@ class Demo extends AbstractBase implements \VuFind\I18n\HasSorterInterface * * @var array */ - protected $courses = ["Course A", "Course B", "Course C"]; + protected $courses = ['Course A', 'Course B', 'Course C']; /** * Departments for use in course reserves. * * @var array */ - protected $departments = ["Dept. A", "Dept. B", "Dept. C"]; + protected $departments = ['Dept. A', 'Dept. B', 'Dept. C']; /** * Instructors for use in course reserves. * * @var array */ - protected $instructors = ["Instructor A", "Instructor B", "Instructor C"]; + protected $instructors = ['Instructor A', 'Instructor B', 'Instructor C']; /** * Item and pick up locations @@ -318,15 +318,15 @@ protected function getFakeStatus() $loc = rand() % 10; switch ($loc) { case 10: - return "Missing"; + return 'Missing'; case 9: - return "On Order"; + return 'On Order'; case 8: - return "Invoiced"; + return 'Invoiced'; case 7: - return "Uncertain"; + return 'Uncertain'; default: - return "Available"; + return 'Available'; } } @@ -337,11 +337,11 @@ protected function getFakeStatus() */ protected function getFakeCallNum() { - $codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + $codes = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $a = $codes[rand() % strlen($codes)]; $b = rand() % 899 + 100; $c = rand() % 9999; - return $a . $b . "." . $c; + return $a . $b . '.' . $c; } /** @@ -351,7 +351,7 @@ protected function getFakeCallNum() */ protected function getFakeCallNumPrefix() { - $codes = "0123456789"; + $codes = '0123456789'; $prefix = substr(str_shuffle($codes), 1, rand(0, 1)); if (!empty($prefix)) { return 'Prefix: ' . $prefix; @@ -494,7 +494,7 @@ protected function getRandomHolding($id, $number, array $patron = null) 'source' => $this->getRecordSource(), 'item_id' => $number, 'number' => $number, - 'barcode' => sprintf("%08d", rand() % 50000), + 'barcode' => sprintf('%08d', rand() % 50000), 'availability' => $availability, 'status' => $status, 'location' => $location, @@ -572,24 +572,24 @@ protected function createRequestList($requestType) $location = $this->getFakeLoc(false); $randDays = rand() % 10; $currentItem = [ - "location" => $location, - "create" => $this->dateConverter->convertToDisplayDate( + 'location' => $location, + 'create' => $this->dateConverter->convertToDisplayDate( 'U', strtotime("now - {$randDays} days") ), - "expire" => $this->dateConverter->convertToDisplayDate( + 'expire' => $this->dateConverter->convertToDisplayDate( 'U', - strtotime("now + 30 days") + strtotime('now + 30 days') ), - "item_id" => $i, - "reqnum" => $i, + 'item_id' => $i, + 'reqnum' => $i, ]; // Inject a random identifier of some sort: $currentItem += $this->getRandomItemIdentifier(); if ($i == 2 || rand() % 5 == 1) { // Mimic an ILL request - $currentItem["id"] = "ill_request_$i"; - $currentItem["title"] = "ILL Hold Title $i"; + $currentItem['id'] = "ill_request_$i"; + $currentItem['title'] = "ILL Hold Title $i"; $currentItem['institution_id'] = 'ill_institution'; $currentItem['institution_name'] = 'ILL Library'; $currentItem['institution_dbkey'] = 'ill_institution'; @@ -1026,21 +1026,21 @@ public function getMyFines($patron) // How many days overdue is the item? $day_overdue = rand() % 30 + 5; // Calculate checkout date: - $checkout = strtotime("now - " . ($day_overdue + 14) . " days"); + $checkout = strtotime('now - ' . ($day_overdue + 14) . ' days'); // 50c a day fine? $fine = $day_overdue * 0.50; $fineList[] = [ - "amount" => $fine * 100, - "checkout" => $this->dateConverter + 'amount' => $fine * 100, + 'checkout' => $this->dateConverter ->convertToDisplayDate('U', $checkout), 'createdate' => $this->dateConverter ->convertToDisplayDate('U', time()), // After 20 days it becomes 'Long Overdue' - "fine" => $day_overdue > 20 ? "Long Overdue" : "Overdue", + 'fine' => $day_overdue > 20 ? 'Long Overdue' : 'Overdue', // 50% chance they've paid half of it - "balance" => (rand() % 100 > 49 ? $fine / 2 : $fine) * 100, - "duedate" => $this->dateConverter->convertToDisplayDate( + 'balance' => (rand() % 100 > 49 ? $fine / 2 : $fine) * 100, + 'duedate' => $this->dateConverter->convertToDisplayDate( 'U', strtotime("now - $day_overdue days") ), @@ -1205,7 +1205,7 @@ protected function getRandomTransactionList() ), 'rawduedate' => $rawDueDate, 'dueStatus' => $this->calculateDueStatus($rawDueDate), - 'barcode' => sprintf("%08d", rand() % 50000), + 'barcode' => sprintf('%08d', rand() % 50000), 'renew' => $renew, 'renewLimit' => $renewLimit, 'request' => $req, @@ -1352,7 +1352,7 @@ protected function getRandomHistoricTransactionList() '_checkoutDate' => $checkoutDate, '_dueDate' => $dueDate, '_returnDate' => $returnDate, - 'barcode' => sprintf("%08d", rand() % 50000), + 'barcode' => sprintf('%08d', rand() % 50000), 'row_id' => $i, ]; if ($this->idsInMyResearch) { @@ -1628,7 +1628,7 @@ public function getRequestGroups( public function getFunds() { $this->checkIntermittentFailure(); - return ["Fund A", "Fund B", "Fund C"]; + return ['Fund A', 'Fund B', 'Fund C']; } /** @@ -2015,17 +2015,17 @@ public function renewMyItems($renewDetails) < $transactions[$i]['renewLimit']; $finalResult['details'][$current['item_id']] = [ - "success" => true, - "new_date" => $transactions[$i]['duedate'], - "new_time" => '', - "item_id" => $current['item_id'], + 'success' => true, + 'new_date' => $transactions[$i]['duedate'], + 'new_time' => '', + 'item_id' => $current['item_id'], ]; } else { $finalResult['details'][$current['item_id']] = [ - "success" => false, - "new_date" => false, - "item_id" => $current['item_id'], - "sysMessage" => + 'success' => false, + 'new_date' => false, + 'item_id' => $current['item_id'], + 'sysMessage' => 'Demonstrating failure; keep trying and ' . 'it will work eventually.', ]; @@ -2105,8 +2105,8 @@ public function placeHold($holdDetails) // Simulate failure: if ($this->isFailing(__METHOD__, 50)) { return [ - "success" => false, - "sysMessage" => + 'success' => false, + 'sysMessage' => 'Demonstrating failure; keep trying and ' . 'it will work eventually.', ]; @@ -2229,8 +2229,8 @@ public function placeStorageRetrievalRequest($details) $this->checkIntermittentFailure(); if (!$this->storageRetrievalRequests) { return [ - "success" => false, - "sysMessage" => 'Storage Retrieval Requests are disabled.', + 'success' => false, + 'sysMessage' => 'Storage Retrieval Requests are disabled.', ]; } @@ -2250,8 +2250,8 @@ public function placeStorageRetrievalRequest($details) // Simulate failure: if ($this->isFailing(__METHOD__, 50)) { return [ - "success" => false, - "sysMessage" => + 'success' => false, + 'sysMessage' => 'Demonstrating failure; keep trying and ' . 'it will work eventually.', ]; @@ -2271,11 +2271,11 @@ public function placeStorageRetrievalRequest($details) !isset($details['requiredBy']) || empty($details['requiredBy']) ) { - $expire = strtotime("now + 30 days"); + $expire = strtotime('now + 30 days'); } else { try { $expire = $this->dateConverter->convertFromDisplayDate( - "U", + 'U', $details['requiredBy'] ); } catch (DateException $e) { diff --git a/module/VuFind/src/VuFind/ILS/Driver/Evergreen.php b/module/VuFind/src/VuFind/ILS/Driver/Evergreen.php index 6c85ecb2faf..213541cdd93 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Evergreen.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Evergreen.php @@ -284,10 +284,10 @@ public function getHolding($id, array $patron = null, array $options = []) } if ($row['due_year']) { - $due_date = $row['due_year'] . "-" . $row['due_month'] . "-" . + $due_date = $row['due_year'] . '-' . $row['due_month'] . '-' . $row['due_day']; } else { - $due_date = ""; + $due_date = ''; } $holding[] = [ 'id' => $id, @@ -349,10 +349,10 @@ public function patronLogin($barcode, $passwd) HERE; if (is_numeric($barcode)) { // A barcode was supplied as ID - $sql .= "AND card.barcode = ?"; + $sql .= 'AND card.barcode = ?'; } else { // A username was supplied as ID - $sql .= "AND usr.usrname = ?"; + $sql .= 'AND usr.usrname = ?'; } try { @@ -396,25 +396,25 @@ public function getMyTransactions($patron) { $transList = []; - $sql = "select call_number.record as bib_id, " . - "circulation.due_date as due_date, " . - "circulation.target_copy as item_id, " . - "circulation.renewal_remaining as renewal_remaining, " . - "aou_circ.name as borrowing_location, " . - "aou_own.name as owning_library, " . - "copy.barcode as barcode " . + $sql = 'select call_number.record as bib_id, ' . + 'circulation.due_date as due_date, ' . + 'circulation.target_copy as item_id, ' . + 'circulation.renewal_remaining as renewal_remaining, ' . + 'aou_circ.name as borrowing_location, ' . + 'aou_own.name as owning_library, ' . + 'copy.barcode as barcode ' . "from $this->dbName.action.circulation " . "join $this->dbName.asset.copy ON " . - " (circulation.target_copy = copy.id) " . + ' (circulation.target_copy = copy.id) ' . "join $this->dbName.asset.call_number ON " . - " (copy.call_number = call_number.id) " . + ' (copy.call_number = call_number.id) ' . "join $this->dbName.actor.org_unit aou_circ ON " . - " (circulation.circ_lib = aou_circ.id) " . + ' (circulation.circ_lib = aou_circ.id) ' . "join $this->dbName.actor.org_unit aou_own ON " . - " (call_number.owning_lib = aou_own.id) " . + ' (call_number.owning_lib = aou_own.id) ' . "where circulation.usr = '" . $patron['id'] . "' " . - "and circulation.checkin_time is null " . - "and circulation.xact_finish is null"; + 'and circulation.checkin_time is null ' . + 'and circulation.xact_finish is null'; try { $sqlStmt = $this->db->prepare($sql); @@ -423,11 +423,11 @@ public function getMyTransactions($patron) while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { $due_date = $this->formatDate($row['due_date']); $_due_time = new \DateTime($row['due_date']); - if ($_due_time->format('H:i:s') == "23:59:59") { - $dueTime = ""; // don't display due time for non-hourly loans + if ($_due_time->format('H:i:s') == '23:59:59') { + $dueTime = ''; // don't display due time for non-hourly loans } else { $dueTime = $this->dateConverter->convertToDisplayTime( - "Y-m-d H:i", + 'Y-m-d H:i', $row['due_date'] ); } @@ -484,25 +484,25 @@ public function getMyFines($patron) { $fineList = []; - $sql = "select billable_xact_summary.total_owed * 100 as total_owed, " . - "billable_xact_summary.balance_owed * 100 as balance_owed, " . - "billable_xact_summary.last_billing_type, " . - "billable_xact_summary.last_billing_ts, " . - "billable_circulations.create_time as checkout_time, " . - "billable_circulations.due_date, " . - "billable_circulations.target_copy, " . - "call_number.record " . + $sql = 'select billable_xact_summary.total_owed * 100 as total_owed, ' . + 'billable_xact_summary.balance_owed * 100 as balance_owed, ' . + 'billable_xact_summary.last_billing_type, ' . + 'billable_xact_summary.last_billing_ts, ' . + 'billable_circulations.create_time as checkout_time, ' . + 'billable_circulations.due_date, ' . + 'billable_circulations.target_copy, ' . + 'call_number.record ' . "from $this->dbName.money.billable_xact_summary " . "LEFT JOIN $this->dbName.action.billable_circulations " . - "ON (billable_xact_summary.id = billable_circulations.id " . - " and billable_circulations.xact_finish is null) " . + 'ON (billable_xact_summary.id = billable_circulations.id ' . + ' and billable_circulations.xact_finish is null) ' . "LEFT JOIN $this->dbName.asset.copy ON " . - " (billable_circulations.target_copy = copy.id) " . + ' (billable_circulations.target_copy = copy.id) ' . "LEFT JOIN $this->dbName.asset.call_number ON " . - " (copy.call_number = call_number.id) " . + ' (copy.call_number = call_number.id) ' . "where billable_xact_summary.usr = '" . $patron['id'] . "' " . - "and billable_xact_summary.total_owed <> 0 " . - "and billable_xact_summary.xact_finish is null"; + 'and billable_xact_summary.total_owed <> 0 ' . + 'and billable_xact_summary.xact_finish is null'; try { $sqlStmt = $this->db->prepare($sql); @@ -540,21 +540,21 @@ public function getMyHolds($patron) { $holdList = []; - $sql = "select ahr.hold_type, bib_record, " . - "ahr.id as hold_id, " . - "expire_time, request_time, shelf_time, capture_time, " . - "shelf_time, shelf_expire_time, frozen, thaw_date, " . - "org_unit.name as lib_name, acp.status as copy_status " . + $sql = 'select ahr.hold_type, bib_record, ' . + 'ahr.id as hold_id, ' . + 'expire_time, request_time, shelf_time, capture_time, ' . + 'shelf_time, shelf_expire_time, frozen, thaw_date, ' . + 'org_unit.name as lib_name, acp.status as copy_status ' . "from $this->dbName.action.hold_request ahr " . "join $this->dbName.actor.org_unit on " . - " (ahr.pickup_lib = org_unit.id) " . + ' (ahr.pickup_lib = org_unit.id) ' . "join $this->dbName.reporter.hold_request_record rhrr on " . - " (rhrr.id = ahr.id) " . + ' (rhrr.id = ahr.id) ' . "left join $this->dbName.asset.copy acp on " . - " (acp.id = ahr.current_copy) " . + ' (acp.id = ahr.current_copy) ' . "where ahr.usr = '" . $patron['id'] . "' " . - "and ahr.fulfillment_time is null " . - "and ahr.cancel_time is null"; + 'and ahr.fulfillment_time is null ' . + 'and ahr.cancel_time is null'; try { $sqlStmt = $this->db->prepare($sql); @@ -725,10 +725,10 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) $enddate = date('Y-m-d', strtotime('now')); $startdate = date('Y-m-d', strtotime("-$daysOld day")); - $sql = "select count(distinct copy.id) as count " . - "from asset.copy " . + $sql = 'select count(distinct copy.id) as count ' . + 'from asset.copy ' . "where copy.create_date >= '$startdate' " . - "and copy.status = 0 " . + 'and copy.status = 0 ' . "and copy.create_date < '$enddate' LIMIT 50"; try { @@ -746,10 +746,10 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) //$startRow = (($page-1)*$limit)+1; //$endRow = ($page*$limit); - $sql = "select copy.id, call_number.record from asset.copy " . - "join asset.call_number on (call_number.id = copy.call_number) " . + $sql = 'select copy.id, call_number.record from asset.copy ' . + 'join asset.call_number on (call_number.id = copy.call_number) ' . "where copy.create_date >= '$startdate' " . - "and copy.status = 0 " . + 'and copy.status = 0 ' . "and copy.create_date < '$enddate' LIMIT 50"; try { @@ -803,9 +803,9 @@ public function getSuppressedRecords() { $list = []; - $sql = "select copy.id as id " . + $sql = 'select copy.id as id ' . "from $this->dbName.asset " . - "where copy.opac_visible = false"; + 'where copy.opac_visible = false'; try { $sqlStmt = $this->db->prepare($sql); diff --git a/module/VuFind/src/VuFind/ILS/Driver/Folio.php b/module/VuFind/src/VuFind/ILS/Driver/Folio.php index 85a367759d0..1d12f2c9922 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Folio.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Folio.php @@ -409,7 +409,7 @@ protected function getInstanceByBibId($bibId) $response = $this->makeRequest('GET', '/instance-storage/instances', $query); $instances = json_decode($response->getBody()); if (count($instances->instances ?? []) == 0) { - throw new ILSException("Item Not Found"); + throw new ILSException('Item Not Found'); } return $instances->instances[0]; } @@ -471,7 +471,7 @@ protected function isHoldable($locationName) $excludeLocs = (array)($this->config['Holds']['excludeHoldLocations'] ?? []); // Exclude checking by regex match - if (trim(strtolower($mode)) == "regex") { + if (trim(strtolower($mode)) == 'regex') { foreach ($excludeLocs as $pattern) { $match = @preg_match($pattern, $locationName); // Invalid regex, skip this pattern @@ -1064,7 +1064,7 @@ public function getMyProfile($patron) $profile = $this->getUserById($patron['id']); $expiration = isset($profile->expirationDate) ? $this->dateConverter->convertToDisplayDate( - "Y-m-d H:i", + 'Y-m-d H:i', $profile->expirationDate ) : null; @@ -1211,11 +1211,11 @@ public function renewMyItems($renewDetails) $renewal = [ 'success' => true, 'new_date' => $this->dateConverter->convertToDisplayDate( - "Y-m-d H:i", + 'Y-m-d H:i', $json->dueDate ), 'new_time' => $this->dateConverter->convertToDisplayTime( - "Y-m-d H:i", + 'Y-m-d H:i', $json->dueDate ), 'item_id' => $json->itemId, @@ -1235,7 +1235,7 @@ public function renewMyItems($renewDetails) ); $renewal = [ 'success' => false, - 'sysMessage' => "Renewal Failed", + 'sysMessage' => 'Renewal Failed', ]; } $renewalResults['details'][$loanId] = $renewal; @@ -1336,27 +1336,27 @@ public function getMyHolds($patron) ) as $hold ) { $requestDate = $this->dateConverter->convertToDisplayDate( - "Y-m-d H:i", + 'Y-m-d H:i', $hold->requestDate ); // Set expire date if it was included in the response $expireDate = isset($hold->requestExpirationDate) ? $this->dateConverter->convertToDisplayDate( - "Y-m-d H:i", + 'Y-m-d H:i', $hold->requestExpirationDate ) : null; // Set lastPickup Date if provided, format to j M Y $lastPickup = isset($hold->holdShelfExpirationDate) ? $this->dateConverter->convertToDisplayDate( - "Y-m-d H:i", + 'Y-m-d H:i', $hold->holdShelfExpirationDate ) : null; $currentHold = [ 'type' => $hold->requestType, 'create' => $requestDate, - 'expire' => $expireDate ?? "", + 'expire' => $expireDate ?? '', 'id' => $this->getBibId( $hold->instanceId, $hold->holdingsRecordId, @@ -1528,7 +1528,7 @@ public function cancelHolds($cancelDetails) $request_json->requesterId != $patron['id'] && ($request_json->proxyUserId ?? null) != $patron['id'] ) { - throw new ILSException("Invalid Request"); + throw new ILSException('Invalid Request'); } // Change status to Closed and add cancellationID $request_json->status = 'Closed - Cancelled'; @@ -1790,7 +1790,7 @@ public function getMyFines($patron) 'status' => $fine->paymentStatus->name, 'type' => $fine->feeFineType, 'title' => $title, - 'createdate' => date_format($date, "j M Y"), + 'createdate' => date_format($date, 'j M Y'), ]; } return $fines; diff --git a/module/VuFind/src/VuFind/ILS/Driver/GeniePlus.php b/module/VuFind/src/VuFind/ILS/Driver/GeniePlus.php index f1a4d27e286..bf4eed75f26 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/GeniePlus.php +++ b/module/VuFind/src/VuFind/ILS/Driver/GeniePlus.php @@ -179,12 +179,12 @@ protected function renewAccessToken(): void * @return \Laminas\Http\Response */ protected function callApiWithToken( - $method = "GET", - $path = "/", + $method = 'GET', + $path = '/', $params = [], $headers = [] ) { - $headers[] = "Accept: application/json"; + $headers[] = 'Accept: application/json'; if (null === $this->token) { $this->renewAccessToken(); } diff --git a/module/VuFind/src/VuFind/ILS/Driver/Horizon.php b/module/VuFind/src/VuFind/ILS/Driver/Horizon.php index bc2bab3926e..80b3dbf7eb5 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Horizon.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Horizon.php @@ -118,22 +118,22 @@ public function init() */ protected function buildSqlFromArray($sql) { - $modifier = isset($sql['modifier']) ? $sql['modifier'] . " " : ""; + $modifier = isset($sql['modifier']) ? $sql['modifier'] . ' ' : ''; // Put String Together - $sqlString = "select " . $modifier . implode(", ", $sql['expressions']); - $sqlString .= " from " . implode(", ", $sql['from']); + $sqlString = 'select ' . $modifier . implode(', ', $sql['expressions']); + $sqlString .= ' from ' . implode(', ', $sql['from']); $sqlString .= (!empty($sql['join'])) - ? " join " . implode(" join ", $sql['join']) : ""; + ? ' join ' . implode(' join ', $sql['join']) : ''; $sqlString .= (!empty($sql['innerJoin'])) - ? " inner join " . implode(" inner join ", $sql['innerJoin']) : ""; + ? ' inner join ' . implode(' inner join ', $sql['innerJoin']) : ''; $sqlString .= (!empty($sql['leftOuterJoin'])) - ? " left outer join " - . implode(" left outer join ", $sql['leftOuterJoin']) - : ""; - $sqlString .= " where " . implode(" AND ", $sql['where']); + ? ' left outer join ' + . implode(' left outer join ', $sql['leftOuterJoin']) + : ''; + $sqlString .= ' where ' . implode(' AND ', $sql['where']); $sqlString .= (!empty($sql['order'])) - ? " ORDER BY " . implode(", ", $sql['order']) : ""; + ? ' ORDER BY ' . implode(', ', $sql['order']) : ''; return $sqlString; } @@ -228,45 +228,45 @@ protected function getHoldingSQL($id) // import/marc.properties // Expressions $sqlExpressions = [ - "i.item# as ITEM_ID", - "i.item_status as STATUS_CODE", - "ist.descr as STATUS", - "l.name as LOCATION", - "i.call_reconstructed as CALLNUMBER", - "i.ibarcode as ITEM_BARCODE", - "convert(varchar(10), " . + 'i.item# as ITEM_ID', + 'i.item_status as STATUS_CODE', + 'ist.descr as STATUS', + 'l.name as LOCATION', + 'i.call_reconstructed as CALLNUMBER', + 'i.ibarcode as ITEM_BARCODE', + 'convert(varchar(10), ' . " dateadd(dd,i.due_date,'jan 1 1970'), " . - " 101) as DUEDATE", - "i.copy_reconstructed as NUMBER", - "convert(varchar(10), " . + ' 101) as DUEDATE', + 'i.copy_reconstructed as NUMBER', + 'convert(varchar(10), ' . " dateadd(dd,ch.cki_date,'jan 1 1970'), " . - " 101) as RETURNDATE", - "(select count(*) + ' 101) as RETURNDATE', + '(select count(*) from request r where r.bib# = i.bib# - and r.reactivate_date = NULL) as REQUEST", - "i.notes as NOTES", - "ist.available_for_request IS_HOLDABLE", + and r.reactivate_date = NULL) as REQUEST', + 'i.notes as NOTES', + 'ist.available_for_request IS_HOLDABLE', ]; // From - $sqlFrom = ["item i"]; + $sqlFrom = ['item i']; // inner Join $sqlInnerJoin = [ - "item_status ist on i.item_status = ist.item_status", - "location l on i.location = l.location", + 'item_status ist on i.item_status = ist.item_status', + 'location l on i.location = l.location', ]; $sqlLeftOuterJoin = [ - "circ_history ch on ch.item# = i.item#", + 'circ_history ch on ch.item# = i.item#', ]; // Where $sqlWhere = [ - "i.bib# = " . addslashes($id), - "i.staff_only = 0", + 'i.bib# = ' . addslashes($id), + 'i.staff_only = 0', ]; $sqlArray = [ @@ -425,24 +425,24 @@ protected function getStatusesSQL($idList) // Query holding information based on id field defined in // import/marc.properties // Expressions - $sqlExpressions = ["i.bib# as ID", - "i.item_status as STATUS_CODE", - "ist.descr as STATUS", - "l.name as LOCATION", - "i.call_reconstructed as CALLNUMBER"]; + $sqlExpressions = ['i.bib# as ID', + 'i.item_status as STATUS_CODE', + 'ist.descr as STATUS', + 'l.name as LOCATION', + 'i.call_reconstructed as CALLNUMBER']; // From - $sqlFrom = ["item i"]; + $sqlFrom = ['item i']; // inner Join - $sqlInnerJoin = ["item_status ist on i.item_status = ist.item_status", - "location l on i.location = l.location"]; + $sqlInnerJoin = ['item_status ist on i.item_status = ist.item_status', + 'location l on i.location = l.location']; $bibIDs = implode(',', $idList); // Where - $sqlWhere = ["i.bib# in (" . $bibIDs . ")", - "i.staff_only = 0"]; + $sqlWhere = ['i.bib# in (' . $bibIDs . ')', + 'i.staff_only = 0']; $sqlArray = [ 'expressions' => $sqlExpressions, @@ -525,14 +525,14 @@ public function getPurchaseHistory($id) */ public function patronLogin($username, $password) { - $sql = "select name_reconstructed as FULLNAME, " . - "email_address as EMAIL " . - "from borrower " . - "left outer join borrower_address on " . - "borrower_address.borrower# = borrower.borrower# " . - "inner join borrower_barcode on " . - "borrower.borrower# = borrower_barcode.borrower# " . - "where borrower_barcode.bbarcode = " . + $sql = 'select name_reconstructed as FULLNAME, ' . + 'email_address as EMAIL ' . + 'from borrower ' . + 'left outer join borrower_address on ' . + 'borrower_address.borrower# = borrower.borrower# ' . + 'inner join borrower_barcode on ' . + 'borrower.borrower# = borrower_barcode.borrower# ' . + 'where borrower_barcode.bbarcode = ' . "'" . addslashes($username) . "' " . "and pin# = '" . addslashes($password) . "'"; @@ -576,40 +576,40 @@ protected function getHoldsSQL($patron) { // Expressions $sqlExpressions = [ - "r.bib# as BIB_NUM", - "r.request# as REQNUM", - "r.item# as ITEM_ID", - "r.bib_queue_ord as POSITION", - "l.name as LOCATION", - "r.request_status as STATUS", - "case when r.request_status = 1 " . - "then 0 " . - "else 1 " . - "end as SORT", - "t.processed as TITLE", - "p.pubdate as PUBLICATION_YEAR", - "i.volume as VOLUME", + 'r.bib# as BIB_NUM', + 'r.request# as REQNUM', + 'r.item# as ITEM_ID', + 'r.bib_queue_ord as POSITION', + 'l.name as LOCATION', + 'r.request_status as STATUS', + 'case when r.request_status = 1 ' . + 'then 0 ' . + 'else 1 ' . + 'end as SORT', + 't.processed as TITLE', + 'p.pubdate as PUBLICATION_YEAR', + 'i.volume as VOLUME', "convert(varchar(12),dateadd(dd, r.hold_exp_date, '1 jan 1970')) " . - "as HOLD_EXPIRE", + 'as HOLD_EXPIRE', "convert(varchar(12),dateadd(dd, r.expire_date, '1 jan 1970')) " . - "as REQUEST_EXPIRE", + 'as REQUEST_EXPIRE', "convert(varchar(12),dateadd(dd, r.request_date, '1 jan 1970')) " . - "as CREATED", + 'as CREATED', ]; // From - $sqlFrom = ["request r"]; + $sqlFrom = ['request r']; // Join $sqlJoin = [ - "borrower_barcode bb on bb.borrower# = r.borrower#", - "location l on l.location = r.pickup_location", - "title t on t.bib# = r.bib#", + 'borrower_barcode bb on bb.borrower# = r.borrower#', + 'location l on l.location = r.pickup_location', + 'title t on t.bib# = r.bib#', ]; $sqlLeftOuterJoin = [ - "item i on i.item# = r.item#", - "pubdate_inverted p on p.bib# = r.bib#", + 'item i on i.item# = r.item#', + 'pubdate_inverted p on p.bib# = r.bib#', ]; // Where @@ -618,8 +618,8 @@ protected function getHoldsSQL($patron) ]; $sqlOrder = [ - "SORT", - "t.processed", + 'SORT', + 't.processed', ]; $sqlArray = [ @@ -652,14 +652,14 @@ protected function processHoldsRow($row) // Convert Horizon Format to display format if (!empty($row['HOLD_EXPIRE'])) { $expire = $this->dateFormat->convertToDisplayDate( - "M d Y", + 'M d Y', trim($row['HOLD_EXPIRE']) ); } elseif (!empty($row['REQUEST_EXPIRE'])) { // If there is no Hold Expiration date fall back to the // Request Expiration date. $expire = $this->dateFormat->convertToDisplayDate( - "M d Y", + 'M d Y', trim($row['REQUEST_EXPIRE']) ); } elseif ($row['STATUS'] == 2) { @@ -671,7 +671,7 @@ protected function processHoldsRow($row) } if (!empty($row['CREATED'])) { $create = $this->dateFormat->convertToDisplayDate( - "M d Y", + 'M d Y', trim($row['CREATED']) ); } @@ -740,65 +740,65 @@ public function getMyHolds($patron) */ public function getMyFines($patron) { - $sql = " select bu.amount as AMOUNT " . - " , coalesce( " . - " convert(varchar(10), " . + $sql = ' select bu.amount as AMOUNT ' . + ' , coalesce( ' . + ' convert(varchar(10), ' . " dateadd(dd, i.last_cko_date, '01jan70'), " . - " 101), " . - " convert(varchar(10), " . + ' 101), ' . + ' convert(varchar(10), ' . " dateadd(dd, bu2.date, '01jan70'), " . - " 101)) as CHECKOUT " . - " , bl.descr as FINE " . - " , ( select sum(b2.amount) " . - " from burb b2 " . - " where b2.reference# = bu.reference# " . - " group by b2.reference#) as BALANCE " . - " , convert(varchar(10), " . + ' 101)) as CHECKOUT ' . + ' , bl.descr as FINE ' . + ' , ( select sum(b2.amount) ' . + ' from burb b2 ' . + ' where b2.reference# = bu.reference# ' . + ' group by b2.reference#) as BALANCE ' . + ' , convert(varchar(10), ' . " dateadd(dd, bu.date, '01jan70'), " . - " 101) as CREATEDATE " . - " , coalesce( " . - " convert(varchar(10), " . + ' 101) as CREATEDATE ' . + ' , coalesce( ' . + ' convert(varchar(10), ' . " dateadd(dd, i.due_date, '01jan70'), " . - " 101), " . - " convert(varchar(10), " . + ' 101), ' . + ' convert(varchar(10), ' . " dateadd(dd, bu3.date, '01jan70'), " . - " 101)) as DUEDATE " . - " , i2.bib# as ID " . - " , coalesce (t.processed, bu4.comment) as TITLE " . - " , case when bl.amount_type = 0 " . - " then 0 " . - " else 1 " . - " end as FEEBLOCK " . - " from burb bu " . - " join block bl " . - " on bl.block = bu.block " . - " join borrower_barcode bb " . - " on bb.borrower# = bu.borrower# " . - "left join item i " . - " on i.item# = bu.item# " . - " and i.borrower# = bu.borrower# " . - "left join item i2 " . - " on i2.item# = bu.item# " . - "left join burb bu2 " . - " on bu2.reference# = bu.reference# " . + ' 101)) as DUEDATE ' . + ' , i2.bib# as ID ' . + ' , coalesce (t.processed, bu4.comment) as TITLE ' . + ' , case when bl.amount_type = 0 ' . + ' then 0 ' . + ' else 1 ' . + ' end as FEEBLOCK ' . + ' from burb bu ' . + ' join block bl ' . + ' on bl.block = bu.block ' . + ' join borrower_barcode bb ' . + ' on bb.borrower# = bu.borrower# ' . + 'left join item i ' . + ' on i.item# = bu.item# ' . + ' and i.borrower# = bu.borrower# ' . + 'left join item i2 ' . + ' on i2.item# = bu.item# ' . + 'left join burb bu2 ' . + ' on bu2.reference# = bu.reference# ' . " and bu2.block = 'infocko' " . - "left join burb bu3 " . - " on bu3.reference# = bu.reference# " . + 'left join burb bu3 ' . + ' on bu3.reference# = bu.reference# ' . " and bu3.block = 'infodue' " . - "left join title t " . - " on t.bib# = i2.bib# " . - "left join burb bu4 " . - " on bu4.reference# = bu.reference# " . - " and bu4.ord = 0 " . + 'left join title t ' . + ' on t.bib# = i2.bib# ' . + 'left join burb bu4 ' . + ' on bu4.reference# = bu.reference# ' . + ' and bu4.ord = 0 ' . " and bu4.block in ('l', 'LostPro','fine','he') " . " where bb.bbarcode = '" . addslashes($patron['id']) . "' " . - " and bu.ord = 0 " . - " and bl.pac_display = 1 " . - " order by FEEBLOCK desc " . - " , bu.item# " . - " , TITLE " . - " , bu.block " . - " , bu.date"; + ' and bu.ord = 0 ' . + ' and bl.pac_display = 1 ' . + ' order by FEEBLOCK desc ' . + ' , bu.item# ' . + ' , TITLE ' . + ' , bu.block ' . + ' , bu.date'; try { $sqlStmt = $this->db->query($sql); @@ -839,16 +839,16 @@ public function getMyFines($patron) public function getMyProfile($patron) { $profile = []; - $sql = "select name_reconstructed as FULLNAME, address1 as ADDRESS1, " . - "city_st.descr as ADDRESS2, postal_code as ZIP, phone_no as PHONE " . - "from borrower " . - "left outer join borrower_phone on " . - "borrower_phone.borrower#=borrower.borrower# " . - "inner join borrower_address on " . - "borrower_address.borrower#=borrower.borrower# " . - "inner join city_st on city_st.city_st=borrower_address.city_st " . - "inner join borrower_barcode on " . - "borrower_barcode.borrower# = borrower.borrower# " . + $sql = 'select name_reconstructed as FULLNAME, address1 as ADDRESS1, ' . + 'city_st.descr as ADDRESS2, postal_code as ZIP, phone_no as PHONE ' . + 'from borrower ' . + 'left outer join borrower_phone on ' . + 'borrower_phone.borrower#=borrower.borrower# ' . + 'inner join borrower_address on ' . + 'borrower_address.borrower#=borrower.borrower# ' . + 'inner join city_st on city_st.city_st=borrower_address.city_st ' . + 'inner join borrower_barcode on ' . + 'borrower_barcode.borrower# = borrower.borrower# ' . "where borrower_barcode.bbarcode = '" . addslashes($patron['id']) . "'"; try { @@ -892,32 +892,32 @@ protected function getTransactionSQL($patron) // Expressions $sqlExpressions = [ "convert(varchar(12), dateadd(dd, i.due_date, '01 jan 1970')) " . - "as DUEDATE", - "i.bib# as BIB_NUM", - "i.ibarcode as ITEM_BARCODE", - "i.n_renewals as RENEW", - "r.bib_queue_ord as REQUEST", - "i.volume as VOLUME", - "p.pubdate as PUBLICATION_YEAR", - "t.processed as TITLE", - "i.item# as ITEM_NUM", + 'as DUEDATE', + 'i.bib# as BIB_NUM', + 'i.ibarcode as ITEM_BARCODE', + 'i.n_renewals as RENEW', + 'r.bib_queue_ord as REQUEST', + 'i.volume as VOLUME', + 'p.pubdate as PUBLICATION_YEAR', + 't.processed as TITLE', + 'i.item# as ITEM_NUM', ]; // From - $sqlFrom = ["circ c"]; + $sqlFrom = ['circ c']; // Join $sqlJoin = [ - "item i on i.item#=c.item#", - "borrower b on b.borrower# = c.borrower#", - "borrower_barcode bb on bb.borrower# = c.borrower#", - "title t on t.bib# = i.bib#", + 'item i on i.item#=c.item#', + 'borrower b on b.borrower# = c.borrower#', + 'borrower_barcode bb on bb.borrower# = c.borrower#', + 'title t on t.bib# = i.bib#', ]; // Left Outer Join $sqlLeftOuterJoin = [ - "request r on r.item#=c.item#", - "pubdate_inverted p on p.bib# = i.bib#", + 'request r on r.item#=c.item#', + 'pubdate_inverted p on p.bib# = i.bib#', ]; // Where @@ -926,8 +926,8 @@ protected function getTransactionSQL($patron) // Order by $sqlOrder = [ - "i.due_date", - "t.processed", + 'i.due_date', + 't.processed', ]; $sqlArray = [ @@ -957,19 +957,19 @@ protected function processTransactionsRow($row) // Convert Horizon Format to display format if (!empty($row['DUEDATE'])) { $dueDate = $this->dateFormat->convertToDisplayDate( - "M d Y", + 'M d Y', trim($row['DUEDATE']) ); $now = time(); $dueTimeStamp = $this->dateFormat->convertFromDisplayDate( - "U", + 'U', $dueDate ); if (is_numeric($dueTimeStamp)) { if ($now > $dueTimeStamp) { - $dueStatus = "overdue"; + $dueStatus = 'overdue'; } elseif ($now > $dueTimeStamp - (1 * 24 * 60 * 60)) { - $dueStatus = "due"; + $dueStatus = 'due'; } } } @@ -1059,21 +1059,21 @@ public function getFunds() public function getNewItems($page, $limit, $daysOld, $fundId = null) { // This functionality first appeared in Horizon 7.4 - check our version - $hzVersionRequired = "7.4.0.0"; + $hzVersionRequired = '7.4.0.0'; if ($this->checkHzVersion($hzVersionRequired)) { // Set the Sybase or MSSQL rowcount limit (TODO: account for $page) $limitsql = "set rowcount {$limit}"; // for Sybase ASE 12.5 : "set rowcount $limit" // This is the actual query for IDs. - $newsql = " select nb.bib# " - . " from new_bib nb " - . " join bib_control bc " - . " on bc.bib# = nb.bib# " - . " and bc.staff_only = 0 " - . " where nb.date >= " + $newsql = ' select nb.bib# ' + . ' from new_bib nb ' + . ' join bib_control bc ' + . ' on bc.bib# = nb.bib# ' + . ' and bc.staff_only = 0 ' + . ' where nb.date >= ' . " datediff(dd, '01JAN1970', getdate()) - {$daysOld} " - . "order by nb.date desc "; + . 'order by nb.date desc '; $results = []; @@ -1113,7 +1113,7 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) */ protected function checkHzVersion($hzVersionRequired) { - $checkHzVersionSQL = "select database_revision from matham"; + $checkHzVersionSQL = 'select database_revision from matham'; $hzVersionFound = ''; try { @@ -1164,9 +1164,9 @@ public function getSuppressedRecords() { $list = []; - $sql = "select bc.bib#" . - " from bib_control bc" . - " where bc.staff_only = 1"; + $sql = 'select bc.bib#' . + ' from bib_control bc' . + ' where bc.staff_only = 1'; try { $sqlStmt = $this->db->query($sql); foreach ($sqlStmt as $row) { diff --git a/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php b/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php index 8a9aa630595..71519629dc6 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php +++ b/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php @@ -168,7 +168,7 @@ protected function determineRenewability($requested) $renewData['renewable'] = ($requested == 0) ? true : false; if (!$renewData['renewable']) { - $renewData['message'] = "renew_item_requested"; + $renewData['message'] = 'renew_item_requested'; } else { $renewData['message'] = false; } @@ -222,28 +222,28 @@ public function getPickUpLocations($patron, $holdDetails = null) if ($this->wsPickUpLocations == false) { // Select $sqlSelect = [ - "l.location LOCATIONID", - "l.name LOCATIONDISPLAY", + 'l.location LOCATIONID', + 'l.name LOCATIONDISPLAY', ]; // From - $sqlFrom = ["pickup_location_sort pls"]; + $sqlFrom = ['pickup_location_sort pls']; // Join $sqlJoin = [ - "location l on l.location = pls.pickup_location", - "borrower b on b.location = pls.location", - "borrower_barcode bb on bb.borrower# = b.borrower#", + 'location l on l.location = pls.pickup_location', + 'borrower b on b.location = pls.location', + 'borrower_barcode bb on bb.borrower# = b.borrower#', ]; // Where $sqlWhere = [ - "pls.display = 1", - "bb.bbarcode=\"" . addslashes($patron['id']) . "\"", + 'pls.display = 1', + 'bb.bbarcode="' . addslashes($patron['id']) . '"', ]; // Order by - $sqlOrder = ["l.name"]; + $sqlOrder = ['l.name']; $sqlArray = [ 'expressions' => $sqlSelect, @@ -298,16 +298,16 @@ public function getDefaultPickUpLocation($patron = false, $holdDetails = null) { if ($this->wsDefaultPickUpLocation == false) { // Select - $sqlSelect = ["b.location LOCATION"]; + $sqlSelect = ['b.location LOCATION']; // From - $sqlFrom = ["borrower b"]; + $sqlFrom = ['borrower b']; // Join - $sqlJoin = ["borrower_barcode bb on bb.borrower# = b.borrower#"]; + $sqlJoin = ['borrower_barcode bb on bb.borrower# = b.borrower#']; // Where - $sqlWhere = ["bb.bbarcode=\"" . addslashes($patron['id']) . "\""]; + $sqlWhere = ['bb.bbarcode="' . addslashes($patron['id']) . '"']; $sqlArray = [ 'expressions' => $sqlSelect, @@ -345,7 +345,7 @@ public function getDefaultPickUpLocation($patron = false, $holdDetails = null) * * @return obj A Simple XML Object loaded with the xml data returned by the API */ - protected function makeRequest($params = false, $mode = "GET") + protected function makeRequest($params = false, $mode = 'GET') { $queryString = []; // Build Url Base @@ -355,18 +355,18 @@ protected function makeRequest($params = false, $mode = "GET") foreach ($params as $key => $param) { if (is_array($param)) { foreach ($param as $sub) { - $queryString[] = $key . "=" . urlencode($sub); + $queryString[] = $key . '=' . urlencode($sub); } } else { // This is necessary as Horizon expects spaces to be represented by // "+" rather than the url_encode "%20" for Pick Up Locations - $queryString[] = $key . "=" . - str_replace("%20", "+", urlencode($param)); + $queryString[] = $key . '=' . + str_replace('%20', '+', urlencode($param)); } } // Build Params - $urlParams .= "?" . implode("&", $queryString); + $urlParams .= '?' . implode('&', $queryString); // Create Proxy Request $client = $this->httpService->createClient($urlParams, $mode); @@ -398,9 +398,9 @@ protected function makeRequest($params = false, $mode = "GET") */ protected function getSession() { - $params = ["profile" => $this->wsProfile, - "menu" => "account", - "GetXML" => "true", + $params = ['profile' => $this->wsProfile, + 'menu' => 'account', + 'GetXML' => 'true', ]; $response = $this->makeRequest($params); @@ -428,19 +428,19 @@ protected function registerUser($userBarcode, $userPassword) // Get Session $session = $this->getSession(); - $params = ["session" => $session, - "profile" => $this->wsProfile, - "menu" => "account", - "sec1" => $userBarcode, - "sec2" => $userPassword, - "GetXML" => "true", + $params = ['session' => $session, + 'profile' => $this->wsProfile, + 'menu' => 'account', + 'sec1' => $userBarcode, + 'sec2' => $userPassword, + 'GetXML' => 'true', ]; $response = $this->makeRequest($params); $auth = (string)$response->security->auth; - if ($auth == "true") { + if ($auth == 'true') { return $session; } @@ -467,21 +467,21 @@ public function checkRequestIsValid($bibId, $itemData, $patron) ); if ($session) { $params = [ - "session" => $session, - "profile" => $this->wsProfile, - "bibkey" => $bibId, - "aspect" => "submenu13", - "lang" => "eng", - "menu" => "request", - "submenu" => "none", - "source" => "~!horizon", - "uri" => "", - "GetXML" => "true", + 'session' => $session, + 'profile' => $this->wsProfile, + 'bibkey' => $bibId, + 'aspect' => 'submenu13', + 'lang' => 'eng', + 'menu' => 'request', + 'submenu' => 'none', + 'source' => '~!horizon', + 'uri' => '', + 'GetXML' => 'true', ]; // set itemkey only if available and level is not title-level if ($itemData['item_id'] != '' && $itemData['level'] != 'title') { - $params += ["itemkey" => $itemData['item_id']]; + $params += ['itemkey' => $itemData['item_id']]; } $initResponse = $this->makeRequest($params); @@ -504,11 +504,11 @@ public function checkRequestIsValid($bibId, $itemData, $patron) */ protected function getItems($session) { - $params = ["session" => $session, - "profile" => $this->wsProfile, - "menu" => "account", - "submenu" => "itemsout", - "GetXML" => "true", + $params = ['session' => $session, + 'profile' => $this->wsProfile, + 'menu' => 'account', + 'submenu' => 'itemsout', + 'GetXML' => 'true', ]; $response = $this->makeRequest($params); @@ -532,13 +532,13 @@ protected function getItems($session) */ protected function renewItems($session, $items) { - $params = ["session" => $session, - "profile" => $this->wsProfile, - "menu" => "account", - "submenu" => "itemsout", - "renewitemkeys" => $items, - "renewitems" => "Renew", - "GetXML" => "true", + $params = ['session' => $session, + 'profile' => $this->wsProfile, + 'menu' => 'account', + 'submenu' => 'itemsout', + 'renewitemkeys' => $items, + 'renewitems' => 'Renew', + 'GetXML' => 'true', ]; $response = $this->makeRequest($params); @@ -563,42 +563,42 @@ protected function renewItems($session, $items) */ protected function placeRequest($session, $requestDetails) { - $params = ["session" => $session, - "profile" => $this->wsProfile, - "bibkey" => $requestDetails['bibId'], - "aspect" => "submenu13", - "lang" => "eng", - "menu" => "request", - "submenu" => "none", - "source" => "~!horizon", - "uri" => "", - "GetXML" => "true", + $params = ['session' => $session, + 'profile' => $this->wsProfile, + 'bibkey' => $requestDetails['bibId'], + 'aspect' => 'submenu13', + 'lang' => 'eng', + 'menu' => 'request', + 'submenu' => 'none', + 'source' => '~!horizon', + 'uri' => '', + 'GetXML' => 'true', ]; // set itemkey only if available if ($requestDetails['itemId'] != '') { - $params += ["itemkey" => $requestDetails['itemId']]; + $params += ['itemkey' => $requestDetails['itemId']]; } $initResponse = $this->makeRequest($params); if ($initResponse->request_confirm) { $confirmParams = [ - "session" => $session, - "profile" => $this->wsProfile, - "bibkey" => $requestDetails['bibId'], - "aspect" => "advanced", - "lang" => "eng", - "menu" => "request", - "submenu" => "none", - "source" => "~!horizon", - "uri" => "", - "link" => "direct", - "request_finish" => "Request", - "cl" => "PlaceRequestjsp", - "pickuplocation" => $requestDetails['pickuplocation'], - "notifyby" => $requestDetails['notify'], - "GetXML" => "true", + 'session' => $session, + 'profile' => $this->wsProfile, + 'bibkey' => $requestDetails['bibId'], + 'aspect' => 'advanced', + 'lang' => 'eng', + 'menu' => 'request', + 'submenu' => 'none', + 'source' => '~!horizon', + 'uri' => '', + 'link' => 'direct', + 'request_finish' => 'Request', + 'cl' => 'PlaceRequestjsp', + 'pickuplocation' => $requestDetails['pickuplocation'], + 'notifyby' => $requestDetails['notify'], + 'GetXML' => 'true', ]; $request = $this->makeRequest($confirmParams); @@ -606,12 +606,12 @@ protected function placeRequest($session, $requestDetails) if ($request->request_success) { $response = [ 'success' => true, - 'status' => "hold_success", + 'status' => 'hold_success', ]; } else { $response = [ 'success' => false, - 'status' => "hold_error_fail", + 'status' => 'hold_error_fail', ]; } } else { @@ -621,7 +621,7 @@ protected function placeRequest($session, $requestDetails) } $response = [ 'success' => false, - 'status' => "hold_error_fail", + 'status' => 'hold_error_fail', 'sysMessage' => $sysMessage, ]; } @@ -643,13 +643,13 @@ protected function cancelRequest($session, $data) { $responseItems = []; - $params = ["session" => $session, - "profile" => $this->wsProfile, - "lang" => "eng", - "menu" => "account", - "submenu" => "holds", - "cancelhold" => "Cancel Request", - "GetXML" => "true", + $params = ['session' => $session, + 'profile' => $this->wsProfile, + 'lang' => 'eng', + 'menu' => 'account', + 'submenu' => 'holds', + 'cancelhold' => 'Cancel Request', + 'GetXML' => 'true', ]; $cancelData = []; @@ -657,7 +657,7 @@ protected function cancelRequest($session, $data) $cancelData[] = $values['bib_id'] . ':' . $values['item_id']; } - $params += ["waitingholdselected" => $cancelData]; + $params += ['waitingholdselected' => $cancelData]; $response = $this->makeRequest($params); @@ -679,11 +679,11 @@ protected function cancelRequest($session, $data) // If the bib id is matched, the cancel must have failed if (in_array($values['bib_id'], $keys)) { $responseItems[$itemID] = [ - 'success' => false, 'status' => "hold_cancel_fail", + 'success' => false, 'status' => 'hold_cancel_fail', ]; } else { $responseItems[$itemID] = [ - 'success' => true, 'status' => "hold_cancel_success", + 'success' => true, 'status' => 'hold_cancel_success', ]; $count = $count + 1; @@ -698,7 +698,7 @@ protected function cancelRequest($session, $data) $itemID = $values['item_id']; $responseItems[$itemID] = [ 'success' => false, - 'status' => "hold_cancel_fail", + 'status' => 'hold_cancel_fail', 'sysMessage' => $message, ]; } @@ -748,7 +748,7 @@ public function placeHold($holdDetails) $response = $this->placeRequest($session, $requestDetails); } else { $response = [ - 'success' => false, 'status' => "authentication_error_admin", + 'success' => false, 'status' => 'authentication_error_admin', ]; } @@ -774,8 +774,8 @@ public function cancelHolds($cancelDetails) $userPassword = $cancelDetails['patron']['cat_password']; foreach ($details as $cancelItem) { - [$bibID, $itemID] = explode("|", $cancelItem); - $cancelIDs[] = ["bib_id" => $bibID, "item_id" => $itemID]; + [$bibID, $itemID] = explode('|', $cancelItem); + $cancelIDs[] = ['bib_id' => $bibID, 'item_id' => $itemID]; } // Register Account @@ -784,7 +784,7 @@ public function cancelHolds($cancelDetails) $response = $this->cancelRequest($session, $cancelIDs); } else { $response = [ - 'success' => false, 'sysMessage' => "authentication_error_admin", + 'success' => false, 'sysMessage' => 'authentication_error_admin', ]; } return $response; @@ -835,7 +835,7 @@ protected function processRenewals($renewIDs, $origData, $renewData) } else { $response['details'][$ikey] = [ 'item_id' => $ikey, - 'new_date' => "", + 'new_date' => '', 'success' => false, 'sysMessage' => $renewerror, ]; @@ -872,7 +872,7 @@ public function renewMyItems($renewDetails) if ($origData) { // Build Params foreach ($renewals as $item) { - [$itemID, $barcode] = explode("|", $item); + [$itemID, $barcode] = explode('|', $item); $renewItemKeys[] = $barcode; $renewIDs[] = $itemID; } @@ -889,7 +889,7 @@ public function renewMyItems($renewDetails) } } - return ['blocks' => ["authentication_error_admin"]]; + return ['blocks' => ['authentication_error_admin']]; } /** @@ -906,7 +906,7 @@ public function renewMyItems($renewDetails) */ public function getRenewDetails($checkOutDetails) { - return $checkOutDetails['item_id'] . "|" . $checkOutDetails['barcode']; + return $checkOutDetails['item_id'] . '|' . $checkOutDetails['barcode']; } /** @@ -926,7 +926,7 @@ public function getRenewDetails($checkOutDetails) */ public function getCancelHoldDetails($holdDetails, $patron = []) { - $cancelDetails = $holdDetails['id'] . "|" . $holdDetails['item_id']; + $cancelDetails = $holdDetails['id'] . '|' . $holdDetails['item_id']; return $cancelDetails; } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/Innovative.php b/module/VuFind/src/VuFind/ILS/Driver/Innovative.php index a1399158bff..f6bf7d13e14 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Innovative.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Innovative.php @@ -148,17 +148,17 @@ public function getStatus($id) // '") + 1); + $r = substr($r, strpos($r, '>') + 1); // strip out the next table closing tag and everything after it. - $r = substr($r, 0, stripos($r, "]*)>/", $r); + $rows = preg_split('/]*)>/', $r); $count = 0; - $keys = array_pad([], 10, ""); + $keys = array_pad([], 10, ''); $loc_col_name = $this->config['OPAC']['location_column']; $call_col_name = $this->config['OPAC']['call_no_column']; @@ -172,18 +172,18 @@ public function getStatus($id) foreach ($rows as $row) { // Split up the contents of the row based on the th or td tag, excluding // the tags themselves. - $cols = preg_split("/]*)>/", $row); + $cols = preg_split('/]*)>/', $row); // for each th or td section, do the following. for ($i = 0; $i < count($cols); $i++) { // replace non blocking space encodings with a space. - $cols[$i] = str_replace(" ", " ", $cols[$i]); + $cols[$i] = str_replace(' ', ' ', $cols[$i]); // remove html comment tags - $cols[$i] = preg_replace("/)]*)-->/", "", $cols[$i]); + $cols[$i] = preg_replace('/)]*)-->/', '', $cols[$i]); // Remove closing th or td tag, trim whitespace and decode html // entities $cols[$i] = html_entity_decode( - trim(substr($cols[$i], 0, stripos($cols[$i], " -1) { if (stripos($cols[$i], (string)$stat_avail) > -1) { - $ret[$count - 2]['status'] = "Available On Shelf"; + $ret[$count - 2]['status'] = 'Available On Shelf'; $ret[$count - 2]['availability'] = 1; } else { - $ret[$count - 2]['status'] = "Available to request"; + $ret[$count - 2]['status'] = 'Available to request'; $ret[$count - 2]['availability'] = 0; } if (stripos($cols[$i], (string)$stat_due) > -1) { @@ -224,7 +224,7 @@ public function getStatus($id) + strlen($stat_due) ) ); - $t = substr($t, 0, stripos($t, " ")); + $t = substr($t, 0, stripos($t, ' ')); $ret[$count - 2]['duedate'] = $t; } } @@ -376,7 +376,7 @@ public function patronLogin($username, $password) ); // search for successful response of "RETCOD=0" - if (stripos($result, "RETCOD=0") == -1) { + if (stripos($result, 'RETCOD=0') == -1) { // pin did not match, can look up specific error to return // more useful info. return null; @@ -392,9 +392,9 @@ public function patronLogin($username, $password) $api_data = ['PBARCODE' => false]; foreach ($api_array_lines as $api_line) { - $api_line = str_replace("p=", "peq", $api_line); - $api_line_arr = explode("=", $api_line); - $regex_match = ["/\[(.*?)\]/","/\s/","/#/"]; + $api_line = str_replace('p=', 'peq', $api_line); + $api_line_arr = explode('=', $api_line); + $regex_match = ["/\[(.*?)\]/","/\s/",'/#/']; $regex_replace = ['','','NUM']; $key = trim( preg_replace($regex_match, $regex_replace, $api_line_arr[0]) @@ -422,10 +422,10 @@ public function patronLogin($username, $password) $ret['college'] = $api_data['HOMELIBR']; $ret['homelib'] = $api_data['HOMELIBR']; // replace $ separator in III addresses with newline - $ret['address1'] = str_replace("$", ", ", $api_data['ADDRESS']); - $ret['address2'] = str_replace("$", ", ", $api_data['ADDRESS2']); + $ret['address1'] = str_replace('$', ', ', $api_data['ADDRESS']); + $ret['address2'] = str_replace('$', ', ', $api_data['ADDRESS2']); preg_match( - "/([0-9]{5}|[0-9]{5}-[0-9]{4})[ ]*$/", + '/([0-9]{5}|[0-9]{5}-[0-9]{4})[ ]*$/', $api_data['ADDRESS'], $zipmatch ); diff --git a/module/VuFind/src/VuFind/ILS/Driver/Koha.php b/module/VuFind/src/VuFind/ILS/Driver/Koha.php index 8561688ff5f..5ccc7b1ec87 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Koha.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Koha.php @@ -196,19 +196,19 @@ public function getHolding($id, array $patron = null, array $options = []) $duedate = $status = ''; $inum = 0; $loc = $shelf = ''; - $sql = "select itemnumber as ITEMNO, location as LOCATION, " . - "holdingbranch as HLDBRNCH, reserves as RESERVES, itemcallnumber as " . - "CALLNO, barcode as BARCODE, copynumber as COPYNO, " . - "enumchron AS ENUMCHRON, notforloan as NOTFORLOAN" . - " from items where biblionumber = :id" . - " order by itemnumber"; + $sql = 'select itemnumber as ITEMNO, location as LOCATION, ' . + 'holdingbranch as HLDBRNCH, reserves as RESERVES, itemcallnumber as ' . + 'CALLNO, barcode as BARCODE, copynumber as COPYNO, ' . + 'enumchron AS ENUMCHRON, notforloan as NOTFORLOAN' . + ' from items where biblionumber = :id' . + ' order by itemnumber'; try { $itemSqlStmt = $this->db->prepare($sql); $itemSqlStmt->execute([':id' => $id]); foreach ($itemSqlStmt->fetchAll() as $rowItem) { $inum = $rowItem['ITEMNO']; - $sql = "select date_due as DUEDATE from issues " . - "where itemnumber = :inum"; + $sql = 'select date_due as DUEDATE from issues ' . + 'where itemnumber = :inum'; switch ($rowItem['NOTFORLOAN']) { case 0: @@ -238,8 +238,8 @@ public function getHolding($id, array $patron = null, array $options = []) //Retrieving the full branch name if (null != ($loc = $rowItem['HLDBRNCH'])) { - $sql = "select branchname as BNAME from branches where " . - "branchcode = :loc"; + $sql = 'select branchname as BNAME from branches where ' . + 'branchcode = :loc'; $locSqlStmt = $this->db->prepare($sql); $locSqlStmt->execute([':loc' => $loc]); $row = $locSqlStmt->fetch(); @@ -247,14 +247,14 @@ public function getHolding($id, array $patron = null, array $options = []) $loc = $row['BNAME']; } } else { - $loc = "Unknown"; + $loc = 'Unknown'; } //Retrieving the location (shelf types) $shelf = $rowItem['LOCATION']; $loc = (null != $shelf) - ? $loc . ": " . ($this->locCodes[$shelf] ?? $shelf) - : $loc . ": " . 'Unknown'; + ? $loc . ': ' . ($this->locCodes[$shelf] ?? $shelf) + : $loc . ': ' . 'Unknown'; //A default value is stored for null $holding[] = [ @@ -319,16 +319,16 @@ public function getMyFines($patron) $fineLst = []; try { $id = $patron['id']; - $sql = "select round(accountlines.amount*100) as AMOUNT, " . - "issues.issuedate as CHECKOUT, " . - "accountlines.description as FINE, " . - "round(accountlines.amountoutstanding*100) as BALANCE, " . - "issues.date_due as DUEDATE, items.biblionumber as BIBNO " . - "from accountlines join issues on " . - "accountlines.borrowernumber = issues.borrowernumber and " . - "accountlines.itemnumber = issues.itemnumber " . - "join items on accountlines.itemnumber = items.itemnumber " . - "where accountlines.borrowernumber = :id"; + $sql = 'select round(accountlines.amount*100) as AMOUNT, ' . + 'issues.issuedate as CHECKOUT, ' . + 'accountlines.description as FINE, ' . + 'round(accountlines.amountoutstanding*100) as BALANCE, ' . + 'issues.date_due as DUEDATE, items.biblionumber as BIBNO ' . + 'from accountlines join issues on ' . + 'accountlines.borrowernumber = issues.borrowernumber and ' . + 'accountlines.itemnumber = issues.itemnumber ' . + 'join items on accountlines.itemnumber = items.itemnumber ' . + 'where accountlines.borrowernumber = :id'; $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute([':id' => $id]); foreach ($sqlStmt->fetchAll() as $row) { @@ -365,12 +365,12 @@ public function getMyHolds($patron) $holdLst = []; try { $id = $patron['id']; - $sql = "select reserves.biblionumber as BIBNO, " . - "branches.branchname as BRNAME, " . - "reserves.expirationdate as EXDATE, " . - "reserves.reservedate as RSVDATE from reserves " . - "join branches on reserves.branchcode = branches.branchcode " . - "where reserves.borrowernumber = :id"; + $sql = 'select reserves.biblionumber as BIBNO, ' . + 'branches.branchname as BRNAME, ' . + 'reserves.expirationdate as EXDATE, ' . + 'reserves.reservedate as RSVDATE from reserves ' . + 'join branches on reserves.branchcode = branches.branchcode ' . + 'where reserves.borrowernumber = :id'; $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute([':id' => $id]); foreach ($sqlStmt->fetchAll() as $row) { @@ -404,9 +404,9 @@ public function getMyProfile($patron) $profile = []; try { $id = $patron['id']; - $sql = "select address as ADDR1, address2 as ADDR2, zipcode as ZIP, " . - "phone as PHONE, categorycode as GRP from borrowers " . - "where borrowernumber = :id"; + $sql = 'select address as ADDR1, address2 as ADDR2, zipcode as ZIP, ' . + 'phone as PHONE, categorycode as GRP from borrowers ' . + 'where borrowernumber = :id'; $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute([':id' => $id]); $row = $sqlStmt->fetch(); @@ -447,10 +447,10 @@ public function getMyTransactions($patron) $row = $sql = $sqlStmt = ''; try { $id = $patron['id']; - $sql = "select issues.date_due as DUEDATE, items.biblionumber as " . - "BIBNO, items.barcode BARCODE, issues.renewals as RENEWALS " . - "from issues join items on issues.itemnumber = items.itemnumber " . - "where issues.borrowernumber = :id"; + $sql = 'select issues.date_due as DUEDATE, items.biblionumber as ' . + 'BIBNO, items.barcode BARCODE, issues.renewals as RENEWALS ' . + 'from issues join items on issues.itemnumber = items.itemnumber ' . + 'where issues.borrowernumber = :id'; $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute([':id' => $id]); foreach ($sqlStmt->fetchAll() as $row) { @@ -483,10 +483,10 @@ public function getAccountBlocks($patron) try { $id = $patron['id']; - $sql = "select type as TYPE, comment as COMMENT " . - "from borrower_debarments " . - "where (expiration is null or expiration >= NOW()) " . - "and borrowernumber = :id"; + $sql = 'select type as TYPE, comment as COMMENT ' . + 'from borrower_debarments ' . + 'where (expiration is null or expiration >= NOW()) ' . + 'and borrowernumber = :id'; $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute([':id' => $id]); @@ -533,8 +533,8 @@ public function getMyTransactionHistory($patron, $params) $id = $patron['id']; // Get total count first - $sql = "select count(*) as cnt from old_issues " . - "where old_issues.borrowernumber = :id"; + $sql = 'select count(*) as cnt from old_issues ' . + 'where old_issues.borrowernumber = :id'; $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute([':id' => $id]); $totalCount = $sqlStmt->fetch()['cnt']; @@ -560,14 +560,14 @@ public function getMyTransactionHistory($patron, $params) } else { $sort = 'ISSUEDATE desc'; } - $sql = "select old_issues.issuedate as ISSUEDATE, " . - "old_issues.date_due as DUEDATE, items.biblionumber as " . - "BIBNO, items.barcode BARCODE, old_issues.returndate as RETURNED, " . - "biblio.title as TITLE " . - "from old_issues join items " . - "on old_issues.itemnumber = items.itemnumber " . - "join biblio on items.biblionumber = biblio.biblionumber " . - "where old_issues.borrowernumber = :id " . + $sql = 'select old_issues.issuedate as ISSUEDATE, ' . + 'old_issues.date_due as DUEDATE, items.biblionumber as ' . + 'BIBNO, items.barcode BARCODE, old_issues.returndate as RETURNED, ' . + 'biblio.title as TITLE ' . + 'from old_issues join items ' . + 'on old_issues.itemnumber = items.itemnumber ' . + 'join biblio on items.biblionumber = biblio.biblionumber ' . + 'where old_issues.borrowernumber = :id ' . "order by $sort limit $start,$limit"; $sqlStmt = $this->db->prepare($sql); @@ -681,7 +681,7 @@ public function patronLogin($username, $password) $stored_hash = ''; try { - $sql = "select password from borrowers where userid = :username"; + $sql = 'select password from borrowers where userid = :username'; $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute([':username' => $username]); $row = $sqlStmt->fetch(); @@ -694,7 +694,7 @@ public function patronLogin($username, $password) $this->throwAsIlsException($e); } - if ("$2a$" == substr($stored_hash, 0, 4)) { + if ('$2a$' == substr($stored_hash, 0, 4)) { // Newer Koha version that uses bcrypt $db_pwd = crypt($password, $stored_hash); } else { @@ -704,14 +704,14 @@ public function patronLogin($username, $password) $db_pwd = rtrim(base64_encode(pack('H*', md5($password))), '='); } - $sql = "select borrowernumber as ID, firstname as FNAME, " . - "surname as LNAME, email as EMAIL from borrowers " . - "where userid = :username"; + $sql = 'select borrowernumber as ID, firstname as FNAME, ' . + 'surname as LNAME, email as EMAIL from borrowers ' . + 'where userid = :username'; $parameters = [':username' => $username]; if ($this->validatePasswords) { - $sql .= " and password = :db_pwd"; + $sql .= ' and password = :db_pwd'; $parameters[':db_pwd'] = $db_pwd; } @@ -754,7 +754,7 @@ public function patronLogin($username, $password) public function displayDate($date) { if (empty($date)) { - return ""; + return ''; } elseif (preg_match("/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d$/", $date) === 1) { // YYYY-MM-DD HH:MM:SS return $this->dateConverter->convertToDisplayDate('Y-m-d H:i:s', $date); @@ -776,7 +776,7 @@ public function displayDate($date) public function displayDateTime($date) { if (empty($date)) { - return ""; + return ''; } elseif (preg_match("/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d$/", $date) === 1) { // YYYY-MM-DD HH:MM:SS return diff --git a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php index 45c86dee30d..1cf66fb2188 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php +++ b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php @@ -190,10 +190,10 @@ public function init() } // Base for API address - $this->host = $this->config['Catalog']['host'] ?? "localhost"; + $this->host = $this->config['Catalog']['host'] ?? 'localhost'; // Storing the base URL of ILS - $this->ilsBaseUrl = $this->config['Catalog']['url'] ?? ""; + $this->ilsBaseUrl = $this->config['Catalog']['url'] ?? ''; // Default location defined in 'KohaILSDI.ini' $this->defaultLocation @@ -223,11 +223,11 @@ public function init() $this->showHomebranch = $this->config['Catalog']['showHomebranch'] ?? false; - $this->debug("Config Summary:"); - $this->debug("DB Host: " . $this->host); - $this->debug("ILS URL: " . $this->ilsBaseUrl); - $this->debug("Locations: " . $this->locations); - $this->debug("Default Location: " . $this->defaultLocation); + $this->debug('Config Summary:'); + $this->debug('DB Host: ' . $this->host); + $this->debug('ILS URL: ' . $this->ilsBaseUrl); + $this->debug('Locations: ' . $this->locations); + $this->debug('Default Location: ' . $this->defaultLocation); // Now override the default with any defined in the `KohaILSDI.ini` config // file @@ -279,20 +279,20 @@ protected function initDb() //Return result set like mysql_fetch_assoc() $this->db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); // set communication enoding to utf8 - $this->db->exec("SET NAMES utf8"); + $this->db->exec('SET NAMES utf8'); // Drop the ONLY_FULL_GROUP_BY entry from sql_mode as it breaks this // ILS Driver on modern - $setSqlModes = $this->db->prepare("SET sql_mode = :sqlMode"); + $setSqlModes = $this->db->prepare('SET sql_mode = :sqlMode'); - $sqlModes = $this->db->query("SELECT @@sql_mode"); + $sqlModes = $this->db->query('SELECT @@sql_mode'); foreach ($sqlModes as $row) { $sqlMode = implode( ',', array_filter( explode(',', $row['@@sql_mode']), function ($mode) { - return $mode != "ONLY_FULL_GROUP_BY"; + return $mode != 'ONLY_FULL_GROUP_BY'; } ) ); @@ -377,9 +377,9 @@ protected function getCacheKey($suffix = null) * * @return string */ - protected function getField($contents, $default = "Unknown") + protected function getField($contents, $default = 'Unknown') { - if ((string)$contents != "") { + if ((string)$contents != '') { return (string)$contents; } else { return $default; @@ -397,17 +397,17 @@ protected function getField($contents, $default = "Unknown") * @throws ILSException * @return obj */ - protected function makeRequest($api_query, $http_method = "GET") + protected function makeRequest($api_query, $http_method = 'GET') { //$url = $this->host . $this->api_path . $api_query; - $url = $this->ilsBaseUrl . "?service=" . $api_query; + $url = $this->ilsBaseUrl . '?service=' . $api_query; $this->debug("URL: '$url'"); $http_headers = [ - "Accept: text/xml", - "Accept-encoding: plain", + 'Accept: text/xml', + 'Accept-encoding: plain', ]; try { @@ -417,12 +417,12 @@ protected function makeRequest($api_query, $http_method = "GET") $client->setHeaders($http_headers); $result = $client->send(); } catch (\Exception $e) { - $this->debug("Result is invalid."); + $this->debug('Result is invalid.'); $this->throwAsIlsException($e); } if (!$result->isSuccess()) { - $this->debug("Result is invalid."); + $this->debug('Result is invalid.'); throw new ILSException('HTTP error'); } $answer = $result->getBody(); @@ -461,10 +461,10 @@ protected function makeRequest($api_query, $http_method = "GET") * @throws ILSException * @return obj */ - protected function makeIlsdiRequest($service, $params, $http_method = "GET") + protected function makeIlsdiRequest($service, $params, $http_method = 'GET') { $start = microtime(true); - $url = $this->ilsBaseUrl . "?service=" . $service; + $url = $this->ilsBaseUrl . '?service=' . $service; foreach ($params as $paramname => $paramvalue) { $url .= "&$paramname=" . urlencode($paramvalue); } @@ -472,8 +472,8 @@ protected function makeIlsdiRequest($service, $params, $http_method = "GET") $this->debug("URL: '$url'"); $http_headers = [ - "Accept: text/xml", - "Accept-encoding: plain", + 'Accept: text/xml', + 'Accept-encoding: plain', ]; try { @@ -482,12 +482,12 @@ protected function makeIlsdiRequest($service, $params, $http_method = "GET") $client->setHeaders($http_headers); $result = $client->send(); } catch (\Exception $e) { - $this->debug("Result is invalid."); + $this->debug('Result is invalid.'); $this->throwAsIlsException($e); } if (!$result->isSuccess()) { - $this->debug("Result is invalid."); + $this->debug('Result is invalid.'); throw new ILSException('HTTP error'); } $end = microtime(true); @@ -521,7 +521,7 @@ protected function toKohaDate(?string $display_date): ?string { // Convert last interest date from display format to Koha format $koha_date = !empty($display_date) - ? $this->dateConverter->convertFromDisplayDate("Y-m-d", $display_date) + ? $this->dateConverter->convertFromDisplayDate('Y-m-d', $display_date) : null; return $koha_date; } @@ -695,13 +695,13 @@ public function placeHold($holdDetails) { $patron = $holdDetails['patron']; $patron_id = $patron['id']; - $request_location = $patron['ip'] ?? "127.0.0.1"; + $request_location = $patron['ip'] ?? '127.0.0.1'; $bib_id = $holdDetails['id']; $item_id = $holdDetails['item_id']; $pickup_location = !empty($holdDetails['pickUpLocation']) ? $holdDetails['pickUpLocation'] : $this->defaultLocation; $level = isset($holdDetails['level']) - && !empty($holdDetails['level']) ? $holdDetails['level'] : "item"; + && !empty($holdDetails['level']) ? $holdDetails['level'] : 'item'; try { $needed_before_date = $this->toKohaDate( @@ -709,37 +709,37 @@ public function placeHold($holdDetails) ); } catch (\Exception $e) { return [ - "success" => false, - "sysMessage" => "hold_date_invalid", + 'success' => false, + 'sysMessage' => 'hold_date_invalid', ]; } - $this->debug("patron: " . print_r($patron, true)); - $this->debug("patron_id: " . $patron_id); - $this->debug("request_location: " . $request_location); - $this->debug("item_id: " . $item_id); - $this->debug("bib_id: " . $bib_id); - $this->debug("pickup loc: " . $pickup_location); - $this->debug("Needed before date: " . $needed_before_date); - $this->debug("Level: " . $level); + $this->debug('patron: ' . print_r($patron, true)); + $this->debug('patron_id: ' . $patron_id); + $this->debug('request_location: ' . $request_location); + $this->debug('item_id: ' . $item_id); + $this->debug('bib_id: ' . $bib_id); + $this->debug('pickup loc: ' . $pickup_location); + $this->debug('Needed before date: ' . $needed_before_date); + $this->debug('Level: ' . $level); // The following check is mainly required for certain old buggy Koha versions // that allowed multiple holds from the same user to the same item - $sql = "select count(*) as RCOUNT from reserves where borrowernumber = :rid " - . "and itemnumber = :iid"; + $sql = 'select count(*) as RCOUNT from reserves where borrowernumber = :rid ' + . 'and itemnumber = :iid'; $reservesSqlStmt = $this->getDb()->prepare($sql); $reservesSqlStmt->execute([':rid' => $patron_id, ':iid' => $item_id]); - $reservesCount = $reservesSqlStmt->fetch()["RCOUNT"]; + $reservesCount = $reservesSqlStmt->fetch()['RCOUNT']; if ($reservesCount > 0) { - $this->debug("Fatal error: Patron has already reserved this item."); + $this->debug('Fatal error: Patron has already reserved this item.'); return [ - "success" => false, - "sysMessage" => "It seems you have already reserved this item.", + 'success' => false, + 'sysMessage' => 'It seems you have already reserved this item.', ]; } - if ($level == "title") { + if ($level == 'title') { $rqString = "HoldTitle&patron_id=$patron_id&bib_id=$bib_id" . "&request_location=$request_location" . "&pickup_location=$pickup_location"; @@ -753,7 +753,7 @@ public function placeHold($holdDetails) $rsp = $this->makeRequest($rqString . $dateString); - if ($rsp->{'code'} == "IllegalParameter" && $dateString != '') { + if ($rsp->{'code'} == 'IllegalParameter' && $dateString != '') { // In older versions of Koha, the date parameters were named differently // and even never implemented, so if we got IllegalParameter, we know // the Koha version is before 20.05 and could retry without expiry_date @@ -783,20 +783,20 @@ public function placeHold($holdDetails) )); } */ - $this->debug("Title: " . $rsp->{'title'}); - $this->debug("Pickup Location: " . $rsp->{'pickup_location'}); - $this->debug("Code: " . $rsp->{'code'}); + $this->debug('Title: ' . $rsp->{'title'}); + $this->debug('Pickup Location: ' . $rsp->{'pickup_location'}); + $this->debug('Code: ' . $rsp->{'code'}); - if ($rsp->{'code'} != "") { - $this->debug("Error Message: " . $rsp->{'message'}); + if ($rsp->{'code'} != '') { + $this->debug('Error Message: ' . $rsp->{'message'}); return [ - "success" => false, - "sysMessage" => $this->getField($rsp->{'code'}) + 'success' => false, + 'sysMessage' => $this->getField($rsp->{'code'}) . $holdDetails['level'], ]; } return [ - "success" => true, + 'success' => true, //"sysMessage" => $message, ]; } @@ -823,8 +823,8 @@ public function getHolding($id, array $patron = null, array $options = []) { $this->debug( "Function getHolding($id, " - . implode(",", (array)$patron) - . ") called" + . implode(',', (array)$patron) + . ') called' ); $started = microtime(true); @@ -856,18 +856,18 @@ public function getHolding($id, array $patron = null, array $options = []) where i.biblionumber = :id AND (av.category = :av_category OR av.category IS NULL) order by i.itemnumber DESC"; - $sqlReserves = "select count(*) as RESERVESCOUNT from reserves " - . "WHERE biblionumber = :id AND found IS NULL"; - $sqlWaitingReserve = "select count(*) as WAITING from reserves " + $sqlReserves = 'select count(*) as RESERVESCOUNT from reserves ' + . 'WHERE biblionumber = :id AND found IS NULL'; + $sqlWaitingReserve = 'select count(*) as WAITING from reserves ' . "WHERE itemnumber = :item_id and found = 'W'"; - if ($this->tableExists("biblio_metadata")) { - $sqlHoldings = "SELECT " - . "ExtractValue(( SELECT metadata FROM biblio_metadata " + if ($this->tableExists('biblio_metadata')) { + $sqlHoldings = 'SELECT ' + . 'ExtractValue(( SELECT metadata FROM biblio_metadata ' . "WHERE biblionumber = :id AND format='marcxml'), " . "'//datafield[@tag=\"866\"]/subfield[@code=\"a\"]') AS MFHD;"; } else { - $sqlHoldings = "SELECT ExtractValue(( SELECT marcxml FROM biblioitems " - . "WHERE biblionumber = :id), " + $sqlHoldings = 'SELECT ExtractValue(( SELECT marcxml FROM biblioitems ' + . 'WHERE biblionumber = :id), ' . "'//datafield[@tag=\"866\"]/subfield[@code=\"a\"]') AS MFHD;"; } try { @@ -888,24 +888,24 @@ public function getHolding($id, array $patron = null, array $options = []) $this->throwAsIlsException($e); } - $this->debug("Rows count: " . $itemSqlStmt->rowCount()); + $this->debug('Rows count: ' . $itemSqlStmt->rowCount()); $notes = $sqlStmtHoldings->fetch(); $reservesRow = $sqlStmtReserves->fetch(); - $reservesCount = $reservesRow["RESERVESCOUNT"]; + $reservesCount = $reservesRow['RESERVESCOUNT']; foreach ($itemSqlStmt->fetchAll() as $rowItem) { $inum = $rowItem['ITEMNO']; $sqlStmtWaitingReserve->execute([':item_id' => $inum]); $waitingReserveRow = $sqlStmtWaitingReserve->fetch(); - $waitingReserve = $waitingReserveRow["WAITING"]; + $waitingReserve = $waitingReserveRow['WAITING']; if ($rowItem['LOCATION'] == 'PROC') { $available = false; $status = 'In processing'; $duedate = ''; } else { - $sql = "select date_due as DUEDATE from issues - where itemnumber = :inum"; + $sql = 'select date_due as DUEDATE from issues + where itemnumber = :inum'; switch ($rowItem['NOTFORLOAN']) { case 0: // If the item is available for loan, then check its current @@ -954,7 +954,7 @@ public function getHolding($id, array $patron = null, array $options = []) $duedate_formatted = $this->displayDate($duedate); if ($rowItem['HLDBRNCH'] == null && $rowItem['HOMEBRANCH'] == null) { - $loc = "Unknown"; + $loc = 'Unknown'; } else { $loc = $rowItem['LOCATION']; } @@ -965,12 +965,12 @@ public function getHolding($id, array $patron = null, array $options = []) $branch = $rowItem['HLDBRNCH'] ?? $rowItem['HOMEBRANCH'] ?? ''; } - $sqlBranch = "select branchname as BNAME + $sqlBranch = 'select branchname as BNAME from branches - where branchcode = :branch"; + where branchcode = :branch'; $branchSqlStmt = $this->getDb()->prepare($sqlBranch); //Retrieving the full branch name - if ($loc != "Unknown") { + if ($loc != 'Unknown') { $branchSqlStmt->execute([':branch' => $branch]); $row = $branchSqlStmt->fetch(); if ($row) { @@ -980,27 +980,27 @@ public function getHolding($id, array $patron = null, array $options = []) $onTransfer = false; if ( - ($rowItem["TRANSFERFROM"] != null) - && ($rowItem["TRANSFERTO"] != null) + ($rowItem['TRANSFERFROM'] != null) + && ($rowItem['TRANSFERTO'] != null) ) { - $branchSqlStmt->execute([':branch' => $rowItem["TRANSFERFROM"]]); + $branchSqlStmt->execute([':branch' => $rowItem['TRANSFERFROM']]); $rowFrom = $branchSqlStmt->fetch(); $transferfrom = $rowFrom - ? $rowFrom["BNAME"] : $rowItem["TRANSFERFROM"]; - $branchSqlStmt->execute([':branch' => $rowItem["TRANSFERTO"]]); + ? $rowFrom['BNAME'] : $rowItem['TRANSFERFROM']; + $branchSqlStmt->execute([':branch' => $rowItem['TRANSFERTO']]); $rowTo = $branchSqlStmt->fetch(); - $transferto = $rowTo ? $rowTo["BNAME"] : $rowItem["TRANSFERTO"]; - $status = "In transit between library locations"; + $transferto = $rowTo ? $rowTo['BNAME'] : $rowItem['TRANSFERTO']; + $status = 'In transit between library locations'; $available = false; $onTransfer = true; } - if ($rowItem['DOCTYPE'] == "PE") { + if ($rowItem['DOCTYPE'] == 'PE') { $rowItem['COPYNO'] = $rowItem['PERIONAME']; } if ($waitingReserve) { $available = false; - $status = "Waiting"; + $status = 'Waiting'; $waiting = true; } else { $waiting = false; @@ -1013,12 +1013,12 @@ public function getHolding($id, array $patron = null, array $options = []) 'location' => $loc, 'item_notes' => (null == $rowItem['PUBLICNOTES'] ? null : [ $rowItem['PUBLICNOTES'] ]), - 'notes' => $notes["MFHD"], + 'notes' => $notes['MFHD'], //'reserve' => (null == $rowItem['RESERVES']) // ? 'N' : $rowItem['RESERVES'], 'reserve' => 'N', 'callnumber' => - ((null == $rowItem['CALLNO']) || ($rowItem['DOCTYPE'] == "PE")) + ((null == $rowItem['CALLNO']) || ($rowItem['DOCTYPE'] == 'PE')) ? '' : $rowItem['CALLNO'], 'duedate' => ($onTransfer || $waiting) ? '' : (string)$duedate_formatted, @@ -1035,9 +1035,9 @@ public function getHolding($id, array $patron = null, array $options = []) //file_put_contents('holding.txt', print_r($holding,TRUE), FILE_APPEND); $this->debug( - "Processing finished, rows processed: " - . count($holding) . ", took " . (microtime(true) - $started) . - " sec" + 'Processing finished, rows processed: ' + . count($holding) . ', took ' . (microtime(true) - $started) . + ' sec' ); return $holding; @@ -1084,7 +1084,7 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) $rescount++; } - $this->debug($rescount . " fetched"); + $this->debug($rescount . ' fetched'); $results = array_slice($items, ($page - 1) * $limit, ($page * $limit) - 1); return ['count' => $rescount, 'results' => $results]; @@ -1128,16 +1128,16 @@ public function getMyFines($patron) $row = $sql = $sqlStmt = ''; try { $id = $patron['id']; - $sql = "SELECT al.amount*100 as amount, " - . "al.amountoutstanding*100 as balance, " - . "COALESCE(al.credit_type_code, al.debit_type_code) as fine, " - . "al.date as createdat, items.biblionumber as id, " - . "al.description as title, issues.date_due as duedate, " - . "issues.issuedate as issuedate " - . "FROM `accountlines` al " - . "LEFT JOIN items USING (itemnumber) " - . "LEFT JOIN issues USING (issue_id) " - . "WHERE al.borrowernumber = :id "; + $sql = 'SELECT al.amount*100 as amount, ' + . 'al.amountoutstanding*100 as balance, ' + . 'COALESCE(al.credit_type_code, al.debit_type_code) as fine, ' + . 'al.date as createdat, items.biblionumber as id, ' + . 'al.description as title, issues.date_due as duedate, ' + . 'issues.issuedate as issuedate ' + . 'FROM `accountlines` al ' + . 'LEFT JOIN items USING (itemnumber) ' + . 'LEFT JOIN issues USING (issue_id) ' + . 'WHERE al.borrowernumber = :id '; $sqlStmt = $this->getDb()->prepare($sql); $sqlStmt->execute([':id' => $id]); foreach ($sqlStmt->fetchAll() as $row) { @@ -1209,7 +1209,7 @@ public function getMyFines($patron) $fineValue = 'Cancelled charge'; break; default: - $fineValue = "Unknown Charge"; + $fineValue = 'Unknown Charge'; break; } @@ -1247,24 +1247,24 @@ public function getMyFinesILS($patron) $fineLst = []; $rsp = $this->makeRequest( - "GetPatronInfo&patron_id=$id" . "&show_contact=0&show_fines=1" + "GetPatronInfo&patron_id=$id" . '&show_contact=0&show_fines=1' ); - $this->debug("ID: " . $rsp->{'borrowernumber'}); - $this->debug("Chrgs: " . $rsp->{'charges'}); + $this->debug('ID: ' . $rsp->{'borrowernumber'}); + $this->debug('Chrgs: ' . $rsp->{'charges'}); foreach ($rsp->{'fines'}->{'fine'} ?? [] as $fine) { $fineLst[] = [ 'amount' => 100 * $this->getField($fine->{'amount'}), // FIXME: require accountlines.itemnumber -> issues.issuedate data - 'checkout' => "N/A", + 'checkout' => 'N/A', 'fine' => $this->getField($fine->{'description'}), 'balance' => 100 * $this->getField($fine->{'amountoutstanding'}), 'createdate' => $this->displayDate($this->getField($fine->{'date'})), // FIXME: require accountlines.itemnumber -> issues.date_due data. - 'duedate' => "N/A", + 'duedate' => 'N/A', // FIXME: require accountlines.itemnumber -> items.biblionumber data - 'id' => "N/A", + 'id' => 'N/A', ]; } return $fineLst; @@ -1287,10 +1287,10 @@ public function getMyHolds($patron) $holdLst = []; $rsp = $this->makeRequest( - "GetPatronInfo&patron_id=$id" . "&show_contact=0&show_holds=1" + "GetPatronInfo&patron_id=$id" . '&show_contact=0&show_holds=1' ); - $this->debug("ID: " . $rsp->{'borrowernumber'}); + $this->debug('ID: ' . $rsp->{'borrowernumber'}); foreach ($rsp->{'holds'}->{'hold'} ?? [] as $hold) { $holdLst[] = [ @@ -1300,13 +1300,13 @@ public function getMyHolds($patron) ? $this->displayDate( $this->getField($hold->{'expirationdate'}) ) - : "N/A", + : 'N/A', 'create' => $this->displayDate( $this->getField($hold->{'reservedate'}) ), 'position' => $this->getField($hold->{'priority'}), 'title' => $this->getField($hold->{'title'}), - 'available' => ($this->getField($hold->{'found'}) == "W"), + 'available' => ($this->getField($hold->{'found'}) == 'W'), 'reserve_id' => $this->getField($hold->{'reserve_id'}), ]; } @@ -1348,11 +1348,11 @@ public function cancelHolds($cancelDetails) $retVal = ['count' => 0, 'items' => []]; $details = $cancelDetails['details']; $patron_id = $cancelDetails['patron']['id']; - $request_prefix = "CancelHold&patron_id=" . $patron_id . "&item_id="; + $request_prefix = 'CancelHold&patron_id=' . $patron_id . '&item_id='; foreach ($details as $cancelItem) { $rsp = $this->makeRequest($request_prefix . $cancelItem); - if ($rsp->{'code'} != "Canceled") { + if ($rsp->{'code'} != 'Canceled') { $retVal['items'][$cancelItem] = [ 'success' => false, 'status' => 'hold_cancel_fail', @@ -1385,11 +1385,11 @@ public function getMyProfile($patron) $profile = []; $rsp = $this->makeRequest( - "GetPatronInfo&patron_id=$id" . "&show_contact=1" + "GetPatronInfo&patron_id=$id" . '&show_contact=1' ); - $this->debug("Code: " . $rsp->{'code'}); - $this->debug("Cardnumber: " . $rsp->{'cardnumber'}); + $this->debug('Code: ' . $rsp->{'code'}); + $this->debug('Cardnumber: ' . $rsp->{'cardnumber'}); if ($rsp->{'code'} != 'PatronNotFound') { $profile = [ @@ -1403,7 +1403,7 @@ public function getMyProfile($patron) ]; return $profile; } else { - $this->debug("Error Message: " . $rsp->{'message'}); + $this->debug('Error Message: ' . $rsp->{'message'}); return null; } } @@ -1424,10 +1424,10 @@ public function getAccountBlocks($patron) try { $id = $patron['id']; - $sql = "select type as TYPE, comment as COMMENT " . - "from borrower_debarments " . - "where (expiration is null or expiration >= NOW()) " . - "and borrowernumber = :id"; + $sql = 'select type as TYPE, comment as COMMENT ' . + 'from borrower_debarments ' . + 'where (expiration is null or expiration >= NOW()) ' . + 'and borrowernumber = :id'; $sqlStmt = $this->getDb()->prepare($sql); $sqlStmt->execute([':id' => $id]); @@ -1474,8 +1474,8 @@ public function getMyTransactionHistory($patron, $params) $id = $patron['id']; // Get total count first - $sql = "select count(*) as cnt from old_issues " . - "where old_issues.borrowernumber = :id"; + $sql = 'select count(*) as cnt from old_issues ' . + 'where old_issues.borrowernumber = :id'; $sqlStmt = $this->getDb()->prepare($sql); $sqlStmt->execute([':id' => $id]); $totalCount = $sqlStmt->fetch()['cnt']; @@ -1501,14 +1501,14 @@ public function getMyTransactionHistory($patron, $params) } else { $sort = 'ISSUEDATE desc'; } - $sql = "select old_issues.issuedate as ISSUEDATE, " . - "old_issues.date_due as DUEDATE, items.biblionumber as " . - "BIBNO, items.barcode BARCODE, old_issues.returndate as RETURNED, " . - "biblio.title as TITLE " . - "from old_issues join items " . - "on old_issues.itemnumber = items.itemnumber " . - "join biblio on items.biblionumber = biblio.biblionumber " . - "where old_issues.borrowernumber = :id " . + $sql = 'select old_issues.issuedate as ISSUEDATE, ' . + 'old_issues.date_due as DUEDATE, items.biblionumber as ' . + 'BIBNO, items.barcode BARCODE, old_issues.returndate as RETURNED, ' . + 'biblio.title as TITLE ' . + 'from old_issues join items ' . + 'on old_issues.itemnumber = items.itemnumber ' . + 'join biblio on items.biblionumber = biblio.biblionumber ' . + 'where old_issues.borrowernumber = :id ' . "order by $sort limit $start,$limit"; $sqlStmt = $this->getDb()->prepare($sql); @@ -1550,27 +1550,27 @@ public function getMyTransactions($patron) $transactionLst = []; $start = microtime(true); $rsp = $this->makeRequest( - "GetPatronInfo&patron_id=$id" . "&show_contact=0&show_loans=1" + "GetPatronInfo&patron_id=$id" . '&show_contact=0&show_loans=1' ); $end = microtime(true); $requestTimes = [$end - $start]; - $this->debug("ID: " . $rsp->{'borrowernumber'}); + $this->debug('ID: ' . $rsp->{'borrowernumber'}); foreach ($rsp->{'loans'}->{'loan'} ?? [] as $loan) { $start = microtime(true); $rsp2 = $this->makeIlsdiRequest( - "GetServices", + 'GetServices', [ - "patron_id" => $id, - "item_id" => $this->getField($loan->{'itemnumber'}), + 'patron_id' => $id, + 'item_id' => $this->getField($loan->{'itemnumber'}), ] ); $end = microtime(true); $requestTimes[] = $end - $start; $renewable = false; foreach ($rsp2->{'AvailableFor'} ?? [] as $service) { - if ($this->getField((string)$service) == "loan renewal") { + if ($this->getField((string)$service) == 'loan renewal') { $renewable = true; } } @@ -1626,24 +1626,24 @@ public function renewMyItems($renewDetails) $retVal = ['blocks' => false, 'details' => []]; $details = $renewDetails['details']; $patron_id = $renewDetails['patron']['id']; - $request_prefix = "RenewLoan&patron_id=" . $patron_id . "&item_id="; + $request_prefix = 'RenewLoan&patron_id=' . $patron_id . '&item_id='; foreach ($details as $renewItem) { $rsp = $this->makeRequest($request_prefix . $renewItem); if ($rsp->{'success'} != '0') { [$date, $time] - = explode(" ", $this->getField($rsp->{'date_due'})); + = explode(' ', $this->getField($rsp->{'date_due'})); $retVal['details'][$renewItem] = [ - "success" => true, - "new_date" => $this->displayDate($date), - "new_time" => $time, - "item_id" => $renewItem, + 'success' => true, + 'new_date' => $this->displayDate($date), + 'new_time' => $time, + 'item_id' => $renewItem, ]; } else { $retVal['details'][$renewItem] = [ - "success" => false, - "new_date" => false, - "item_id" => $renewItem, + 'success' => false, + 'new_date' => false, + 'item_id' => $renewItem, //"sysMessage" => $this->getField($rsp->{'error'}), ]; } @@ -1680,7 +1680,7 @@ public function getPurchaseHistory($id) $result = []; foreach ($sqlStmt->fetchAll() as $rowItem) { - $result[] = ['issue' => $rowItem["date and enumeration"]]; + $result[] = ['issue' => $rowItem['date and enumeration']]; } } catch (PDOException $e) { $this->throwAsIlsException($e); @@ -1718,7 +1718,7 @@ public function getStatus($id) */ public function getStatuses($idLst) { - $this->debug("IDs:" . implode(',', $idLst)); + $this->debug('IDs:' . implode(',', $idLst)); $statusLst = []; foreach ($idLst as $id) { @@ -1736,7 +1736,7 @@ public function getStatuses($idLst) public function getSuppressedRecords() { try { - if ($this->tableExists("biblio_metadata")) { + if ($this->tableExists('biblio_metadata')) { $sql = "SELECT biblio.biblionumber AS biblionumber FROM biblio JOIN biblio_metadata USING (biblionumber) @@ -1756,7 +1756,7 @@ public function getSuppressedRecords() $sqlStmt->execute(); $result = []; foreach ($sqlStmt->fetchAll() as $rowItem) { - $result[] = $rowItem["biblionumber"]; + $result[] = $rowItem['biblionumber']; } } catch (PDOException $e) { $this->throwAsIlsException($e); @@ -1774,15 +1774,15 @@ public function getDepartments() { $deptList = []; - $sql = "SELECT DISTINCT department as abv, lib_opac AS DEPARTMENT + $sql = 'SELECT DISTINCT department as abv, lib_opac AS DEPARTMENT FROM courses INNER JOIN `authorised_values` - ON courses.department = `authorised_values`.`authorised_value`"; + ON courses.department = `authorised_values`.`authorised_value`'; try { $sqlStmt = $this->getDb()->prepare($sql); $sqlStmt->execute(); foreach ($sqlStmt->fetchAll() as $rowItem) { - $deptList[$rowItem["abv"]] = $rowItem["DEPARTMENT"]; + $deptList[$rowItem['abv']] = $rowItem['DEPARTMENT']; } } catch (PDOException $e) { $this->throwAsIlsException($e); @@ -1809,7 +1809,7 @@ public function getInstructors() $sqlStmt = $this->getDb()->prepare($sql); $sqlStmt->execute(); foreach ($sqlStmt->fetchAll() as $rowItem) { - $instList[$rowItem["borrowernumber"]] = $rowItem["name"]; + $instList[$rowItem['borrowernumber']] = $rowItem['name']; } } catch (PDOException $e) { $this->throwAsIlsException($e); @@ -1835,7 +1835,7 @@ public function getCourses() $sqlStmt = $this->getDb()->prepare($sql); $sqlStmt->execute(); foreach ($sqlStmt->fetchAll() as $rowItem) { - $courseList[$rowItem["course_id"]] = $rowItem["course"]; + $courseList[$rowItem['course_id']] = $rowItem['course']; } } catch (PDOException $e) { $this->throwAsIlsException($e); @@ -1864,19 +1864,19 @@ public function findReserves($course, $inst, $dept) $reserveWhere = []; $bindParams = []; if ($course != '') { - $reserveWhere[] = "COURSE_ID = :course"; + $reserveWhere[] = 'COURSE_ID = :course'; $bindParams[':course'] = $course; } if ($inst != '') { - $reserveWhere[] = "INSTRUCTOR_ID = :inst"; + $reserveWhere[] = 'INSTRUCTOR_ID = :inst'; $bindParams[':inst'] = $inst; } if ($dept != '') { - $reserveWhere[] = "DEPARTMENT_ID = :dept"; + $reserveWhere[] = 'DEPARTMENT_ID = :dept'; $bindParams[':dept'] = $dept; } $reserveWhere = empty($reserveWhere) ? - "" : "HAVING (" . implode(' AND ', $reserveWhere) . ")"; + '' : 'HAVING (' . implode(' AND ', $reserveWhere) . ')'; $sql = "SELECT biblionumber AS `BIB_ID`, courses.course_id AS `COURSE_ID`, @@ -1919,19 +1919,19 @@ public function findReserves($course, $inst, $dept) */ public function patronLogin($username, $password) { - $request = "LookupPatron" . "&id=" . urlencode($username) - . "&id_type=userid"; + $request = 'LookupPatron' . '&id=' . urlencode($username) + . '&id_type=userid'; if ($this->validatePasswords) { - $request = "AuthenticatePatron" . "&username=" - . urlencode($username) . "&password=" . $password; + $request = 'AuthenticatePatron' . '&username=' + . urlencode($username) . '&password=' . $password; } $idObj = $this->makeRequest($request); - $this->debug("username: " . $username); - $this->debug("Code: " . $idObj->{'code'}); - $this->debug("ID: " . $idObj->{'id'}); + $this->debug('username: ' . $username); + $this->debug('Code: ' . $idObj->{'code'}); + $this->debug('ID: ' . $idObj->{'id'}); $id = $this->getField($idObj->{'id'}, 0); if ($id) { @@ -1970,7 +1970,7 @@ public function patronLogin($username, $password) */ public function changePassword($detail) { - $sql = "UPDATE borrowers SET password = ? WHERE borrowernumber = ?"; + $sql = 'UPDATE borrowers SET password = ? WHERE borrowernumber = ?'; $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $max = mb_strlen($keyspace, '8bit') - 1; $salt = ''; @@ -2004,7 +2004,7 @@ public function changePassword($detail) public function displayDate($date) { if (empty($date)) { - return ""; + return ''; } elseif (preg_match("/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d$/", $date) === 1) { // YYYY-MM-DD HH:MM:SS return $this->dateConverter->convertToDisplayDate('Y-m-d H:i:s', $date); @@ -2029,7 +2029,7 @@ public function displayDate($date) public function displayDateTime($date) { if (empty($date)) { - return ""; + return ''; } elseif (preg_match("/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d$/", $date) === 1) { // YYYY-MM-DD HH:MM:SS return diff --git a/module/VuFind/src/VuFind/ILS/Driver/KohaRest.php b/module/VuFind/src/VuFind/ILS/Driver/KohaRest.php index 2ee8e1b6dd8..0c26e39ef2f 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/KohaRest.php +++ b/module/VuFind/src/VuFind/ILS/Driver/KohaRest.php @@ -2042,7 +2042,7 @@ protected function getItemStatusCodes($item) } } else { $this->logError( - "Unable to determine status for item: " . print_r($item, true) + 'Unable to determine status for item: ' . print_r($item, true) ); } diff --git a/module/VuFind/src/VuFind/ILS/Driver/NewGenLib.php b/module/VuFind/src/VuFind/ILS/Driver/NewGenLib.php index 8e25e9108cc..ca2f5584510 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/NewGenLib.php +++ b/module/VuFind/src/VuFind/ILS/Driver/NewGenLib.php @@ -101,7 +101,7 @@ public function getHolding($RecordID, array $patron = null, array $options = []) $holding = $this->getItemStatus($RecordID); for ($i = 0; $i < count($holding); $i++) { // add extra data - $duedateql = "select due_date from cir_transaction where " . + $duedateql = 'select due_date from cir_transaction where ' . "accession_number='" . $holding[$i]['number'] . "' and document_library_id='" . $holding[$i]['library_id'] . "' and status='A'"; @@ -111,7 +111,7 @@ public function getHolding($RecordID, array $patron = null, array $options = []) } catch (PDOException $e1) { $this->throwAsIlsException($e1); } - $duedate = ""; + $duedate = ''; while ($rowDD = $sqlStmt2->fetch(PDO::FETCH_ASSOC)) { $duedate = $rowDD['due_date']; } @@ -144,13 +144,13 @@ public function getMyFines($patron) $pid = $patron['cat_username']; $fine = 'Overdue'; $LibId = 1; - $mainsql = "select d.volume_id as volume_id, c.status as status, " . - "v.volume_id as volume_id, d.accession_number as " . - "accession_number, v.cataloguerecordid as cataloguerecordid, " . - "v.owner_library_id as owner_library_id, c.patron_id as patron_id, " . - "c.due_date as due_date, c.ta_date as ta_date, c.fine_amt as " . - "fine_amt, c.ta_id as ta_id,c.library_id as library_id from " . - "document d,cat_volume v,cir_transaction c where " . + $mainsql = 'select d.volume_id as volume_id, c.status as status, ' . + 'v.volume_id as volume_id, d.accession_number as ' . + 'accession_number, v.cataloguerecordid as cataloguerecordid, ' . + 'v.owner_library_id as owner_library_id, c.patron_id as patron_id, ' . + 'c.due_date as due_date, c.ta_date as ta_date, c.fine_amt as ' . + 'fine_amt, c.ta_id as ta_id,c.library_id as library_id from ' . + 'document d,cat_volume v,cir_transaction c where ' . "d.volume_id=v.volume_id and v.owner_library_id='" . $LibId . "' and c.accession_number=d.accession_number and " . "c.document_library_id=d.library_id and c.patron_id='" . @@ -162,23 +162,23 @@ public function getMyFines($patron) } catch (PDOException $e) { $this->throwAsIlsException($e); } - $id = ""; + $id = ''; while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { - $id = $row['cataloguerecordid'] . "_" . $row['owner_library_id']; + $id = $row['cataloguerecordid'] . '_' . $row['owner_library_id']; $amount = $row['fine_amt'] * 100; $checkout = $row['ta_date']; $duedate = $row['due_date']; - $paidamtsql = "select sum(f.fine_amt_paid) as fine_amt_paid from " . - "cir_transaction_fine f where f.ta_id=" . $row['ta_id'] . - " and f.library_id=" . $row['library_id']; + $paidamtsql = 'select sum(f.fine_amt_paid) as fine_amt_paid from ' . + 'cir_transaction_fine f where f.ta_id=' . $row['ta_id'] . + ' and f.library_id=' . $row['library_id']; try { $sqlStmt1 = $this->db->prepare($paidamtsql); $sqlStmt1->execute(); } catch (PDOException $e1) { $this->throwAsIlsException($e1); } - $paidamt = ""; - $balance = ""; + $paidamt = ''; + $balance = ''; while ($rowpaid = $sqlStmt1->fetch(PDO::FETCH_ASSOC)) { $paidamt = $rowpaid['fine_amt_paid'] * 100; $balance = $amount - $paidamt; @@ -212,11 +212,11 @@ public function getMyHolds($patron) $PatId = $patron['cat_username']; $LibId = 1; //SQL Statement - $mainsql = "select d.volume_id as volume_id, c.status as status, " . - "v.volume_id as volume_id, d.accession_number as accession_number, " . - "v.cataloguerecordid as cataloguerecordid, v.owner_library_id as " . - "owner_library_id, c.patron_id as patron_id from " . - "document d,cat_volume v,cir_transaction c where " . + $mainsql = 'select d.volume_id as volume_id, c.status as status, ' . + 'v.volume_id as volume_id, d.accession_number as accession_number, ' . + 'v.cataloguerecordid as cataloguerecordid, v.owner_library_id as ' . + 'owner_library_id, c.patron_id as patron_id from ' . + 'document d,cat_volume v,cir_transaction c where ' . "d.volume_id=v.volume_id and v.owner_library_id='" . $LibId . "' and c.accession_number=d.accession_number and " . "c.document_library_id=d.library_id and c.patron_id='" . $PatId . @@ -228,8 +228,8 @@ public function getMyHolds($patron) $this->throwAsIlsException($e); } while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { - $type = "RECALLED ITEM - Return the item to the library"; - $rIdql = "select due_date, ta_date from cir_transaction " . + $type = 'RECALLED ITEM - Return the item to the library'; + $rIdql = 'select due_date, ta_date from cir_transaction ' . "where patron_id='" . $row['patron_id'] . "'"; try { $sqlStmt2 = $this->db->prepare($rIdql); @@ -237,9 +237,9 @@ public function getMyHolds($patron) } catch (PDOException $e1) { $this->throwAsIlsException($e1); } - $RecordId = $row['cataloguerecordid'] . "_" . $row['owner_library_id']; - $duedate = ""; - $tadate = ""; + $RecordId = $row['cataloguerecordid'] . '_' . $row['owner_library_id']; + $duedate = ''; + $tadate = ''; while ($rowDD = $sqlStmt2->fetch(PDO::FETCH_ASSOC)) { $duedate = $rowDD['due_date']; $tadate = $rowDD['ta_date']; @@ -248,14 +248,14 @@ public function getMyHolds($patron) 'id' => $RecordId, 'location' => null, 'reqnum' => null, - 'expire' => $duedate . " " . $type, + 'expire' => $duedate . ' ' . $type, 'create' => $tadate]; } //SQL Statement 2 - $mainsql2 = "select v.cataloguerecordid as cataloguerecordid, " . - "v.owner_library_id as owner_library_id, v.volume_id as volume_id, " . - "r.volume_id as volume_id, r.queue_no as queue_no, " . - "r.reservation_date as reservation_date, r.status as status " . + $mainsql2 = 'select v.cataloguerecordid as cataloguerecordid, ' . + 'v.owner_library_id as owner_library_id, v.volume_id as volume_id, ' . + 'r.volume_id as volume_id, r.queue_no as queue_no, ' . + 'r.reservation_date as reservation_date, r.status as status ' . "from cir_reservation r, cat_volume v where r.patron_id='" . $PatId . "' and r.library_id='" . $LibId . "' and r.volume_id=v.volume_id and r.status in ('A', 'B')"; @@ -266,25 +266,25 @@ public function getMyHolds($patron) $this->throwAsIlsException($e); } while ($row2 = $sqlStmt2->fetch(PDO::FETCH_ASSOC)) { - $location = ""; - $type2 = ""; + $location = ''; + $type2 = ''; switch ($row2['status']) { case 'A': - $location = "Checked out - No copy available in the library"; + $location = 'Checked out - No copy available in the library'; $type2 = $row2['queue_no']; break; case 'B': - $location = "Item available at the circulation desk"; - $type2 = "INTIMATED"; + $location = 'Item available at the circulation desk'; + $type2 = 'INTIMATED'; break; } - $RecordId2 = $row2['cataloguerecordid'] . "_" . + $RecordId2 = $row2['cataloguerecordid'] . '_' . $row2['owner_library_id']; $holds[] = ['type' => $type2, 'id' => $RecordId2, 'location' => $location, 'reqnum' => $row2['queue_no'], - 'expire' => null . " " . $type2, + 'expire' => null . ' ' . $type2, 'create' => $row2['reservation_date']]; } return $holds; @@ -305,9 +305,9 @@ public function getMyProfile($patron) $profile = null; $catusr = $patron['cat_username']; $catpswd = $patron['cat_password']; - $sql = "select p.patron_id as patron_id,p.user_password as " . - "user_password, p.fname as fname, p.lname as lname, p.address1 as " . - "address1, p.address2 as address2, p.pin as pin, p.phone1 as phone1 " . + $sql = 'select p.patron_id as patron_id,p.user_password as ' . + 'user_password, p.fname as fname, p.lname as lname, p.address1 as ' . + 'address1, p.address2 as address2, p.pin as pin, p.phone1 as phone1 ' . "from patron p where p.patron_id='" . $catusr . "' and p.user_password='" . $catpswd . "'"; try { @@ -348,13 +348,13 @@ public function getMyTransactions($patron) { $transactions = []; $PatId = $patron['cat_username']; - $mainsql = "select c.due_date as due_date, c.status as status, c.ta_id " . - "as ta_id, c.library_id as library_id, c.accession_number as " . - "accession_number, v.cataloguerecordid as cataloguerecordid, " . - "v.owner_library_id as owner_library_id, c.patron_id as " . - "patron_id from document d,cat_volume v,cir_transaction c where " . + $mainsql = 'select c.due_date as due_date, c.status as status, c.ta_id ' . + 'as ta_id, c.library_id as library_id, c.accession_number as ' . + 'accession_number, v.cataloguerecordid as cataloguerecordid, ' . + 'v.owner_library_id as owner_library_id, c.patron_id as ' . + 'patron_id from document d,cat_volume v,cir_transaction c where ' . "d.volume_id=v.volume_id and v.owner_library_id='1' and " . - "c.accession_number=d.accession_number and " . + 'c.accession_number=d.accession_number and ' . "c.document_library_id=d.library_id and c.patron_id='" . $PatId . "' and c.status in('A','C')"; try { @@ -364,7 +364,7 @@ public function getMyTransactions($patron) $this->throwAsIlsException($e); } while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { - $countql = "select count(*) as total from cir_transaction c, " . + $countql = 'select count(*) as total from cir_transaction c, ' . "cir_transaction_renewal r where r.ta_id='" . $row['ta_id'] . "' and r.library_id='" . $row['library_id'] . "' and c.status='A'"; @@ -374,12 +374,12 @@ public function getMyTransactions($patron) } catch (PDOException $e) { $this->throwAsIlsException($e); } - $RecordId = $row['cataloguerecordid'] . "_" . $row['owner_library_id']; - $count = ""; + $RecordId = $row['cataloguerecordid'] . '_' . $row['owner_library_id']; + $count = ''; while ($srow = $sql->fetch(PDO::FETCH_ASSOC)) { - $count = "Renewed = " . $srow['total']; + $count = 'Renewed = ' . $srow['total']; } - $transactions[] = ['duedate' => $row['due_date'] . " " . $count, + $transactions[] = ['duedate' => $row['due_date'] . ' ' . $count, 'id' => $RecordId, 'barcode' => $row['accession_number'], 'renew' => $count, @@ -450,13 +450,13 @@ public function getStatuses($StatusResult) public function patronLogin($username, $password) { //SQL Statement - $sql = "select p.patron_id as patron_id, p.library_id as library_id, " . - "p.fname as fname, p.lname as lname, p.user_password as " . - "user_password, p.membership_start_date as membership_start_date, " . - "p.membership_expiry_date as membership_expiry_date, p.email as " . - "email from patron p where p.patron_id=:patronId" . + $sql = 'select p.patron_id as patron_id, p.library_id as library_id, ' . + 'p.fname as fname, p.lname as lname, p.user_password as ' . + 'user_password, p.membership_start_date as membership_start_date, ' . + 'p.membership_expiry_date as membership_expiry_date, p.email as ' . + 'email from patron p where p.patron_id=:patronId' . "' and p.user_password=:password and p.membership_start_date " . - "<= current_date and p.membership_expiry_date > current_date"; + '<= current_date and p.membership_expiry_date > current_date'; try { $sqlStmt = $this->db->prepare($sql); @@ -469,8 +469,8 @@ public function patronLogin($username, $password) return null; } return [ - "id" => $row['patron_id'], - "firstname" => $row['fname'], + 'id' => $row['patron_id'], + 'firstname' => $row['fname'], 'lastname' => $row['lname'], 'cat_username' => $username, 'cat_password' => $password, @@ -507,7 +507,7 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) $retVal[][] = []; $offset = ($page - 1) * $limit; - $sql = "select cataloguerecordid,owner_library_id from cataloguerecord " . + $sql = 'select cataloguerecordid,owner_library_id from cataloguerecord ' . "where created_on + interval '$daysOld days' >= " . "current_timestamp offset $offset limit $limit"; try { @@ -519,7 +519,7 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) $results = []; while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { - $id = $row['cataloguerecordid'] . "_" . $row['owner_library_id']; + $id = $row['cataloguerecordid'] . '_' . $row['owner_library_id']; $results[] = $id; } $retVal = ['count' => count($results), 'results' => []]; @@ -558,14 +558,14 @@ public function getPurchaseHistory($id) protected function getItemStatus($RecordID) { $StatusResult = []; - $pieces = explode("_", $RecordID); + $pieces = explode('_', $RecordID); $CatId = $pieces[0]; $LibId = $pieces[1]; //SQL Statement - $mainsql = "select d.status as status, d.location_id as location_id, " . - "d.call_number as call_number, d.accession_number as accession_number," . - " d.barcode as barcode, d.library_id as library_id from " . - "document d,cat_volume v where d.volume_id=v.volume_id and " . + $mainsql = 'select d.status as status, d.location_id as location_id, ' . + 'd.call_number as call_number, d.accession_number as accession_number,' . + ' d.barcode as barcode, d.library_id as library_id from ' . + 'document d,cat_volume v where d.volume_id=v.volume_id and ' . "v.cataloguerecordid='" . $CatId . "' and v.owner_library_id=" . $LibId; try { @@ -578,7 +578,7 @@ protected function getItemStatus($RecordID) while ($row = $sqlSmt->fetch(PDO::FETCH_ASSOC)) { switch ($row['status']) { case 'B': - $status = "Available"; + $status = 'Available'; $available = true; $reserve = 'N'; break; @@ -588,12 +588,12 @@ protected function getItemStatus($RecordID) // action.hold_request.current_copy = asset.copy.id // and action.hold_request.capture_time is not null // and I think action.hold_request.fulfillment_time is null - $status = "Checked Out"; + $status = 'Checked Out'; $available = false; $reserve = 'N'; break; default: - $status = "Not Available"; + $status = 'Not Available'; $available = false; $reserve = 'N'; break; @@ -606,7 +606,7 @@ protected function getItemStatus($RecordID) } catch (PDOException $e1) { $this->throwAsIlsException($e1); } - $location = ""; + $location = ''; while ($rowLoc = $sqlSmt1->fetch(PDO::FETCH_ASSOC)) { $location = $rowLoc['location']; } diff --git a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php index 5d111949d9e..6de2b6da2d0 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php +++ b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php @@ -137,7 +137,7 @@ protected function getSolrRecord($id) public function getStatus($id) { $useStatus = $this->config['settings']['useStatus'] ?? 'none'; - if ($useStatus == "custom") { + if ($useStatus == 'custom') { $status = $this->translate($this->config['Status']['status']); return [ [ @@ -156,7 +156,7 @@ public function getStatus($id) ), ], ]; - } elseif ($useStatus == "marc") { + } elseif ($useStatus == 'marc') { // Retrieve record from index: $recordDriver = $this->getSolrRecord($id); return $this->getFormattedMarcDetails($recordDriver, 'MarcStatus'); @@ -178,7 +178,7 @@ public function getStatus($id) public function getStatuses($idList) { $useStatus = $this->config['settings']['useStatus'] ?? 'none'; - if ($useStatus == "custom" || $useStatus == "marc") { + if ($useStatus == 'custom' || $useStatus == 'marc') { $status = []; foreach ($idList as $id) { $status[] = $this->getStatus($id); @@ -209,7 +209,7 @@ public function getHolding($id, array $patron = null, array $options = []) { $useHoldings = $this->config['settings']['useHoldings'] ?? 'none'; - if ($useHoldings == "custom") { + if ($useHoldings == 'custom') { return [ [ 'id' => $id, @@ -234,7 +234,7 @@ public function getHolding($id, array $patron = null, array $options = []) 'summary' => $this->config['Holdings']['summary'] ?? [], ], ]; - } elseif ($useHoldings == "marc") { + } elseif ($useHoldings == 'marc') { // Retrieve record from index: $recordDriver = $this->getSolrRecord($id); return $this->getFormattedMarcDetails($recordDriver, 'MarcHoldings'); diff --git a/module/VuFind/src/VuFind/ILS/Driver/PAIA.php b/module/VuFind/src/VuFind/ILS/Driver/PAIA.php index 96d98bafa6e..7b91beaa9dd 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/PAIA.php +++ b/module/VuFind/src/VuFind/ILS/Driver/PAIA.php @@ -293,7 +293,7 @@ public function cancelHolds($cancelDetails) $items[] = ['item' => stripslashes($item)]; } $patron = $cancelDetails['patron']; - $post_data = ["doc" => $items]; + $post_data = ['doc' => $items]; try { $array_response = $this->paiaPostAsArray( @@ -373,10 +373,10 @@ public function changePassword($details) } $post_data = [ - "patron" => $details['patron']['cat_username'], - "username" => $details['patron']['cat_username'], - "old_password" => $details['oldPassword'], - "new_password" => $details['newPassword'], + 'patron' => $details['patron']['cat_username'], + 'username' => $details['patron']['cat_username'], + 'old_password' => $details['oldPassword'], + 'new_password' => $details['newPassword'], ]; try { @@ -1135,7 +1135,7 @@ public function placeHold($holdDetails) $doc = []; $doc['item'] = stripslashes($item); if ($confirm = $this->getConfirmations($holdDetails)) { - $doc["confirm"] = $confirm; + $doc['confirm'] = $confirm; } $post_data = []; $post_data['doc'][] = $doc; @@ -1241,7 +1241,7 @@ public function renewMyItems($details) $items[] = ['item' => stripslashes($item)]; } $patron = $details['patron']; - $post_data = ["doc" => $items]; + $post_data = ['doc' => $items]; try { $array_response = $this->paiaPostAsArray( @@ -1378,7 +1378,7 @@ protected function paiaGetItems($patron, $filter = []) } } else { $this->debug( - "No documents found in PAIA response. Returning empty array." + 'No documents found in PAIA response. Returning empty array.' ); } return []; @@ -1826,8 +1826,8 @@ protected function paiaLogin($username, $password) $post_data = []; switch ($this->grantType) { case 'password': - $post_data["username"] = $username; - $post_data["password"] = $password; + $post_data['username'] = $username; + $post_data['password'] = $password; break; case 'client_credentials': // client_credentials only works if we have client_credentials @@ -1836,12 +1836,12 @@ protected function paiaLogin($username, $password) isset($this->config['PAIA']['clientUsername']) && isset($this->config['PAIA']['clientPassword']) ) { - $header_data["Authorization"] = 'Basic ' . + $header_data['Authorization'] = 'Basic ' . base64_encode( $this->config['PAIA']['clientUsername'] . ':' . $this->config['PAIA']['clientPassword'] ); - $post_data["patron"] = $username; // actual patron identifier + $post_data['patron'] = $username; // actual patron identifier } else { throw new ILSException( 'Missing username and/or password for PAIA grant_type' . @@ -1852,11 +1852,11 @@ protected function paiaLogin($username, $password) } // finalize post data - $post_data["grant_type"] = $this->grantType; - $post_data["scope"] = self::SCOPE_READ_PATRON . " " . - self::SCOPE_READ_FEES . " " . - self::SCOPE_READ_ITEMS . " " . - self::SCOPE_WRITE_ITEMS . " " . + $post_data['grant_type'] = $this->grantType; + $post_data['scope'] = self::SCOPE_READ_PATRON . ' ' . + self::SCOPE_READ_FEES . ' ' . + self::SCOPE_READ_ITEMS . ' ' . + self::SCOPE_WRITE_ITEMS . ' ' . self::SCOPE_CHANGE_PASSWORD; // perform full PAIA auth and get patron info diff --git a/module/VuFind/src/VuFind/ILS/Driver/Polaris.php b/module/VuFind/src/VuFind/ILS/Driver/Polaris.php index 443243f951d..8d555f4a9bb 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Polaris.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Polaris.php @@ -127,14 +127,14 @@ public function init() */ protected function makeRequest( $api_query, - $http_method = "GET", - $patronpassword = "", + $http_method = 'GET', + $patronpassword = '', $json = false ) { // auth has to be in GMT, otherwise use config-level TZ $site_config_TZ = date_default_timezone_get(); date_default_timezone_set('GMT'); - $date = date("D, d M Y H:i:s T"); + $date = date('D, d M Y H:i:s T'); date_default_timezone_set($site_config_TZ); $url = $this->ws_host . $this->ws_app . $api_query; @@ -146,8 +146,8 @@ protected function makeRequest( $auth_token = "PWS {$this->ws_api_id}:$signature"; $http_headers = [ - "Content-type: application/json", - "Accept: application/json", + 'Content-type: application/json', + 'Accept: application/json', "PolarisDate: $date", "Authorization: $auth_token", ]; @@ -165,7 +165,7 @@ protected function makeRequest( // httpService doesn't explicitly support PUT, so add this: if ($http_method == 'PUT') { - $http_headers[] = "Content-Length: " . strlen($json_data); + $http_headers[] = 'Content-Length: ' . strlen($json_data); } $client->setHeaders($http_headers); $client->setMethod($http_method); @@ -193,7 +193,7 @@ public function formatJSONTime($jsontime) preg_match('/Date\((\d+)\-(\d){2}(\d){2}\)/', $jsontime, $matches); if (count($matches) > 0) { $matchestmp = intval($matches[1] / 1000); - $date = date("n-j-Y", $matchestmp); + $date = date('n-j-Y', $matchestmp); } else { $date = 'n/a'; } @@ -215,7 +215,7 @@ public function encodeJSONTime($date) $unix_time = strtotime($date); //date_default_timezone_set($site_config_TZ); - $json_time = "/Date(" . $unix_time . "000)/"; + $json_time = '/Date(' . $unix_time . '000)/'; return $json_time; } @@ -294,7 +294,7 @@ public function getStatus($id) $duedate = ''; if ($holdings_response->DueDate) { - $duedate = date("n-j-Y", strtotime($holdings_response->DueDate)); + $duedate = date('n-j-Y', strtotime($holdings_response->DueDate)); } $holding[] = [ @@ -490,7 +490,7 @@ public function getPickUpLocations($patron = false, $holdDetails = null) } } else { // we get them from the API - $response = $this->makeRequest("organizations/branch"); + $response = $this->makeRequest('organizations/branch'); $locations_response_array = $response->OrganizationsGetRows; foreach ($locations_response_array as $location_response) { $locations[] = [ @@ -594,7 +594,7 @@ public function findReserves($course, $inst, $dept) public function patronLogin($username, $password) { // username == barcode - $response = $this->makeRequest("patron/$username", "GET", "$password"); + $response = $this->makeRequest("patron/$username", 'GET', "$password"); if (!$response->ValidPatron) { return null; @@ -823,7 +823,7 @@ public function cancelHolds($cancelDetails) foreach ($hold_ids as $hold_id) { $response = $this->makeRequest( "patron/{$patron['cat_username']}/holdrequests/$hold_id/cancelled" - . "?wsid=1&userid=1", + . '?wsid=1&userid=1', 'PUT', $patron['cat_password'] ); @@ -1040,7 +1040,7 @@ public function reactivateHolds($reactivateDetails) $hold_ids = $reactivateDetails['details']; $patron = $reactivateDetails['patron']; - $date = date("d/M/Y"); + $date = date('d/M/Y'); $jsondate = $this->encodeJSONTime($date); $count = 0; diff --git a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php index 38a1b878559..47a33b5b1a4 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php @@ -374,7 +374,7 @@ protected function checkSymwsVersion() // ILSException didn't seem to produce an error message // when checkSymwsVersion() was called from the catch // block in makeRequest(). - throw new \Exception("SymWS version too old"); + throw new \Exception('SymWS version too old'); } break; } @@ -1195,7 +1195,7 @@ public function getMyProfile($patron) $primaryAddress = $result->patronAddressInfo->primaryAddress; - $primaryAddressInfo = "Address" . $primaryAddress . "Info"; + $primaryAddressInfo = 'Address' . $primaryAddress . 'Info'; $addressInfo = $result->patronAddressInfo->$primaryAddressInfo; $address1 = $addressInfo[0]->addressValue; diff --git a/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php b/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php index d4f6c00df21..27efc328cbd 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php @@ -257,7 +257,7 @@ public function renewMyItems($renewDetails) // process the API response if ($response == 'invalid_login') { - return ['blocks' => ["authentication_error_admin"]]; + return ['blocks' => ['authentication_error_admin']]; } $results = []; @@ -354,7 +354,7 @@ public function getStatuses($idList) { $statuses = []; $params = [ - 'query' => 'multiple', 'ids' => implode("|", array_unique($idList)), + 'query' => 'multiple', 'ids' => implode('|', array_unique($idList)), ]; $response = $this->querySirsi($params); if (empty($response)) { @@ -462,7 +462,7 @@ public function placeHold($holdDetails) if ($response == 'invalid_login') { return [ 'success' => false, - 'sysMessage' => "authentication_error_admin"]; + 'sysMessage' => 'authentication_error_admin']; } $matches = []; @@ -509,7 +509,7 @@ public function patronLogin($username, $password) $cat3, $cat4, $cat5, $expiry, $holds, $status] = explode('|', $response); [$last, $first] = explode(',', $name); - $first = rtrim($first, " "); + $first = rtrim($first, ' '); if ($expiry != '0') { $expiry = $this->parseDateTime(trim($expiry)); @@ -751,12 +751,12 @@ public function cancelHolds($cancelDetails) foreach ($details as $holdKey) { if (in_array($holdKey, $failures)) { $items[$holdKey] = [ - 'success' => false, 'status' => "hold_cancel_fail", + 'success' => false, 'status' => 'hold_cancel_fail', ]; } else { $count++; $items[$holdKey] = [ - 'success' => true, 'status' => "hold_cancel_success", + 'success' => true, 'status' => 'hold_cancel_success', ]; } } @@ -1062,7 +1062,7 @@ protected function parseStatusLine($line) $holdcount, $library_code, $library, $location_code, $location, $currLocCode, $current_location, $holdable, $circulation_rule, $duedate, $date_recalled, $recall_period, $format, $title_holds] - = explode("|", $line); + = explode('|', $line); // availability $availability = ($number_of_charges == 0) ? 1 : 0; @@ -1192,10 +1192,10 @@ protected function querySirsi($params) if (empty($url)) { $url = $this->host; if ($this->port) { - $url = "http://" . $url . ":" . $this->port . "/" . + $url = 'http://' . $url . ':' . $this->port . '/' . $this->search_prog; } else { - $url = "http://" . $url . "/" . $this->search_prog; + $url = 'http://' . $url . '/' . $this->search_prog; } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php index 54931dfb90a..d6c0fe1654a 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php @@ -103,58 +103,58 @@ public function getStatus($id) $holding = []; // Strip off the prefix from vtls exports - $db_id = str_replace("vtls", "", $id); + $db_id = str_replace('vtls', '', $id); // Build SQL Statement - $sql = "SELECT d.itemid AS item_id, c.due_date, s.name AS status, " . - "s.status_code, l.name AS location, " . - "SUBSTR(d.location, 0, 1) as camp_id, " . + $sql = 'SELECT d.itemid AS item_id, c.due_date, s.name AS status, ' . + 's.status_code, l.name AS location, ' . + 'SUBSTR(d.location, 0, 1) as camp_id, ' . "DECODE(h.req_num, null, 'N', 'Y') AS reserve, " . - "b.call_number AS bib_call_num, " . - "i.call_number AS item_call_num " . - "FROM dbadmin.itemdetl2 d, dbadmin.location l, " . - "dbadmin.statdetl sd, dbadmin.item_status s, " . - "dbadmin.circdetl c, dbadmin.bibliographic_fields b, " . - "dbadmin.item_call_number i, " . - - "(SELECT d1.itemid, MAX(h1.request_control_number) AS req_num " . - " FROM dbadmin.itemdetl2 d1, dbadmin.hlrcdetl h1 " . - " WHERE (d1.itemid = h1.itemid " . - " OR (d1.bibid = h1.bibid " . - " AND " . - " h1.itemid is null)) " . - " AND d1.bibid = :bib_id " . - " GROUP BY d1.itemid " . - ") h " . - - "WHERE d.location = l.location_id " . - "AND d.itemid = sd.itemid (+) " . - "AND sd.stat = s.status_code (+) " . - "AND d.itemid = c.itemid (+) " . - "AND d.itemid = h.itemid (+) " . - "AND d.itemid = i.itemid (+) " . - "AND d.bibid = b.bib_id " . - "AND d.bibid = :bib_id"; + 'b.call_number AS bib_call_num, ' . + 'i.call_number AS item_call_num ' . + 'FROM dbadmin.itemdetl2 d, dbadmin.location l, ' . + 'dbadmin.statdetl sd, dbadmin.item_status s, ' . + 'dbadmin.circdetl c, dbadmin.bibliographic_fields b, ' . + 'dbadmin.item_call_number i, ' . + + '(SELECT d1.itemid, MAX(h1.request_control_number) AS req_num ' . + ' FROM dbadmin.itemdetl2 d1, dbadmin.hlrcdetl h1 ' . + ' WHERE (d1.itemid = h1.itemid ' . + ' OR (d1.bibid = h1.bibid ' . + ' AND ' . + ' h1.itemid is null)) ' . + ' AND d1.bibid = :bib_id ' . + ' GROUP BY d1.itemid ' . + ') h ' . + + 'WHERE d.location = l.location_id ' . + 'AND d.itemid = sd.itemid (+) ' . + 'AND sd.stat = s.status_code (+) ' . + 'AND d.itemid = c.itemid (+) ' . + 'AND d.itemid = h.itemid (+) ' . + 'AND d.itemid = i.itemid (+) ' . + 'AND d.bibid = b.bib_id ' . + 'AND d.bibid = :bib_id'; // Bind our bib_id and execute - $fields = ["bib_id:string" => $db_id]; + $fields = ['bib_id:string' => $db_id]; $result = $this->db->simpleSelect($sql, $fields); // If there are no results, lets try again because it has no items if (count($result) == 0) { - $sql = "SELECT b.call_number " . - "FROM dbadmin.bibliographic_fields b " . - "WHERE b.bib_id = :bib_id"; + $sql = 'SELECT b.call_number ' . + 'FROM dbadmin.bibliographic_fields b ' . + 'WHERE b.bib_id = :bib_id'; $result = $this->db->simpleSelect($sql, $fields); if (count($result) > 0) { $new_holding = [ 'id' => $id, 'availability' => false, - 'reserve' => "Y", + 'reserve' => 'Y', 'status' => null, - 'location' => "Toowoomba", - 'campus' => "Toowoomba", + 'location' => 'Toowoomba', + 'campus' => 'Toowoomba', 'callnumber' => $result[0]['CALL_NUMBER'], ]; @@ -162,26 +162,26 @@ public function getStatus($id) case 'ELECTRONIC RESOURCE': $new_holding['availability'] = true; $new_holding['status'] = null; - $new_holding['location'] = "Online"; - $new_holding['reserve'] = "N"; + $new_holding['location'] = 'Online'; + $new_holding['reserve'] = 'N'; $holding[] = $new_holding; return $holding; break; case 'ON ORDER': - $new_holding['status'] = "ON ORDER"; - $new_holding['location'] = "Pending..."; + $new_holding['status'] = 'ON ORDER'; + $new_holding['location'] = 'Pending...'; $holding[] = $new_holding; return $holding; break; case 'ORDER CANCELLED': - $new_holding['status'] = "ORDER CANCELLED"; - $new_holding['location'] = "None"; + $new_holding['status'] = 'ORDER CANCELLED'; + $new_holding['location'] = 'None'; $holding[] = $new_holding; return $holding; break; case 'MISSING': - $new_holding['status'] = "MISSING"; - $new_holding['location'] = "Unknown"; + $new_holding['status'] = 'MISSING'; + $new_holding['location'] = 'Unknown'; $holding[] = $new_holding; return $holding; break; @@ -190,11 +190,11 @@ public function getStatus($id) // Still haven't found it. Let's check if it has a serials // holding location $call_number = $result[0]['CALL_NUMBER']; - $sql = "SELECT l.name, " . - "SUBSTR(l.location_id, 0, 1) as camp_id " . - "FROM dbadmin.holdlink h, location l " . - "WHERE h.location = l.location_id " . - "AND h.bibid = :bib_id"; + $sql = 'SELECT l.name, ' . + 'SUBSTR(l.location_id, 0, 1) as camp_id ' . + 'FROM dbadmin.holdlink h, location l ' . + 'WHERE h.location = l.location_id ' . + 'AND h.bibid = :bib_id'; $result = $this->db->simpleSelect($sql, $fields); if (count($result) > 0) { @@ -203,21 +203,21 @@ public function getStatus($id) // TODO: create a configuration file mechanism for // specifying locations so we can eliminate these // hard-coded USQ-specific values. - switch ($r["CAMP_ID"]) { + switch ($r['CAMP_ID']) { case 4: - $campus = "Fraser Coast"; + $campus = 'Fraser Coast'; break; case 5: - $campus = "Springfield"; + $campus = 'Springfield'; break; default: - $campus = "Toowoomba"; + $campus = 'Toowoomba'; break; } - $tmp_holding['status'] = "Not For Loan"; + $tmp_holding['status'] = 'Not For Loan'; $tmp_holding['location'] = $r['NAME']; - $tmp_holding['reserve'] = "N"; + $tmp_holding['reserve'] = 'N'; $tmp_holding['campus'] = $campus; $tmp_holding['callnumber'] = $call_number; $holding[] = $tmp_holding; @@ -239,15 +239,15 @@ public function getStatus($id) foreach ($result as $row) { // TODO: create a configuration file mechanism for specifying locations // so we can eliminate these hard-coded USQ-specific values. - switch ($row["CAMP_ID"]) { + switch ($row['CAMP_ID']) { case 4: - $campus = "Fraser Coast"; + $campus = 'Fraser Coast'; break; case 5: - $campus = "Springfield"; + $campus = 'Springfield'; break; default: - $campus = "Toowoomba"; + $campus = 'Toowoomba'; break; } @@ -341,62 +341,62 @@ public function getStatuses($idList) public function getHolding($id, array $patron = null, array $options = []) { // Strip off the prefix from vtls exports - $db_id = str_replace("vtls", "", $id); - $fields = ["bib_id:string" => $db_id]; - - $holds = "SELECT d1.itemid, MAX(h1.request_control_number) AS req_num " . - "FROM dbadmin.itemdetl2 d1, dbadmin.hlrcdetl h1 " . - "WHERE d1.itemid = h1.itemid " . - "AND d1.bibid = :bib_id " . - "GROUP BY d1.itemid"; - - $bib_reqs = "SELECT h.bibid, count(*) as bib_req " . - "FROM hlrcdetl h " . - "WHERE h.itemid = 0 " . - "GROUP BY h.bibid"; - - $item_reqs = "SELECT h.itemid, count(*) as item_req " . - "FROM hlrcdetl h " . - "WHERE h.itemid <> 0 " . - "GROUP BY h.itemid"; - - $issues = "SELECT MAX(s.issue_id) AS latest_issue, h.bibid " . - "FROM serials_issue s, holdlink h " . - "WHERE h.bibid = :bib_id " . - "AND h.holdingsid = s.holdingsid " . - "GROUP BY h.bibid"; - - $reserve_class = "SELECT DISTINCT item_id, item_class " . - " FROM reserve_item_v"; + $db_id = str_replace('vtls', '', $id); + $fields = ['bib_id:string' => $db_id]; + + $holds = 'SELECT d1.itemid, MAX(h1.request_control_number) AS req_num ' . + 'FROM dbadmin.itemdetl2 d1, dbadmin.hlrcdetl h1 ' . + 'WHERE d1.itemid = h1.itemid ' . + 'AND d1.bibid = :bib_id ' . + 'GROUP BY d1.itemid'; + + $bib_reqs = 'SELECT h.bibid, count(*) as bib_req ' . + 'FROM hlrcdetl h ' . + 'WHERE h.itemid = 0 ' . + 'GROUP BY h.bibid'; + + $item_reqs = 'SELECT h.itemid, count(*) as item_req ' . + 'FROM hlrcdetl h ' . + 'WHERE h.itemid <> 0 ' . + 'GROUP BY h.itemid'; + + $issues = 'SELECT MAX(s.issue_id) AS latest_issue, h.bibid ' . + 'FROM serials_issue s, holdlink h ' . + 'WHERE h.bibid = :bib_id ' . + 'AND h.holdingsid = s.holdingsid ' . + 'GROUP BY h.bibid'; + + $reserve_class = 'SELECT DISTINCT item_id, item_class ' . + ' FROM reserve_item_v'; // Build SQL Statement - $sql = "SELECT d.itemid as item_id, d.copyno, d.barcode, c.due_date, " . - "s.name as status, s.status_code, " . - "l.name as location, l.location_id, b.call_number as bib_call_num, " . - "i.call_number as item_call_num, " . - "iss.latest_issue, r.item_class as reserve_item_class, " . - "ic.item_class, d.units, " . - "br.bib_req, ir.item_req " . - "FROM dbadmin.itemdetl2 d, dbadmin.location l, " . - "dbadmin.statdetl sd, dbadmin.item_status s, " . - "dbadmin.circdetl c, dbadmin.bibliographic_fields b, " . - "dbadmin.item_call_number i, item_class_v ic, " . + $sql = 'SELECT d.itemid as item_id, d.copyno, d.barcode, c.due_date, ' . + 's.name as status, s.status_code, ' . + 'l.name as location, l.location_id, b.call_number as bib_call_num, ' . + 'i.call_number as item_call_num, ' . + 'iss.latest_issue, r.item_class as reserve_item_class, ' . + 'ic.item_class, d.units, ' . + 'br.bib_req, ir.item_req ' . + 'FROM dbadmin.itemdetl2 d, dbadmin.location l, ' . + 'dbadmin.statdetl sd, dbadmin.item_status s, ' . + 'dbadmin.circdetl c, dbadmin.bibliographic_fields b, ' . + 'dbadmin.item_call_number i, item_class_v ic, ' . "($holds) h, ($bib_reqs) br, ($item_reqs) ir, ($issues) iss, " . "($reserve_class) r " . - "WHERE d.location = l.location_id " . - "AND d.itemclass = ic.item_class_id " . - "AND d.itemid = sd.itemid (+) " . - "AND sd.stat = s.status_code (+) " . - "AND d.itemid = c.itemid (+) " . - "AND d.itemid = h.itemid (+) " . - "AND d.bibid = br.bibid (+) " . - "AND d.itemid = ir.itemid (+) " . - "AND d.itemid = i.itemid (+) " . - "AND d.itemid = r.item_id (+) " . - "AND d.bibid = iss.bibid (+) " . - "AND d.bibid = b.bib_id " . - "AND d.bibid = :bib_id " . - "ORDER BY l.location_id, d.units_sort_form desc, d.copyno"; + 'WHERE d.location = l.location_id ' . + 'AND d.itemclass = ic.item_class_id ' . + 'AND d.itemid = sd.itemid (+) ' . + 'AND sd.stat = s.status_code (+) ' . + 'AND d.itemid = c.itemid (+) ' . + 'AND d.itemid = h.itemid (+) ' . + 'AND d.bibid = br.bibid (+) ' . + 'AND d.itemid = ir.itemid (+) ' . + 'AND d.itemid = i.itemid (+) ' . + 'AND d.itemid = r.item_id (+) ' . + 'AND d.bibid = iss.bibid (+) ' . + 'AND d.bibid = b.bib_id ' . + 'AND d.bibid = :bib_id ' . + 'ORDER BY l.location_id, d.units_sort_form desc, d.copyno'; //print "
$sql
"; $result = $this->db->simpleSelect($sql, $fields); @@ -445,20 +445,20 @@ public function getHolding($id, array $patron = null, array $options = []) } $temp = [ - "id" => $id, - "availability" => $available, - "status" => $row['STATUS'], - "status_code" => $row['STATUS_CODE'], - "location" => $row['LOCATION'], - "location_code" => $row['LOCATION_ID'], - "reserve" => $row['ITEM_REQ'] + $row['BIB_REQ'], - "callnumber" => $call_num, - "duedate" => $row['DUE_DATE'], - "number" => $row['COPYNO'], - "barcode" => $row['BARCODE'], - "itemclass" => $row['ITEM_CLASS'], - "units" => $row['UNITS'], - "resitemclass" => $row['RESERVE_ITEM_CLASS'], + 'id' => $id, + 'availability' => $available, + 'status' => $row['STATUS'], + 'status_code' => $row['STATUS_CODE'], + 'location' => $row['LOCATION'], + 'location_code' => $row['LOCATION_ID'], + 'reserve' => $row['ITEM_REQ'] + $row['BIB_REQ'], + 'callnumber' => $call_num, + 'duedate' => $row['DUE_DATE'], + 'number' => $row['COPYNO'], + 'barcode' => $row['BARCODE'], + 'itemclass' => $row['ITEM_CLASS'], + 'units' => $row['UNITS'], + 'resitemclass' => $row['RESERVE_ITEM_CLASS'], ]; // Add to the holdings array @@ -485,11 +485,11 @@ public function getHolding($id, array $patron = null, array $options = []) protected function checkHoldAllowed($patron_id, $holdings) { // Get the patron type - $sql = "SELECT p.patron_type_id " . - "FROM patron_type_patron p, patron_barcode b " . - "WHERE b.patron_id = p.patron_id " . - "AND b.barcode = :patron"; - $fields = ["patron:string" => $patron_id]; + $sql = 'SELECT p.patron_type_id ' . + 'FROM patron_type_patron p, patron_barcode b ' . + 'WHERE b.patron_id = p.patron_id ' . + 'AND b.barcode = :patron'; + $fields = ['patron:string' => $patron_id]; $result = $this->db->simpleSelect($sql, $fields); // We should have 1 row and only 1 row. @@ -514,7 +514,7 @@ protected function checkHoldAllowed($patron_id, $holdings) '4' => ['UF', 'PF', 'AF'], ]; // Where is the patron from? - $location = ""; + $location = ''; foreach ($type_list as $loc => $patron_types) { if (in_array($patron_type, $patron_types)) { $location = $loc; @@ -523,12 +523,12 @@ protected function checkHoldAllowed($patron_id, $holdings) // Requestable Statuses // TODO: Make this configurable through Virtua.ini. $status_list = [ - "4401", // At Repair - "4705", // ON HOLD - "5400", // Being Processed - "5401", // On Display - "5402", // 24 Hour Hold - "5700", // IN TRANSIT + '4401', // At Repair + '4705', // ON HOLD + '5400', // Being Processed + '5401', // On Display + '5402', // 24 Hour Hold + '5700', // IN TRANSIT ]; // Who can place reservations on available items $available_locs = [ @@ -575,7 +575,7 @@ protected function checkHoldAllowed($patron_id, $holdings) // Everyone else we need to do some lookups // Can't find their location? - if ($location == "") { + if ($location == '') { $h['req_allowed'] = false; } else { // Known location @@ -583,7 +583,7 @@ protected function checkHoldAllowed($patron_id, $holdings) // Details about this item -- note that we use 1/0 for // $item_is_out since digits display better in on screen // debugging than booleans. - $item_is_out = $h['duedate'] ? "1" : "0"; + $item_is_out = $h['duedate'] ? '1' : '0'; $item_loc_code = substr($h['location_code'], 0, 1); $item_stat_code = $h['status_code']; @@ -678,18 +678,18 @@ protected function renderPartSubPattern($data) // Handle empty patterns if (count($data) == 0) { - return ""; + return ''; } // Test the first element $is_chrono = strpos($data['pattern'][0], '('); - $return_string = ""; + $return_string = ''; // NON chrono if ($is_chrono === false) { $i = 0; foreach ($data['pattern'] as $d) { - $return_string .= $d . " " . $data['data'][$i] . " "; + $return_string .= $d . ' ' . $data['data'][$i] . ' '; $i++; } } else { @@ -697,131 +697,131 @@ protected function renderPartSubPattern($data) // Important note: strtotime() expects // 01/02/2000 = 2nd Jan 2000 // 01-02-2000 = 1st Feb 2000 <= Use hyphens - $pattern = implode("", $data['pattern']); + $pattern = implode('', $data['pattern']); switch (strtolower(trim($pattern))) { // Error case - case "": + case '': return null; break; // Year only - case "(year)": - return $data['data'][0] . " "; + case '(year)': + return $data['data'][0] . ' '; break; // Year + Month - case "(year)(month)": - $months = explode("-", $data['data'][1]); + case '(year)(month)': + $months = explode('-', $data['data'][1]); $m = count($months); - $years = explode("-", $data['data'][0]); + $years = explode('-', $data['data'][0]); $y = count($years); $my = $m . $y; - $start_time = strtotime("01-" . $months[0] . "-" . $years[0]); - $end_string = "F Y"; + $start_time = strtotime('01-' . $months[0] . '-' . $years[0]); + $end_string = 'F Y'; switch ($my) { // January 2000 - February 2001 - case "22": - $start_string = "F Y"; + case '22': + $start_string = 'F Y'; $end_time - = strtotime("01-" . $months[1] . "-" . $years[1]); + = strtotime('01-' . $months[1] . '-' . $years[1]); break; // January - February 2000 - case "21": - $start_string = "F"; + case '21': + $start_string = 'F'; $end_time - = strtotime("01-" . $months[1] . "-" . $years[0]); + = strtotime('01-' . $months[1] . '-' . $years[0]); break; // January 2000 - case "11": - $start_string = "F Y"; + case '11': + $start_string = 'F Y'; $end_time = null; break; // January 2000 - January 2001 - case "12": - $start_string = "F Y"; + case '12': + $start_string = 'F Y'; $end_time - = strtotime("01-" . $months[0] . "-" . $years[1]); + = strtotime('01-' . $months[0] . '-' . $years[1]); break; } if ($end_time != null) { - return date($start_string, $start_time) . " - " . + return date($start_string, $start_time) . ' - ' . date($end_string, $end_time); } else { return date($start_string, $start_time); } break; // Year + Month + Day - case "(year)(month)(day)": - $days = explode("-", $data['data'][2]); + case '(year)(month)(day)': + $days = explode('-', $data['data'][2]); $d = count($days); - $months = explode("-", $data['data'][1]); + $months = explode('-', $data['data'][1]); $m = count($months); - $years = explode("-", $data['data'][0]); + $years = explode('-', $data['data'][0]); $y = count($years); $dmy = $d . $m . $y; $start_time - = strtotime($days[0] . "-" . $months[0] . "-" . $years[0]); - $end_string = "jS F Y"; + = strtotime($days[0] . '-' . $months[0] . '-' . $years[0]); + $end_string = 'jS F Y'; switch ($dmy) { // 01 January 2000 - case "111": - $start_string = "jS F Y"; + case '111': + $start_string = 'jS F Y'; $end_time = null; break; // 01 January 2000 - 01 January 2001 - case "112": - $start_string = "jS F Y"; + case '112': + $start_string = 'jS F Y'; $end_time = strtotime( - $days[0] . "-" . $months[0] . "-" . $years[1] + $days[0] . '-' . $months[0] . '-' . $years[1] ); break; // 01 January - 01 February 2000 - case "121": - $start_string = "jS F"; + case '121': + $start_string = 'jS F'; $end_time = strtotime( - $days[0] . "-" . $months[1] . "-" . $years[0] + $days[0] . '-' . $months[1] . '-' . $years[0] ); break; // 01 January 2000 - 01 February 2001 - case "122": - $start_string = "jS F Y"; + case '122': + $start_string = 'jS F Y'; $end_time = strtotime( - $days[0] . "-" . $months[1] . "-" . $years[1] + $days[0] . '-' . $months[1] . '-' . $years[1] ); break; // 01 - 02 January 2000 - case "211": - $start_string = "jS"; + case '211': + $start_string = 'jS'; $end_time = strtotime( - $days[1] . "-" . $months[0] . "-" . $years[0] + $days[1] . '-' . $months[0] . '-' . $years[0] ); break; // 01 January 2000 - 02 January 2001 - case "212": - $start_string = "jS F Y"; + case '212': + $start_string = 'jS F Y'; $end_time = strtotime( - $days[1] . "-" . $months[0] . "-" . $years[1] + $days[1] . '-' . $months[0] . '-' . $years[1] ); break; // 01 January - 02 February 2000 - case "221": - $start_string = "jS F"; + case '221': + $start_string = 'jS F'; $end_time = strtotime( - $days[1] . "-" . $months[1] . "-" . $years[0] + $days[1] . '-' . $months[1] . '-' . $years[0] ); break; // 01 January 2000 - 02 February 2001 - case "222": - $start_string = "jS F Y"; + case '222': + $start_string = 'jS F Y'; $end_time = strtotime( - $days[1] . "-" . $months[1] . "-" . $years[1] + $days[1] . '-' . $months[1] . '-' . $years[1] ); break; } if ($end_time != null) { - return date($start_string, $start_time) . " - " . + return date($start_string, $start_time) . ' - ' . date($end_string, $end_time); } else { return date($start_string, $start_time); @@ -830,7 +830,7 @@ protected function renderPartSubPattern($data) default: $i = 0; foreach ($data['pattern'] as $d) { - $return_string .= $d . " " . $data['data'][$i] . " "; + $return_string .= $d . ' ' . $data['data'][$i] . ' '; $i++; } break; @@ -854,7 +854,7 @@ protected function renderPartSubPattern($data) */ protected function renderSubPattern($data) { - $return_string = ""; + $return_string = ''; $sub_pattern = []; $i = 0; foreach ($data['pattern'] as $p) { @@ -902,7 +902,7 @@ protected function renderOtherPattern($data) $i = 0; foreach ($data['data'] as $d) { switch ($data['pattern_code'][$i]) { - case "z": + case 'z': $return['notes'][] = $d; break; default: @@ -978,7 +978,7 @@ protected function renderSerialHoldings($holdings_marc) foreach ($holdings_marc as $row) { if ( $row['SUBFIELD_DATA'] != null - && trim($row['SUBFIELD_DATA']) != "" + && trim($row['SUBFIELD_DATA']) != '' ) { $data_set[$row['FIELD_SEQUENCE']][] = [ 'tag' => trim($row['FIELD_TAG']), @@ -1005,7 +1005,7 @@ protected function renderSerialHoldings($holdings_marc) $sort = explode('.', $subfield['data']); $sort_rule = $sort[0]; $sort_order = $sort[1] ?? 0; - $sort_order = sprintf("%05d", $sort_order); + $sort_order = sprintf('%05d', $sort_order); } else { // Everything else goes in the data bucket $data[] = [ @@ -1014,7 +1014,7 @@ protected function renderSerialHoldings($holdings_marc) ]; } } - $sort_set[$sort_rule . "." . $sort_order] = [ + $sort_set[$sort_rule . '.' . $sort_order] = [ 'tag' => $tag, 'data' => $data, ]; @@ -1062,15 +1062,15 @@ protected function renderSerialHoldings($holdings_marc) public function getPurchaseHistory($id) { // Strip off the prefix from vtls exports - $db_id = str_replace("vtls", "", $id); - $fields = ["bib_id:string" => $db_id]; + $db_id = str_replace('vtls', '', $id); + $fields = ['bib_id:string' => $db_id]; // Let's go check if this bib id is for a serial - $sql = "SELECT h.holdingsid, l.name " . - "FROM dbadmin.holdlink h, dbadmin.location l " . - "WHERE h.bibid = :bib_id " . - "AND h.masked = 0 " . - "AND h.location = l.location_id"; + $sql = 'SELECT h.holdingsid, l.name ' . + 'FROM dbadmin.holdlink h, dbadmin.location l ' . + 'WHERE h.bibid = :bib_id ' . + 'AND h.masked = 0 ' . + 'AND h.location = l.location_id'; $result = $this->db->simpleSelect($sql, $fields); @@ -1079,16 +1079,16 @@ public function getPurchaseHistory($id) return []; } - $sql = "SELECT * " . - "FROM dbadmin.iso_2709 i " . - "WHERE i.id = :hid " . - "AND i.idtype = 104 " . + $sql = 'SELECT * ' . + 'FROM dbadmin.iso_2709 i ' . + 'WHERE i.id = :hid ' . + 'AND i.idtype = 104 ' . "AND i.field_tag in ('853', '863', '866') " . - "ORDER BY i.field_sequence, i.subfield_sequence"; + 'ORDER BY i.field_sequence, i.subfield_sequence'; $data = []; foreach ($result as $row) { - $fields = ["hid:string" => $row['HOLDINGSID']]; + $fields = ['hid:string' => $row['HOLDINGSID']]; $hresult = $this->db->simpleSelect($sql, $fields); $data[$row['NAME']] = $this->renderSerialHoldings($hresult); } @@ -1104,11 +1104,11 @@ public function getPurchaseHistory($id) */ public function getAll853() { - $sql = "SELECT * " . - "FROM dbadmin.iso_2709 i " . - "WHERE i.idtype = 104 " . + $sql = 'SELECT * ' . + 'FROM dbadmin.iso_2709 i ' . + 'WHERE i.idtype = 104 ' . "AND i.field_tag in ('853') " . - "ORDER BY i.field_sequence, i.subfield_sequence"; + 'ORDER BY i.field_sequence, i.subfield_sequence'; $hresult = $this->db->simpleSelect($sql); if (count($hresult) == 0) { return null; @@ -1118,9 +1118,9 @@ public function getAll853() foreach ($hresult as $row) { if ( $row['SUBFIELD_DATA'] != null - && trim($row['SUBFIELD_DATA']) != "" + && trim($row['SUBFIELD_DATA']) != '' ) { - $data_set[$row['ID'] . "_" . $row['FIELD_SEQUENCE']][] = [ + $data_set[$row['ID'] . '_' . $row['FIELD_SEQUENCE']][] = [ 'id' => trim($row['ID']), 'code' => trim($row['SUBFIELD_CODE']), 'data' => trim($row['SUBFIELD_DATA']), @@ -1146,21 +1146,21 @@ public function getAll853() */ public function patronLogin($barcode, $password) { - $sql = "SELECT i.id, b.barcode, i.subfield_data AS password, p.name, " . - "p.e_mail_address_primary, p.department " . - "FROM dbadmin.iso_2709 i, dbadmin.patron p, dbadmin.patron_barcode b " . - "WHERE i.idtype = 105 " . + $sql = 'SELECT i.id, b.barcode, i.subfield_data AS password, p.name, ' . + 'p.e_mail_address_primary, p.department ' . + 'FROM dbadmin.iso_2709 i, dbadmin.patron p, dbadmin.patron_barcode b ' . + 'WHERE i.idtype = 105 ' . "AND i.field_tag = '015' " . "AND i.subfield_code = 'b' " . - "AND p.patron_id = i.id " . - "AND b.patron_id = i.id " . - "AND i.id = ( " . - " SELECT p.patron_id AS id " . - " FROM dbadmin.patron_barcode p " . - " WHERE UPPER(p.barcode) = UPPER(:barcode) " . - ")"; - - $fields = ["barcode:string" => $barcode]; + 'AND p.patron_id = i.id ' . + 'AND b.patron_id = i.id ' . + 'AND i.id = ( ' . + ' SELECT p.patron_id AS id ' . + ' FROM dbadmin.patron_barcode p ' . + ' WHERE UPPER(p.barcode) = UPPER(:barcode) ' . + ')'; + + $fields = ['barcode:string' => $barcode]; $result = $this->db->simpleSelect($sql, $fields); if (count($result) > 0) { @@ -1207,15 +1207,15 @@ public function patronLogin($barcode, $password) */ public function getMyProfile($patron) { - $sql = "SELECT p.name, p.street_address_1, p.street_address_2, p.city, " . - "p.postal_code, p.telephone_primary, t.name as patron_type " . - "FROM dbadmin.patron_type_patron pt, dbadmin.patron p, " . - "dbadmin.patron_type t " . - "WHERE p.patron_id = pt.patron_id " . - "AND t.patron_type_id = pt.patron_type_id " . - "AND p.patron_id = :patron_id"; - - $fields = ["patron_id:string" => $patron['id']]; + $sql = 'SELECT p.name, p.street_address_1, p.street_address_2, p.city, ' . + 'p.postal_code, p.telephone_primary, t.name as patron_type ' . + 'FROM dbadmin.patron_type_patron pt, dbadmin.patron p, ' . + 'dbadmin.patron_type t ' . + 'WHERE p.patron_id = pt.patron_id ' . + 'AND t.patron_type_id = pt.patron_type_id ' . + 'AND p.patron_id = :patron_id'; + + $fields = ['patron_id:string' => $patron['id']]; $result = $this->db->simpleSelect($sql, $fields); if (count($result) > 0) { @@ -1239,7 +1239,7 @@ public function getMyProfile($patron) if ($result[0]['CITY'] != null) { if (strlen($patron['address2']) > 0) { - $patron['address2'] .= ", " . trim($result[0]['CITY']); + $patron['address2'] .= ', ' . trim($result[0]['CITY']); } else { $patron['address2'] = trim($result[0]['CITY']); } @@ -1266,26 +1266,26 @@ public function getMyFines($patron) { $fineList = []; - $sql = "SELECT a.assessment_amount fine_amount, f.description, " . - "a.balance, a.item_due_date due_date, i.bibid bib_id " . - "FROM patron_account a, fine_code_v f, itemdetl2 i " . - "WHERE a.state = 0 " . - "AND a.balance > 0 " . - "AND a.itemid = i.itemid " . - "AND a.fine_code_id = f.fine_code_id " . - "AND a.patron_id = :patron_id"; + $sql = 'SELECT a.assessment_amount fine_amount, f.description, ' . + 'a.balance, a.item_due_date due_date, i.bibid bib_id ' . + 'FROM patron_account a, fine_code_v f, itemdetl2 i ' . + 'WHERE a.state = 0 ' . + 'AND a.balance > 0 ' . + 'AND a.itemid = i.itemid ' . + 'AND a.fine_code_id = f.fine_code_id ' . + 'AND a.patron_id = :patron_id'; - $fields = ["patron_id:string" => $patron['id']]; + $fields = ['patron_id:string' => $patron['id']]; $result = $this->db->simpleSelect($sql, $fields); if (count($result) > 0) { foreach ($result as $row) { $fineList[] = [ - "amount" => $row['FINE_AMOUNT'] * 100, - "fine" => $row['DESCRIPTION'], - "balance" => $row['BALANCE'] * 100, - "duedate" => $row['DUE_DATE'], - "id" => "vtls" . sprintf("%09d", (int)$row['BIB_ID']), + 'amount' => $row['FINE_AMOUNT'] * 100, + 'fine' => $row['DESCRIPTION'], + 'balance' => $row['BALANCE'] * 100, + 'duedate' => $row['DUE_DATE'], + 'id' => 'vtls' . sprintf('%09d', (int)$row['BIB_ID']), ]; } } @@ -1307,23 +1307,23 @@ public function getMyHolds($patron) { $holdList = []; - $sql = "SELECT h.bibid, l.name pickup_location, h.pickup_any_location, " . - "h.date_last_needed, h.date_placed, h.request_control_number " . - "FROM dbadmin.hlrcdetl h, dbadmin.location l " . - "WHERE h.pickup_location = l.location_id " . - "AND h.patron_id = :patron_id"; + $sql = 'SELECT h.bibid, l.name pickup_location, h.pickup_any_location, ' . + 'h.date_last_needed, h.date_placed, h.request_control_number ' . + 'FROM dbadmin.hlrcdetl h, dbadmin.location l ' . + 'WHERE h.pickup_location = l.location_id ' . + 'AND h.patron_id = :patron_id'; - $fields = ["patron_id:string" => $patron['id']]; + $fields = ['patron_id:string' => $patron['id']]; $result = $this->db->simpleSelect($sql, $fields); if (count($result) > 0) { foreach ($result as $row) { $holdList[] = [ - "id" => "vtls" . sprintf("%09d", (int)$row['BIBID']), - "location" => $row['PICKUP_LOCATION'], - "expire" => $row['DATE_LAST_NEEDED'], - "create" => $row['DATE_PLACED'], - "reqnum" => $row['REQUEST_CONTROL_NUMBER'], + 'id' => 'vtls' . sprintf('%09d', (int)$row['BIBID']), + 'location' => $row['PICKUP_LOCATION'], + 'expire' => $row['DATE_LAST_NEEDED'], + 'create' => $row['DATE_PLACED'], + 'reqnum' => $row['REQUEST_CONTROL_NUMBER'], ]; } } @@ -1346,25 +1346,25 @@ public function getMyTransactions($patron) { $transList = []; - $bib_reqs = "SELECT h.bibid, count(*) as bib_req " . - "FROM hlrcdetl h " . - "WHERE h.itemid = 0 " . - "GROUP BY h.bibid"; - $item_reqs = "SELECT h.itemid, count(*) as item_req " . - "FROM hlrcdetl h " . - "WHERE h.itemid <> 0 " . - "GROUP BY h.itemid"; - - $sql = "SELECT i.bibid, i.itemid, c.due_date, i.barcode, " . - "c.renew_count, (br.bib_req + ir.item_req) as req_count " . + $bib_reqs = 'SELECT h.bibid, count(*) as bib_req ' . + 'FROM hlrcdetl h ' . + 'WHERE h.itemid = 0 ' . + 'GROUP BY h.bibid'; + $item_reqs = 'SELECT h.itemid, count(*) as item_req ' . + 'FROM hlrcdetl h ' . + 'WHERE h.itemid <> 0 ' . + 'GROUP BY h.itemid'; + + $sql = 'SELECT i.bibid, i.itemid, c.due_date, i.barcode, ' . + 'c.renew_count, (br.bib_req + ir.item_req) as req_count ' . "FROM circdetl c, itemdetl2 i, ($bib_reqs) br, ($item_reqs) ir " . - "WHERE c.itemid = i.itemid " . - "AND i.bibid = br.bibid (+) " . - "AND i.itemid = ir.itemid (+) " . - "AND c.patron_id = :patron_id " . - "ORDER BY c.due_date"; + 'WHERE c.itemid = i.itemid ' . + 'AND i.bibid = br.bibid (+) ' . + 'AND i.itemid = ir.itemid (+) ' . + 'AND c.patron_id = :patron_id ' . + 'ORDER BY c.due_date'; - $fields = ["patron_id:string" => $patron['id']]; + $fields = ['patron_id:string' => $patron['id']]; $result = $this->db->simpleSelect($sql, $fields); if (count($result) > 0) { @@ -1375,7 +1375,7 @@ public function getMyTransactions($patron) 'renew' => $row['RENEW_COUNT'], 'request' => $row['REQ_COUNT'], // IDs need to show as 'vtls000589589' - 'id' => "vtls" . sprintf("%09d", (int)$row['BIBID']), + 'id' => 'vtls' . sprintf('%09d', (int)$row['BIBID']), ]; } } @@ -1394,11 +1394,11 @@ public function getCourses() { $courseList = []; - $sql = "SELECT DISTINCT l.course_id " . - "FROM reserve_list_v l, reserve_item_v i " . - "WHERE l.Reserve_list_id = i.Reserve_list_id " . - "AND SYSDATE BETWEEN i.Begin_date AND i.End_date " . - "ORDER BY l.course_id"; + $sql = 'SELECT DISTINCT l.course_id ' . + 'FROM reserve_list_v l, reserve_item_v i ' . + 'WHERE l.Reserve_list_id = i.Reserve_list_id ' . + 'AND SYSDATE BETWEEN i.Begin_date AND i.End_date ' . + 'ORDER BY l.course_id'; $result = $this->db->simpleSelect($sql); if (count($result) > 0) { @@ -1428,18 +1428,18 @@ public function findReserves($course, $inst = false, $dept = false) { $recordList = []; - $sql = "SELECT DISTINCT d.bibid " . - "FROM reserve_item_v i, reserve_list_v l, itemdetl2 d " . - "WHERE i.Reserve_list_id = l.Reserve_list_id " . - "AND SYSDATE BETWEEN i.Begin_date AND i.End_date " . - "AND i.Item_id = d.itemid " . - "AND l.Course_id = :course"; - $fields = ["course:string" => $course]; + $sql = 'SELECT DISTINCT d.bibid ' . + 'FROM reserve_item_v i, reserve_list_v l, itemdetl2 d ' . + 'WHERE i.Reserve_list_id = l.Reserve_list_id ' . + 'AND SYSDATE BETWEEN i.Begin_date AND i.End_date ' . + 'AND i.Item_id = d.itemid ' . + 'AND l.Course_id = :course'; + $fields = ['course:string' => $course]; $result = $this->db->simpleSelect($sql, $fields); if (count($result) > 0) { foreach ($result as $row) { - $recordList[] = "vtls" . sprintf("%09d", (int)$row['BIBID']); + $recordList[] = 'vtls' . sprintf('%09d', (int)$row['BIBID']); } } @@ -1463,8 +1463,8 @@ public function getOpeningHours($fake_time = null) } else { $time = strtotime('now'); } - $today = date("d-m-Y", $time); - $time_format = "H:i:s"; + $today = date('d-m-Y', $time); + $time_format = 'H:i:s'; // Fix Date Handling $this->db->simpleSql( @@ -1472,10 +1472,10 @@ public function getOpeningHours($fake_time = null) ); // Normal opening hours - $sql = "SELECT campus, open_time, close_time, status " . - "FROM usq_sr_open_normal n " . - "WHERE UPPER(dayofweek) = UPPER(:dow)"; - $fields = ["dow:string" => date("l", $time)]; + $sql = 'SELECT campus, open_time, close_time, status ' . + 'FROM usq_sr_open_normal n ' . + 'WHERE UPPER(dayofweek) = UPPER(:dow)'; + $fields = ['dow:string' => date('l', $time)]; $result = $this->db->simpleSelect($sql, $fields); if (count($result) == 0) { return []; @@ -1495,23 +1495,23 @@ public function getOpeningHours($fake_time = null) } // Opening hours exceptions - $day = strtolower(date("D", $time)); + $day = strtolower(date('D', $time)); // Lowest priority row (numericaly, ie. 1 = most important) - $priority = "SELECT e.campus, MIN(e.priority) as priority " . - "FROM usq_sr_open_except e " . + $priority = 'SELECT e.campus, MIN(e.priority) as priority ' . + 'FROM usq_sr_open_except e ' . "WHERE to_date(:today,'dd/mm/yyyy') " . - "BETWEEN e.except_date_from AND e.except_date_to " . + 'BETWEEN e.except_date_from AND e.except_date_to ' . " AND app_$day = 1 " . - "GROUP BY e.campus"; + 'GROUP BY e.campus'; // Retrieve Exceptions - $sql = "SELECT e.campus, e.open_time, e.close_time, e.status, e.reason " . + $sql = 'SELECT e.campus, e.open_time, e.close_time, e.status, e.reason ' . "FROM ($priority) p, usq_sr_open_except e " . - "WHERE e.campus = p.campus " . - "AND e.priority = p.priority " . + 'WHERE e.campus = p.campus ' . + 'AND e.priority = p.priority ' . "AND to_date(:today,'dd/mm/yyyy') " . - "BETWEEN e.except_date_from AND e.except_date_to " . + 'BETWEEN e.except_date_from AND e.except_date_to ' . "AND app_$day = 1"; - $fields = ["today:string" => date("d/m/Y", $time)]; + $fields = ['today:string' => date('d/m/Y', $time)]; $exceptions = $this->db->simpleSelect($sql, $fields); foreach ($exceptions as $row) { @@ -1551,7 +1551,7 @@ public function placeHold($holdDetails) $last_date = $holdDetails['requiredBy']; // Assume an error response: - $response = ['success' => false, 'status' => "hold_error_fail"]; + $response = ['success' => false, 'status' => 'hold_error_fail']; // Validate input // * Request level @@ -1581,32 +1581,32 @@ public function placeHold($holdDetails) // Still here? Guess the request is valid, lets send it to virtua $virtua_url = $this->getApiBaseUrl() . '?' . // Standard stuff - "search=NOSRCH&function=REQUESTS&reqreqtype=0&reqtype=0" . - "&reqscr=2&reqreqlevel=2&reqidtype=127&reqmincircperiod=" . + 'search=NOSRCH&function=REQUESTS&reqreqtype=0&reqtype=0' . + '&reqscr=2&reqreqlevel=2&reqidtype=127&reqmincircperiod=' . // Item ID "&reqidno=$item_id" . // Patron barcode "&reqpatronbarcode=$patron_id" . // Request Level - "&reqautoadjustlevel=" . $allowed_req_levels[$req_level] . + '&reqautoadjustlevel=' . $allowed_req_levels[$req_level] . // Pickup location - "&reqpickuplocation=" . $allowed_pickup_locs[$pickup_loc] . + '&reqpickuplocation=' . $allowed_pickup_locs[$pickup_loc] . // Last Date - "&reqexpireday=" . date("j", $ts_last_date) . - "&reqexpiremonth=" . date("n", $ts_last_date) . - "&reqexpireyear=" . date("Y", $ts_last_date); + '&reqexpireday=' . date('j', $ts_last_date) . + '&reqexpiremonth=' . date('n', $ts_last_date) . + '&reqexpireyear=' . date('Y', $ts_last_date); // Get the response $result = $this->httpRequest($virtua_url); // Look for an error message - $error_message = "Your request was not processed."; + $error_message = 'Your request was not processed.'; $test = strpos($result, $error_message); // If we succeeded, override the default fail message with success: if ($test === false) { $response['success'] = true; - $response['status'] = "hold_success"; + $response['status'] = 'hold_success'; } return $response; @@ -1664,8 +1664,8 @@ protected function cancelHold($request_number) { $virtua_url = $this->getApiBaseUrl() . '?' . // Standard stuff - "search=NOSRCH&function=REQUESTS&reqreqtype=1&reqtype=0" . - "&reqscr=4&reqreqlevel=2&reqidtype=127" . + 'search=NOSRCH&function=REQUESTS&reqreqtype=1&reqtype=0' . + '&reqscr=4&reqreqlevel=2&reqidtype=127' . //"&reqidno=1000651541" . "&reqctrlnum=$request_number"; @@ -1678,7 +1678,7 @@ protected function cancelHold($request_number) } // Look for an error message - $error_message = "Your request could not be deleted."; + $error_message = 'Your request could not be deleted.'; $test = strpos($result, $error_message); // Return true unless we find the error @@ -1701,20 +1701,20 @@ protected function fakeLogin($patron) { $virtua_url = $this->getApiBaseUrl(); $postParams = [ - "SourceScreen" => "INITREQ", - "conf" => "./chameleon.conf", - "elementcount" => "1", - "function" => "PATRONATTEMPT", - "host" => $this->config['Catalog']['host_string'], - "lng" => $this->getConfiguredLanguage(), - "login" => "1", - "pos" => "1", - "rootsearch" => "KEYWORD", - "search" => "NOSRCH", - "skin" => "homepage", - "patronid" => $patron['cat_username'], - "patronpassword" => $patron['cat_password'], - "patronhost" => $this->config['Catalog']['patron_host'], + 'SourceScreen' => 'INITREQ', + 'conf' => './chameleon.conf', + 'elementcount' => '1', + 'function' => 'PATRONATTEMPT', + 'host' => $this->config['Catalog']['host_string'], + 'lng' => $this->getConfiguredLanguage(), + 'login' => '1', + 'pos' => '1', + 'rootsearch' => 'KEYWORD', + 'search' => 'NOSRCH', + 'skin' => 'homepage', + 'patronid' => $patron['cat_username'], + 'patronpassword' => $patron['cat_password'], + 'patronhost' => $this->config['Catalog']['patron_host'], ]; // Get the response @@ -1780,24 +1780,24 @@ public function renewMyItems($renewDetails) // Have to use raw post data because of the way // virtua expects the barcodes to come across. - $post_data = "function=" . "RENEWAL"; - $post_data .= "&search=" . "PATRON"; - $post_data .= "&sessionid=" . "$session_id"; - $post_data .= "&skin=" . "homepage"; - $post_data .= "&lng=" . $this->getConfiguredLanguage(); - $post_data .= "&inst=" . "consortium"; - $post_data .= "&conf=" . urlencode("./chameleon.conf"); - $post_data .= "&u1=" . "12"; - $post_data .= "&SourceScreen=" . "PATRONACTIVITY"; - $post_data .= "&pos=" . "1"; - $post_data .= "&patronid=" . $patron['cat_username']; - $post_data .= "&patronhost=" + $post_data = 'function=' . 'RENEWAL'; + $post_data .= '&search=' . 'PATRON'; + $post_data .= '&sessionid=' . "$session_id"; + $post_data .= '&skin=' . 'homepage'; + $post_data .= '&lng=' . $this->getConfiguredLanguage(); + $post_data .= '&inst=' . 'consortium'; + $post_data .= '&conf=' . urlencode('./chameleon.conf'); + $post_data .= '&u1=' . '12'; + $post_data .= '&SourceScreen=' . 'PATRONACTIVITY'; + $post_data .= '&pos=' . '1'; + $post_data .= '&patronid=' . $patron['cat_username']; + $post_data .= '&patronhost=' . urlencode($this->config['Catalog']['patron_host']); - $post_data .= "&host=" + $post_data .= '&host=' . urlencode($this->config['Catalog']['host_string']); - $post_data .= "&itembarcode=" . implode("&itembarcode=", $item_list); - $post_data .= "&submit=" . "Renew"; - $post_data .= "&reset=" . "Clear"; + $post_data .= '&itembarcode=' . implode('&itembarcode=', $item_list); + $post_data .= '&submit=' . 'Renew'; + $post_data .= '&reset=' . 'Clear'; $result = $this->httpRequest($virtua_url, null, $post_data); @@ -1812,10 +1812,10 @@ public function renewMyItems($renewDetails) // Yes, so check if the due date changed if ($row['duedate'] != $initial[$row['barcode']]['duedate']) { $row['error'] = false; - $row['renew_text'] = "Item successfully renewed."; + $row['renew_text'] = 'Item successfully renewed.'; } else { $row['error'] = true; - $row['renew_text'] = "Item renewal failed."; + $row['renew_text'] = 'Item renewal failed.'; } $return[] = $row; } else { @@ -1835,9 +1835,9 @@ public function getSuppressedAuthorityRecords() { $list = []; - $sql = "select auth_id " . - "from state_record_authority " . - "WHERE STATE_ID = 1"; + $sql = 'select auth_id ' . + 'from state_record_authority ' . + 'WHERE STATE_ID = 1'; $result = $this->db->simpleSelect($sql); @@ -1848,7 +1848,7 @@ public function getSuppressedAuthorityRecords() } foreach ($result as $row) { - $list[] = 'vtls' . str_pad($row['AUTH_ID'], 9, "0", STR_PAD_LEFT); + $list[] = 'vtls' . str_pad($row['AUTH_ID'], 9, '0', STR_PAD_LEFT); } return $list; } diff --git a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php index adb6888e98e..3d433a98a26 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php @@ -219,7 +219,7 @@ protected function buildSqlFromArray($sql) // Put String Together $sqlString = 'SELECT ' . $modifier . implode(', ', $sql['expressions']); - $sqlString .= " FROM " . implode(", ", $sql['from']); + $sqlString .= ' FROM ' . implode(', ', $sql['from']); $sqlString .= (!empty($sql['where'])) ? ' WHERE ' . implode(' AND ', $sql['where']) : ''; $sqlString .= (!empty($sql['group'])) @@ -369,34 +369,34 @@ protected function getStatusSQL($id) { // Expressions $sqlExpressions = [ - "BIB_ITEM.BIB_ID", "ITEM.ITEM_ID", "MFHD_MASTER.MFHD_ID", - "ITEM.ON_RESERVE", "ITEM_STATUS_DESC as status", - "NVL(LOCATION.LOCATION_DISPLAY_NAME, " . - "LOCATION.LOCATION_NAME) as location", - "MFHD_MASTER.DISPLAY_CALL_NO as callnumber", - "ITEM.TEMP_LOCATION", "ITEM.ITEM_TYPE_ID", - "ITEM.ITEM_SEQUENCE_NUMBER", + 'BIB_ITEM.BIB_ID', 'ITEM.ITEM_ID', 'MFHD_MASTER.MFHD_ID', + 'ITEM.ON_RESERVE', 'ITEM_STATUS_DESC as status', + 'NVL(LOCATION.LOCATION_DISPLAY_NAME, ' . + 'LOCATION.LOCATION_NAME) as location', + 'MFHD_MASTER.DISPLAY_CALL_NO as callnumber', + 'ITEM.TEMP_LOCATION', 'ITEM.ITEM_TYPE_ID', + 'ITEM.ITEM_SEQUENCE_NUMBER', $this->getItemSortSequenceSQL('ITEM.PERM_LOCATION'), ]; // From $sqlFrom = [ - $this->dbName . ".BIB_ITEM", $this->dbName . ".ITEM", - $this->dbName . ".ITEM_STATUS_TYPE", - $this->dbName . ".ITEM_STATUS", - $this->dbName . ".LOCATION", $this->dbName . ".MFHD_ITEM", - $this->dbName . ".MFHD_MASTER", + $this->dbName . '.BIB_ITEM', $this->dbName . '.ITEM', + $this->dbName . '.ITEM_STATUS_TYPE', + $this->dbName . '.ITEM_STATUS', + $this->dbName . '.LOCATION', $this->dbName . '.MFHD_ITEM', + $this->dbName . '.MFHD_MASTER', ]; // Where $sqlWhere = [ - "BIB_ITEM.BIB_ID = :id", - "BIB_ITEM.ITEM_ID = ITEM.ITEM_ID", - "ITEM.ITEM_ID = ITEM_STATUS.ITEM_ID", - "ITEM_STATUS.ITEM_STATUS = ITEM_STATUS_TYPE.ITEM_STATUS_TYPE", - "LOCATION.LOCATION_ID = ITEM.PERM_LOCATION", - "MFHD_ITEM.ITEM_ID = ITEM.ITEM_ID", - "MFHD_MASTER.MFHD_ID = MFHD_ITEM.MFHD_ID", + 'BIB_ITEM.BIB_ID = :id', + 'BIB_ITEM.ITEM_ID = ITEM.ITEM_ID', + 'ITEM.ITEM_ID = ITEM_STATUS.ITEM_ID', + 'ITEM_STATUS.ITEM_STATUS = ITEM_STATUS_TYPE.ITEM_STATUS_TYPE', + 'LOCATION.LOCATION_ID = ITEM.PERM_LOCATION', + 'MFHD_ITEM.ITEM_ID = ITEM.ITEM_ID', + 'MFHD_MASTER.MFHD_ID = MFHD_ITEM.MFHD_ID', "MFHD_MASTER.SUPPRESS_IN_OPAC='N'", ]; @@ -425,31 +425,31 @@ protected function getStatusNoItemsSQL($id) { // Expressions $sqlExpressions = [ - "BIB_MFHD.BIB_ID", - "null as ITEM_ID", "MFHD_MASTER.MFHD_ID", "'N' as ON_RESERVE", + 'BIB_MFHD.BIB_ID', + 'null as ITEM_ID', 'MFHD_MASTER.MFHD_ID', "'N' as ON_RESERVE", "'No information available' as status", - "NVL(LOCATION.LOCATION_DISPLAY_NAME, " . - "LOCATION.LOCATION_NAME) as location", - "MFHD_MASTER.DISPLAY_CALL_NO as callnumber", - "0 AS TEMP_LOCATION", - "0 as ITEM_SEQUENCE_NUMBER", + 'NVL(LOCATION.LOCATION_DISPLAY_NAME, ' . + 'LOCATION.LOCATION_NAME) as location', + 'MFHD_MASTER.DISPLAY_CALL_NO as callnumber', + '0 AS TEMP_LOCATION', + '0 as ITEM_SEQUENCE_NUMBER', $this->getItemSortSequenceSQL('LOCATION.LOCATION_ID'), ]; // From $sqlFrom = [ - $this->dbName . ".BIB_MFHD", $this->dbName . ".LOCATION", - $this->dbName . ".MFHD_MASTER", + $this->dbName . '.BIB_MFHD', $this->dbName . '.LOCATION', + $this->dbName . '.MFHD_MASTER', ]; // Where $sqlWhere = [ - "BIB_MFHD.BIB_ID = :id", - "LOCATION.LOCATION_ID = MFHD_MASTER.LOCATION_ID", - "MFHD_MASTER.MFHD_ID = BIB_MFHD.MFHD_ID", + 'BIB_MFHD.BIB_ID = :id', + 'LOCATION.LOCATION_ID = MFHD_MASTER.LOCATION_ID', + 'MFHD_MASTER.MFHD_ID = BIB_MFHD.MFHD_ID', "MFHD_MASTER.SUPPRESS_IN_OPAC='N'", "NOT EXISTS (SELECT MFHD_ID FROM {$this->dbName}.MFHD_ITEM " . - "WHERE MFHD_ITEM.MFHD_ID=MFHD_MASTER.MFHD_ID)", + 'WHERE MFHD_ITEM.MFHD_ID=MFHD_MASTER.MFHD_ID)', ]; // Bind @@ -634,52 +634,52 @@ protected function getHoldingItemsSQL($id) ) ELSE NULL END RETURNDATE EOT; $sqlExpressions = [ - "BIB_ITEM.BIB_ID", "MFHD_ITEM.MFHD_ID", - "ITEM_BARCODE.ITEM_BARCODE", "ITEM.ITEM_ID", - "ITEM.ON_RESERVE", "ITEM.ITEM_SEQUENCE_NUMBER", - "ITEM.RECALLS_PLACED", "ITEM.HOLDS_PLACED", - "ITEM_STATUS_TYPE.ITEM_STATUS_DESC as status", - "MFHD_DATA.RECORD_SEGMENT", "MFHD_ITEM.ITEM_ENUM", - "NVL(LOCATION.LOCATION_DISPLAY_NAME, " . - "LOCATION.LOCATION_NAME) as location", - "ITEM.TEMP_LOCATION", - "ITEM.PERM_LOCATION", - "MFHD_MASTER.DISPLAY_CALL_NO as callnumber", + 'BIB_ITEM.BIB_ID', 'MFHD_ITEM.MFHD_ID', + 'ITEM_BARCODE.ITEM_BARCODE', 'ITEM.ITEM_ID', + 'ITEM.ON_RESERVE', 'ITEM.ITEM_SEQUENCE_NUMBER', + 'ITEM.RECALLS_PLACED', 'ITEM.HOLDS_PLACED', + 'ITEM_STATUS_TYPE.ITEM_STATUS_DESC as status', + 'MFHD_DATA.RECORD_SEGMENT', 'MFHD_ITEM.ITEM_ENUM', + 'NVL(LOCATION.LOCATION_DISPLAY_NAME, ' . + 'LOCATION.LOCATION_NAME) as location', + 'ITEM.TEMP_LOCATION', + 'ITEM.PERM_LOCATION', + 'MFHD_MASTER.DISPLAY_CALL_NO as callnumber', "to_char(CIRC_TRANSACTIONS.CURRENT_DUE_DATE, 'MM-DD-YY') as duedate", $returnDate, - "ITEM.ITEM_SEQUENCE_NUMBER", + 'ITEM.ITEM_SEQUENCE_NUMBER', $this->getItemSortSequenceSQL('ITEM.PERM_LOCATION'), ]; // From $sqlFrom = [ - $this->dbName . ".BIB_ITEM", $this->dbName . ".ITEM", - $this->dbName . ".ITEM_STATUS_TYPE", - $this->dbName . ".ITEM_STATUS", - $this->dbName . ".LOCATION", $this->dbName . ".MFHD_ITEM", - $this->dbName . ".MFHD_MASTER", $this->dbName . ".MFHD_DATA", - $this->dbName . ".CIRC_TRANSACTIONS", - $this->dbName . ".ITEM_BARCODE", + $this->dbName . '.BIB_ITEM', $this->dbName . '.ITEM', + $this->dbName . '.ITEM_STATUS_TYPE', + $this->dbName . '.ITEM_STATUS', + $this->dbName . '.LOCATION', $this->dbName . '.MFHD_ITEM', + $this->dbName . '.MFHD_MASTER', $this->dbName . '.MFHD_DATA', + $this->dbName . '.CIRC_TRANSACTIONS', + $this->dbName . '.ITEM_BARCODE', ]; // Where $sqlWhere = [ - "BIB_ITEM.BIB_ID = :id", - "BIB_ITEM.ITEM_ID = ITEM.ITEM_ID", - "ITEM.ITEM_ID = ITEM_STATUS.ITEM_ID", - "ITEM_STATUS.ITEM_STATUS = ITEM_STATUS_TYPE.ITEM_STATUS_TYPE", - "ITEM_BARCODE.ITEM_ID (+)= ITEM.ITEM_ID", - "LOCATION.LOCATION_ID = ITEM.PERM_LOCATION", - "CIRC_TRANSACTIONS.ITEM_ID (+)= ITEM.ITEM_ID", - "MFHD_ITEM.ITEM_ID = ITEM.ITEM_ID", - "MFHD_MASTER.MFHD_ID = MFHD_ITEM.MFHD_ID", - "MFHD_DATA.MFHD_ID = MFHD_ITEM.MFHD_ID", + 'BIB_ITEM.BIB_ID = :id', + 'BIB_ITEM.ITEM_ID = ITEM.ITEM_ID', + 'ITEM.ITEM_ID = ITEM_STATUS.ITEM_ID', + 'ITEM_STATUS.ITEM_STATUS = ITEM_STATUS_TYPE.ITEM_STATUS_TYPE', + 'ITEM_BARCODE.ITEM_ID (+)= ITEM.ITEM_ID', + 'LOCATION.LOCATION_ID = ITEM.PERM_LOCATION', + 'CIRC_TRANSACTIONS.ITEM_ID (+)= ITEM.ITEM_ID', + 'MFHD_ITEM.ITEM_ID = ITEM.ITEM_ID', + 'MFHD_MASTER.MFHD_ID = MFHD_ITEM.MFHD_ID', + 'MFHD_DATA.MFHD_ID = MFHD_ITEM.MFHD_ID', "MFHD_MASTER.SUPPRESS_IN_OPAC='N'", ]; // Order $sqlOrder = [ - "ITEM.ITEM_SEQUENCE_NUMBER", "MFHD_DATA.MFHD_ID", "MFHD_DATA.SEQNUM", + 'ITEM.ITEM_SEQUENCE_NUMBER', 'MFHD_DATA.MFHD_ID', 'MFHD_DATA.SEQNUM', ]; // Bind @@ -707,39 +707,39 @@ protected function getHoldingNoItemsSQL($id) { // Expressions $sqlExpressions = [ - "null as ITEM_BARCODE", "null as ITEM_ID", - "MFHD_DATA.RECORD_SEGMENT", "null as ITEM_ENUM", - "'N' as ON_RESERVE", "1 as ITEM_SEQUENCE_NUMBER", + 'null as ITEM_BARCODE', 'null as ITEM_ID', + 'MFHD_DATA.RECORD_SEGMENT', 'null as ITEM_ENUM', + "'N' as ON_RESERVE", '1 as ITEM_SEQUENCE_NUMBER', "'No information available' as status", - "NVL(LOCATION.LOCATION_DISPLAY_NAME, " . - "LOCATION.LOCATION_NAME) as location", - "MFHD_MASTER.DISPLAY_CALL_NO as callnumber", - "BIB_MFHD.BIB_ID", "MFHD_MASTER.MFHD_ID", - "null as duedate", "null as RETURNDATE", "0 AS TEMP_LOCATION", - "0 as PERM_LOCATION", - "0 as ITEM_SEQUENCE_NUMBER", + 'NVL(LOCATION.LOCATION_DISPLAY_NAME, ' . + 'LOCATION.LOCATION_NAME) as location', + 'MFHD_MASTER.DISPLAY_CALL_NO as callnumber', + 'BIB_MFHD.BIB_ID', 'MFHD_MASTER.MFHD_ID', + 'null as duedate', 'null as RETURNDATE', '0 AS TEMP_LOCATION', + '0 as PERM_LOCATION', + '0 as ITEM_SEQUENCE_NUMBER', $this->getItemSortSequenceSQL('LOCATION.LOCATION_ID'), ]; // From $sqlFrom = [ - $this->dbName . ".BIB_MFHD", $this->dbName . ".LOCATION", - $this->dbName . ".MFHD_MASTER", $this->dbName . ".MFHD_DATA", + $this->dbName . '.BIB_MFHD', $this->dbName . '.LOCATION', + $this->dbName . '.MFHD_MASTER', $this->dbName . '.MFHD_DATA', ]; // Where $sqlWhere = [ - "BIB_MFHD.BIB_ID = :id", - "LOCATION.LOCATION_ID = MFHD_MASTER.LOCATION_ID", - "MFHD_MASTER.MFHD_ID = BIB_MFHD.MFHD_ID", - "MFHD_DATA.MFHD_ID = BIB_MFHD.MFHD_ID", + 'BIB_MFHD.BIB_ID = :id', + 'LOCATION.LOCATION_ID = MFHD_MASTER.LOCATION_ID', + 'MFHD_MASTER.MFHD_ID = BIB_MFHD.MFHD_ID', + 'MFHD_DATA.MFHD_ID = BIB_MFHD.MFHD_ID', "MFHD_MASTER.SUPPRESS_IN_OPAC='N'", "NOT EXISTS (SELECT MFHD_ID FROM {$this->dbName}.MFHD_ITEM" - . " WHERE MFHD_ITEM.MFHD_ID=MFHD_MASTER.MFHD_ID)", + . ' WHERE MFHD_ITEM.MFHD_ID=MFHD_MASTER.MFHD_ID)', ]; // Order - $sqlOrder = ["MFHD_DATA.MFHD_ID", "MFHD_DATA.SEQNUM"]; + $sqlOrder = ['MFHD_DATA.MFHD_ID', 'MFHD_DATA.SEQNUM']; // Bind $sqlBind = [':id' => $id]; @@ -818,20 +818,20 @@ protected function getHoldingData($sqlRows) */ protected function getPurchaseHistoryData($id) { - $sql = "select LINE_ITEM_COPY_STATUS.MFHD_ID, SERIAL_ISSUES.ENUMCHRON " . + $sql = 'select LINE_ITEM_COPY_STATUS.MFHD_ID, SERIAL_ISSUES.ENUMCHRON ' . "from $this->dbName.SERIAL_ISSUES, $this->dbName.COMPONENT, " . "$this->dbName.ISSUES_RECEIVED, $this->dbName.SUBSCRIPTION, " . "$this->dbName.LINE_ITEM, $this->dbName.LINE_ITEM_COPY_STATUS " . - "where SERIAL_ISSUES.COMPONENT_ID = COMPONENT.COMPONENT_ID " . - "and ISSUES_RECEIVED.ISSUE_ID = SERIAL_ISSUES.ISSUE_ID " . - "and ISSUES_RECEIVED.COMPONENT_ID = COMPONENT.COMPONENT_ID " . - "and COMPONENT.SUBSCRIPTION_ID = SUBSCRIPTION.SUBSCRIPTION_ID " . - "and SUBSCRIPTION.LINE_ITEM_ID = LINE_ITEM.LINE_ITEM_ID " . - "and LINE_ITEM_COPY_STATUS.LINE_ITEM_ID = LINE_ITEM.LINE_ITEM_ID " . - "and SERIAL_ISSUES.RECEIVED > 0 " . - "and ISSUES_RECEIVED.OPAC_SUPPRESSED = 1 " . - "and LINE_ITEM.BIB_ID = :id " . - "order by LINE_ITEM_COPY_STATUS.MFHD_ID, SERIAL_ISSUES.ISSUE_ID DESC"; + 'where SERIAL_ISSUES.COMPONENT_ID = COMPONENT.COMPONENT_ID ' . + 'and ISSUES_RECEIVED.ISSUE_ID = SERIAL_ISSUES.ISSUE_ID ' . + 'and ISSUES_RECEIVED.COMPONENT_ID = COMPONENT.COMPONENT_ID ' . + 'and COMPONENT.SUBSCRIPTION_ID = SUBSCRIPTION.SUBSCRIPTION_ID ' . + 'and SUBSCRIPTION.LINE_ITEM_ID = LINE_ITEM.LINE_ITEM_ID ' . + 'and LINE_ITEM_COPY_STATUS.LINE_ITEM_ID = LINE_ITEM.LINE_ITEM_ID ' . + 'and SERIAL_ISSUES.RECEIVED > 0 ' . + 'and ISSUES_RECEIVED.OPAC_SUPPRESSED = 1 ' . + 'and LINE_ITEM.BIB_ID = :id ' . + 'order by LINE_ITEM_COPY_STATUS.MFHD_ID, SERIAL_ISSUES.ISSUE_ID DESC'; try { $sqlStmt = $this->executeSQL($sql, [':id' => $id]); } catch (PDOException $e) { @@ -975,7 +975,7 @@ protected function getLocationName($id) // Fill cache if empty: if (!isset($cache[$id])) { - $sql = "SELECT NVL(LOCATION_DISPLAY_NAME, LOCATION_NAME) as location " . + $sql = 'SELECT NVL(LOCATION_DISPLAY_NAME, LOCATION_NAME) as location ' . "FROM {$this->dbName}.LOCATION WHERE LOCATION_ID=:id"; $bind = ['id' => $id]; $sqlStmt = $this->executeSQL($sql, $bind); @@ -1025,7 +1025,7 @@ protected function processHoldingDueDate(array $row) { if (!empty($row['DUEDATE'])) { return $this->dateFormat->convertToDisplayDate( - "m-d-y", + 'm-d-y', $row['DUEDATE'] ); } @@ -1263,15 +1263,15 @@ public function patronLogin($username, $login) // barcode shouldn't contain any characters outside the basic latin // characters and check login verification fields here. - $sql = "SELECT PATRON.PATRON_ID, PATRON.FIRST_NAME, PATRON.LAST_NAME, " . + $sql = 'SELECT PATRON.PATRON_ID, PATRON.FIRST_NAME, PATRON.LAST_NAME, ' . "PATRON.{$loginField} as LOGIN"; if ($fallbackLoginField) { $sql .= ", PATRON.{$fallbackLoginField} as FALLBACK_LOGIN"; } $sql .= " FROM $this->dbName.PATRON, $this->dbName.PATRON_BARCODE " . - "WHERE PATRON.PATRON_ID = PATRON_BARCODE.PATRON_ID AND "; + 'WHERE PATRON.PATRON_ID = PATRON_BARCODE.PATRON_ID AND '; $sql .= $usernameField === 'PATRON_BARCODE' - ? "lower(PATRON_BARCODE.PATRON_BARCODE) = :username" + ? 'lower(PATRON_BARCODE.PATRON_BARCODE) = :username' : "lower(PATRON.{$usernameField}) = :username"; // Limit the barcode statuses that allow logging in. By default only @@ -1339,58 +1339,58 @@ protected function getMyTransactionsSQL($patron) // Expressions $sqlExpressions = [ "to_char(MAX(CIRC_TRANSACTIONS.CURRENT_DUE_DATE), 'MM-DD-YY HH24:MI')" . - " as DUEDATE", + ' as DUEDATE', "to_char(MAX(CURRENT_DUE_DATE), 'YYYYMMDD HH24:MI') as FULLDATE", - "MAX(BIB_ITEM.BIB_ID) AS BIB_ID", - "MAX(CIRC_TRANSACTIONS.ITEM_ID) as ITEM_ID", - "MAX(MFHD_ITEM.ITEM_ENUM) AS ITEM_ENUM", - "MAX(MFHD_ITEM.YEAR) AS YEAR", - "MAX(ITEM_BARCODE.ITEM_BARCODE) AS ITEM_BARCODE", - "MAX(BIB_TEXT.TITLE_BRIEF) AS TITLE_BRIEF", - "MAX(BIB_TEXT.TITLE) AS TITLE", - "LISTAGG(ITEM_STATUS_DESC, CHR(9)) " - . "WITHIN GROUP (ORDER BY ITEM_STATUS_DESC) as status", - "MAX(CIRC_TRANSACTIONS.RENEWAL_COUNT) AS RENEWAL_COUNT", - "MAX(CIRC_POLICY_MATRIX.RENEWAL_COUNT) as RENEWAL_LIMIT", - "MAX(LOCATION.LOCATION_DISPLAY_NAME) as BORROWING_LOCATION", - "MAX(CIRC_POLICY_MATRIX.LOAN_INTERVAL) as LOAN_INTERVAL", + 'MAX(BIB_ITEM.BIB_ID) AS BIB_ID', + 'MAX(CIRC_TRANSACTIONS.ITEM_ID) as ITEM_ID', + 'MAX(MFHD_ITEM.ITEM_ENUM) AS ITEM_ENUM', + 'MAX(MFHD_ITEM.YEAR) AS YEAR', + 'MAX(ITEM_BARCODE.ITEM_BARCODE) AS ITEM_BARCODE', + 'MAX(BIB_TEXT.TITLE_BRIEF) AS TITLE_BRIEF', + 'MAX(BIB_TEXT.TITLE) AS TITLE', + 'LISTAGG(ITEM_STATUS_DESC, CHR(9)) ' + . 'WITHIN GROUP (ORDER BY ITEM_STATUS_DESC) as status', + 'MAX(CIRC_TRANSACTIONS.RENEWAL_COUNT) AS RENEWAL_COUNT', + 'MAX(CIRC_POLICY_MATRIX.RENEWAL_COUNT) as RENEWAL_LIMIT', + 'MAX(LOCATION.LOCATION_DISPLAY_NAME) as BORROWING_LOCATION', + 'MAX(CIRC_POLICY_MATRIX.LOAN_INTERVAL) as LOAN_INTERVAL', ]; // From $sqlFrom = [ - $this->dbName . ".CIRC_TRANSACTIONS", - $this->dbName . ".BIB_ITEM", - $this->dbName . ".ITEM", - $this->dbName . ".ITEM_STATUS", - $this->dbName . ".ITEM_STATUS_TYPE", - $this->dbName . ".ITEM_BARCODE", - $this->dbName . ".MFHD_ITEM", - $this->dbName . ".BIB_TEXT", - $this->dbName . ".CIRC_POLICY_MATRIX", - $this->dbName . ".LOCATION", + $this->dbName . '.CIRC_TRANSACTIONS', + $this->dbName . '.BIB_ITEM', + $this->dbName . '.ITEM', + $this->dbName . '.ITEM_STATUS', + $this->dbName . '.ITEM_STATUS_TYPE', + $this->dbName . '.ITEM_BARCODE', + $this->dbName . '.MFHD_ITEM', + $this->dbName . '.BIB_TEXT', + $this->dbName . '.CIRC_POLICY_MATRIX', + $this->dbName . '.LOCATION', ]; // Where $sqlWhere = [ - "CIRC_TRANSACTIONS.PATRON_ID = :id", - "BIB_ITEM.ITEM_ID = CIRC_TRANSACTIONS.ITEM_ID", - "CIRC_TRANSACTIONS.ITEM_ID = MFHD_ITEM.ITEM_ID(+)", - "BIB_TEXT.BIB_ID = BIB_ITEM.BIB_ID", - "CIRC_TRANSACTIONS.CIRC_POLICY_MATRIX_ID = " . - "CIRC_POLICY_MATRIX.CIRC_POLICY_MATRIX_ID", - "CIRC_TRANSACTIONS.CHARGE_LOCATION = LOCATION.LOCATION_ID", - "BIB_ITEM.ITEM_ID = ITEM.ITEM_ID", - "ITEM.ITEM_ID = ITEM_STATUS.ITEM_ID", - "ITEM_STATUS.ITEM_STATUS = ITEM_STATUS_TYPE.ITEM_STATUS_TYPE", - "ITEM.ITEM_ID = ITEM_BARCODE.ITEM_ID(+)", - "(ITEM_BARCODE.BARCODE_STATUS IS NULL OR " . - "ITEM_BARCODE.BARCODE_STATUS IN (SELECT BARCODE_STATUS_TYPE FROM " . + 'CIRC_TRANSACTIONS.PATRON_ID = :id', + 'BIB_ITEM.ITEM_ID = CIRC_TRANSACTIONS.ITEM_ID', + 'CIRC_TRANSACTIONS.ITEM_ID = MFHD_ITEM.ITEM_ID(+)', + 'BIB_TEXT.BIB_ID = BIB_ITEM.BIB_ID', + 'CIRC_TRANSACTIONS.CIRC_POLICY_MATRIX_ID = ' . + 'CIRC_POLICY_MATRIX.CIRC_POLICY_MATRIX_ID', + 'CIRC_TRANSACTIONS.CHARGE_LOCATION = LOCATION.LOCATION_ID', + 'BIB_ITEM.ITEM_ID = ITEM.ITEM_ID', + 'ITEM.ITEM_ID = ITEM_STATUS.ITEM_ID', + 'ITEM_STATUS.ITEM_STATUS = ITEM_STATUS_TYPE.ITEM_STATUS_TYPE', + 'ITEM.ITEM_ID = ITEM_BARCODE.ITEM_ID(+)', + '(ITEM_BARCODE.BARCODE_STATUS IS NULL OR ' . + 'ITEM_BARCODE.BARCODE_STATUS IN (SELECT BARCODE_STATUS_TYPE FROM ' . "$this->dbName.ITEM_BARCODE_STATUS " . " WHERE BARCODE_STATUS_DESC = 'Active'))", ]; // Order - $sqlOrder = ["FULLDATE ASC", "TITLE ASC"]; + $sqlOrder = ['FULLDATE ASC', 'TITLE ASC']; // Bind $sqlBind = [':id' => $patron['id']]; @@ -1443,11 +1443,11 @@ protected function processMyTransactionsData($sqlRow, $patron = false) // Convert Voyager Format to display format if (!empty($sqlRow['DUEDATE'])) { $dueDate = $this->dateFormat->convertToDisplayDate( - "m-d-y H:i", + 'm-d-y H:i', $sqlRow['DUEDATE'] ); $dueTime = $this->dateFormat->convertToDisplayTime( - "m-d-y H:i", + 'm-d-y H:i', $sqlRow['DUEDATE'] ); } @@ -1458,9 +1458,9 @@ protected function processMyTransactionsData($sqlRow, $patron = false) $dueTimeStamp = strtotime($sqlRow['FULLDATE']); if (is_numeric($dueTimeStamp)) { if ($now > $dueTimeStamp) { - $dueStatus = "overdue"; + $dueStatus = 'overdue'; } elseif ($now > $dueTimeStamp - (1 * 24 * 60 * 60)) { - $dueStatus = "due"; + $dueStatus = 'due'; } } } @@ -1471,7 +1471,7 @@ protected function processMyTransactionsData($sqlRow, $patron = false) 'barcode' => utf8_encode($sqlRow['ITEM_BARCODE']), 'duedate' => $dueDate, 'dueStatus' => $dueStatus, - 'volume' => str_replace("v.", "", utf8_encode($sqlRow['ITEM_ENUM'])), + 'volume' => str_replace('v.', '', utf8_encode($sqlRow['ITEM_ENUM'])), 'publication_year' => $sqlRow['YEAR'], 'title' => empty($sqlRow['TITLE_BRIEF']) ? $sqlRow['TITLE'] : $sqlRow['TITLE_BRIEF'], @@ -1538,28 +1538,28 @@ protected function getFineSQL($patron) { // Expressions $sqlExpressions = [ - "FINE_FEE_TYPE.FINE_FEE_DESC", - "PATRON.PATRON_ID", "FINE_FEE.FINE_FEE_AMOUNT", - "FINE_FEE.FINE_FEE_BALANCE", + 'FINE_FEE_TYPE.FINE_FEE_DESC', + 'PATRON.PATRON_ID', 'FINE_FEE.FINE_FEE_AMOUNT', + 'FINE_FEE.FINE_FEE_BALANCE', "to_char(FINE_FEE.CREATE_DATE, 'MM-DD-YY HH:MI:SS') as CREATEDATE", "to_char(FINE_FEE.ORIG_CHARGE_DATE, 'MM-DD-YY') as CHARGEDATE", "to_char(FINE_FEE.DUE_DATE, 'MM-DD-YY') as DUEDATE", - "BIB_ITEM.BIB_ID", + 'BIB_ITEM.BIB_ID', ]; // From $sqlFrom = [ - $this->dbName . ".FINE_FEE", $this->dbName . ".FINE_FEE_TYPE", - $this->dbName . ".PATRON", $this->dbName . ".BIB_ITEM", + $this->dbName . '.FINE_FEE', $this->dbName . '.FINE_FEE_TYPE', + $this->dbName . '.PATRON', $this->dbName . '.BIB_ITEM', ]; // Where $sqlWhere = [ - "PATRON.PATRON_ID = :id", - "FINE_FEE.FINE_FEE_TYPE = FINE_FEE_TYPE.FINE_FEE_TYPE", - "FINE_FEE.PATRON_ID = PATRON.PATRON_ID", - "FINE_FEE.ITEM_ID = BIB_ITEM.ITEM_ID(+)", - "FINE_FEE.FINE_FEE_BALANCE > 0", + 'PATRON.PATRON_ID = :id', + 'FINE_FEE.FINE_FEE_TYPE = FINE_FEE_TYPE.FINE_FEE_TYPE', + 'FINE_FEE.PATRON_ID = PATRON.PATRON_ID', + 'FINE_FEE.ITEM_ID = BIB_ITEM.ITEM_ID(+)', + 'FINE_FEE.FINE_FEE_BALANCE > 0', ]; // Bind @@ -1585,29 +1585,29 @@ protected function getFineSQL($patron) */ protected function processFinesData($sqlRow) { - $dueDate = $this->translate("not_applicable"); + $dueDate = $this->translate('not_applicable'); // Convert Voyager Format to display format if (!empty($sqlRow['DUEDATE'])) { $dueDate = $this->dateFormat->convertToDisplayDate( - "m-d-y", + 'm-d-y', $sqlRow['DUEDATE'] ); } - $createDate = $this->translate("not_applicable"); + $createDate = $this->translate('not_applicable'); // Convert Voyager Format to display format if (!empty($sqlRow['CREATEDATE'])) { $createDate = $this->dateFormat->convertToDisplayDate( - "m-d-y", + 'm-d-y', $sqlRow['CREATEDATE'] ); } - $chargeDate = $this->translate("not_applicable"); + $chargeDate = $this->translate('not_applicable'); // Convert Voyager Format to display format if (!empty($sqlRow['CHARGEDATE'])) { $chargeDate = $this->dateFormat->convertToDisplayDate( - "m-d-y", + 'm-d-y', $sqlRow['CHARGEDATE'] ); } @@ -1662,47 +1662,47 @@ public function getMyFines($patron) protected function getMyHoldsSQL($patron) { // Modifier - $sqlSelectModifier = "distinct"; + $sqlSelectModifier = 'distinct'; // Expressions $sqlExpressions = [ - "HOLD_RECALL.HOLD_RECALL_ID", "HOLD_RECALL.BIB_ID", - "HOLD_RECALL.PICKUP_LOCATION", - "HOLD_RECALL.HOLD_RECALL_TYPE", + 'HOLD_RECALL.HOLD_RECALL_ID', 'HOLD_RECALL.BIB_ID', + 'HOLD_RECALL.PICKUP_LOCATION', + 'HOLD_RECALL.HOLD_RECALL_TYPE', "to_char(HOLD_RECALL.EXPIRE_DATE, 'MM-DD-YY') as EXPIRE_DATE", "to_char(HOLD_RECALL.CREATE_DATE, 'MM-DD-YY') as CREATE_DATE", - "HOLD_RECALL_ITEMS.ITEM_ID", - "HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS", - "HOLD_RECALL_ITEMS.QUEUE_POSITION", - "MFHD_ITEM.ITEM_ENUM", - "MFHD_ITEM.YEAR", - "BIB_TEXT.TITLE_BRIEF", - "BIB_TEXT.TITLE", - "REQUEST_GROUP.GROUP_NAME as REQUEST_GROUP_NAME", + 'HOLD_RECALL_ITEMS.ITEM_ID', + 'HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS', + 'HOLD_RECALL_ITEMS.QUEUE_POSITION', + 'MFHD_ITEM.ITEM_ENUM', + 'MFHD_ITEM.YEAR', + 'BIB_TEXT.TITLE_BRIEF', + 'BIB_TEXT.TITLE', + 'REQUEST_GROUP.GROUP_NAME as REQUEST_GROUP_NAME', ]; // From $sqlFrom = [ - $this->dbName . ".HOLD_RECALL", - $this->dbName . ".HOLD_RECALL_ITEMS", - $this->dbName . ".MFHD_ITEM", - $this->dbName . ".BIB_TEXT", - $this->dbName . ".VOYAGER_DATABASES", - $this->dbName . ".REQUEST_GROUP", + $this->dbName . '.HOLD_RECALL', + $this->dbName . '.HOLD_RECALL_ITEMS', + $this->dbName . '.MFHD_ITEM', + $this->dbName . '.BIB_TEXT', + $this->dbName . '.VOYAGER_DATABASES', + $this->dbName . '.REQUEST_GROUP', ]; // Where $sqlWhere = [ - "HOLD_RECALL.PATRON_ID = :id", - "HOLD_RECALL.HOLD_RECALL_ID = HOLD_RECALL_ITEMS.HOLD_RECALL_ID(+)", - "HOLD_RECALL_ITEMS.ITEM_ID = MFHD_ITEM.ITEM_ID(+)", - "(HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS IS NULL OR " . - "HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS < 3)", - "BIB_TEXT.BIB_ID = HOLD_RECALL.BIB_ID", - "(HOLD_RECALL.HOLDING_DB_ID IS NULL OR HOLD_RECALL.HOLDING_DB_ID = 0 " . - "OR (HOLD_RECALL.HOLDING_DB_ID = " . + 'HOLD_RECALL.PATRON_ID = :id', + 'HOLD_RECALL.HOLD_RECALL_ID = HOLD_RECALL_ITEMS.HOLD_RECALL_ID(+)', + 'HOLD_RECALL_ITEMS.ITEM_ID = MFHD_ITEM.ITEM_ID(+)', + '(HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS IS NULL OR ' . + 'HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS < 3)', + 'BIB_TEXT.BIB_ID = HOLD_RECALL.BIB_ID', + '(HOLD_RECALL.HOLDING_DB_ID IS NULL OR HOLD_RECALL.HOLDING_DB_ID = 0 ' . + 'OR (HOLD_RECALL.HOLDING_DB_ID = ' . "VOYAGER_DATABASES.DB_ID AND VOYAGER_DATABASES.DB_CODE = 'LOCAL'))", - "HOLD_RECALL.REQUEST_GROUP_ID = REQUEST_GROUP.GROUP_ID(+)", + 'HOLD_RECALL.REQUEST_GROUP_ID = REQUEST_GROUP.GROUP_ID(+)', ]; // Bind @@ -1730,20 +1730,20 @@ protected function getMyHoldsSQL($patron) protected function processMyHoldsData($sqlRow) { $available = ($sqlRow['HOLD_RECALL_STATUS'] == 2) ? true : false; - $expireDate = $this->translate("Unknown"); + $expireDate = $this->translate('Unknown'); // Convert Voyager Format to display format if (!empty($sqlRow['EXPIRE_DATE'])) { $expireDate = $this->dateFormat->convertToDisplayDate( - "m-d-y", + 'm-d-y', $sqlRow['EXPIRE_DATE'] ); } - $createDate = $this->translate("Unknown"); + $createDate = $this->translate('Unknown'); // Convert Voyager Format to display format if (!empty($sqlRow['CREATE_DATE'])) { $createDate = $this->dateFormat->convertToDisplayDate( - "m-d-y", + 'm-d-y', $sqlRow['CREATE_DATE'] ); } @@ -1759,7 +1759,7 @@ protected function processMyHoldsData($sqlRow) 'available' => $available, 'reqnum' => $sqlRow['HOLD_RECALL_ID'], 'item_id' => $sqlRow['ITEM_ID'], - 'volume' => str_replace("v.", "", utf8_encode($sqlRow['ITEM_ENUM'])), + 'volume' => str_replace('v.', '', utf8_encode($sqlRow['ITEM_ENUM'])), 'publication_year' => $sqlRow['YEAR'], 'title' => empty($sqlRow['TITLE_BRIEF']) ? $sqlRow['TITLE'] : $sqlRow['TITLE_BRIEF'], @@ -1838,7 +1838,7 @@ public function getMyHolds($patron) protected function getMyStorageRetrievalRequestsSQL($patron) { // Modifier - $sqlSelectModifier = "distinct"; + $sqlSelectModifier = 'distinct'; // Expressions $sqlExpressions = [ @@ -1929,22 +1929,22 @@ protected function processMyStorageRetrievalRequestsData($sqlRow) // Convert Voyager Format to display format if (!empty($sqlRow['PROCESSED_DATE'])) { $processedDate = $this->dateFormat->convertToDisplayDate( - "m-d-y", + 'm-d-y', $sqlRow['PROCESSED_DATE'] ); } if (!empty($sqlRow['STATUS_DATE'])) { $statusDate = $this->dateFormat->convertToDisplayDate( - "m-d-y", + 'm-d-y', $sqlRow['STATUS_DATE'] ); } - $createDate = $this->translate("Unknown"); + $createDate = $this->translate('Unknown'); // Convert Voyager Format to display format if (!empty($sqlRow['CREATE_DATE'])) { $createDate = $this->dateFormat->convertToDisplayDate( - "m-d-y", + 'm-d-y', $sqlRow['CREATE_DATE'] ); } @@ -1963,8 +1963,8 @@ protected function processMyStorageRetrievalRequestsData($sqlRow) 'reqnum' => $sqlRow['CALL_SLIP_ID'], 'item_id' => $sqlRow['ITEM_ID'], 'volume' => str_replace( - "v.", - "", + 'v.', + '', utf8_encode($sqlRow['ITEM_ENUM']) ), 'issue' => utf8_encode($sqlRow['ITEM_CHRON']), @@ -2013,22 +2013,22 @@ public function getMyStorageRetrievalRequests($patron) */ public function getMyProfile($patron) { - $sql = "SELECT PATRON.LAST_NAME, PATRON.FIRST_NAME, " . - "PATRON.HISTORICAL_CHARGES, PATRON_ADDRESS.ADDRESS_LINE1, " . - "PATRON_ADDRESS.ADDRESS_LINE2, PATRON_ADDRESS.ZIP_POSTAL, " . - "PATRON_ADDRESS.CITY, PATRON_ADDRESS.COUNTRY, " . - "PATRON_PHONE.PHONE_NUMBER, PHONE_TYPE.PHONE_DESC, " . - "PATRON_GROUP.PATRON_GROUP_NAME " . + $sql = 'SELECT PATRON.LAST_NAME, PATRON.FIRST_NAME, ' . + 'PATRON.HISTORICAL_CHARGES, PATRON_ADDRESS.ADDRESS_LINE1, ' . + 'PATRON_ADDRESS.ADDRESS_LINE2, PATRON_ADDRESS.ZIP_POSTAL, ' . + 'PATRON_ADDRESS.CITY, PATRON_ADDRESS.COUNTRY, ' . + 'PATRON_PHONE.PHONE_NUMBER, PHONE_TYPE.PHONE_DESC, ' . + 'PATRON_GROUP.PATRON_GROUP_NAME ' . "FROM $this->dbName.PATRON, $this->dbName.PATRON_ADDRESS, " . "$this->dbName.PATRON_PHONE, $this->dbName.PHONE_TYPE, " . "$this->dbName.PATRON_BARCODE, $this->dbName.PATRON_GROUP " . - "WHERE PATRON.PATRON_ID = PATRON_ADDRESS.PATRON_ID (+) " . - "AND PATRON_ADDRESS.ADDRESS_ID = PATRON_PHONE.ADDRESS_ID (+) " . - "AND PATRON.PATRON_ID = PATRON_BARCODE.PATRON_ID (+) " . - "AND PATRON_BARCODE.PATRON_GROUP_ID = " . - "PATRON_GROUP.PATRON_GROUP_ID (+) " . - "AND PATRON_PHONE.PHONE_TYPE = PHONE_TYPE.PHONE_TYPE (+) " . - "AND PATRON.PATRON_ID = :id"; + 'WHERE PATRON.PATRON_ID = PATRON_ADDRESS.PATRON_ID (+) ' . + 'AND PATRON_ADDRESS.ADDRESS_ID = PATRON_PHONE.ADDRESS_ID (+) ' . + 'AND PATRON.PATRON_ID = PATRON_BARCODE.PATRON_ID (+) ' . + 'AND PATRON_BARCODE.PATRON_GROUP_ID = ' . + 'PATRON_GROUP.PATRON_GROUP_ID (+) ' . + 'AND PATRON_PHONE.PHONE_TYPE = PHONE_TYPE.PHONE_TYPE (+) ' . + 'AND PATRON.PATRON_ID = :id'; $primaryPhoneType = $this->config['Profile']['primary_phone'] ?? 'Primary'; $mobilePhoneType = $this->config['Profile']['mobile_phone'] ?? 'Mobile'; try { @@ -2128,18 +2128,18 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) ':startdate' => date('d-m-Y', strtotime("-$daysOld day")), ]; - $sql = "select count(distinct LINE_ITEM.BIB_ID) as count " . + $sql = 'select count(distinct LINE_ITEM.BIB_ID) as count ' . "from $this->dbName.LINE_ITEM, " . "$this->dbName.LINE_ITEM_COPY_STATUS, " . "$this->dbName.LINE_ITEM_FUNDS, $this->dbName.FUND " . - "where LINE_ITEM.LINE_ITEM_ID = LINE_ITEM_COPY_STATUS.LINE_ITEM_ID " . - "and LINE_ITEM_COPY_STATUS.COPY_ID = LINE_ITEM_FUNDS.COPY_ID " . - "and LINE_ITEM_FUNDS.FUND_ID = FUND.FUND_ID "; + 'where LINE_ITEM.LINE_ITEM_ID = LINE_ITEM_COPY_STATUS.LINE_ITEM_ID ' . + 'and LINE_ITEM_COPY_STATUS.COPY_ID = LINE_ITEM_FUNDS.COPY_ID ' . + 'and LINE_ITEM_FUNDS.FUND_ID = FUND.FUND_ID '; if ($fundId) { // Although we're getting an ID value from getFunds() passed in here, // it's not actually an ID -- we use names as IDs (see note in getFunds // itself for more details). - $sql .= "and lower(FUND.FUND_NAME) = :fund "; + $sql .= 'and lower(FUND.FUND_NAME) = :fund '; $bindParams[':fund'] = strtolower($fundId); } $sql .= "and LINE_ITEM.CREATE_DATE >= to_date(:startdate, 'dd-mm-yyyy') " . @@ -2156,27 +2156,27 @@ public function getNewItems($page, $limit, $daysOld, $fundId = null) $limit = ($limit) ? $limit : 20; $bindParams[':startRow'] = (($page - 1) * $limit) + 1; $bindParams[':endRow'] = ($page * $limit); - $sql = "select * from " . - "(select a.*, rownum rnum from " . - "(select LINE_ITEM.BIB_ID, LINE_ITEM.CREATE_DATE " . + $sql = 'select * from ' . + '(select a.*, rownum rnum from ' . + '(select LINE_ITEM.BIB_ID, LINE_ITEM.CREATE_DATE ' . "from $this->dbName.LINE_ITEM, " . "$this->dbName.LINE_ITEM_COPY_STATUS, " . "$this->dbName.LINE_ITEM_STATUS, $this->dbName.LINE_ITEM_FUNDS, " . "$this->dbName.FUND " . - "where LINE_ITEM.LINE_ITEM_ID = LINE_ITEM_COPY_STATUS.LINE_ITEM_ID " . - "and LINE_ITEM_COPY_STATUS.COPY_ID = LINE_ITEM_FUNDS.COPY_ID " . - "and LINE_ITEM_STATUS.LINE_ITEM_STATUS = " . - "LINE_ITEM_COPY_STATUS.LINE_ITEM_STATUS " . - "and LINE_ITEM_FUNDS.FUND_ID = FUND.FUND_ID "; + 'where LINE_ITEM.LINE_ITEM_ID = LINE_ITEM_COPY_STATUS.LINE_ITEM_ID ' . + 'and LINE_ITEM_COPY_STATUS.COPY_ID = LINE_ITEM_FUNDS.COPY_ID ' . + 'and LINE_ITEM_STATUS.LINE_ITEM_STATUS = ' . + 'LINE_ITEM_COPY_STATUS.LINE_ITEM_STATUS ' . + 'and LINE_ITEM_FUNDS.FUND_ID = FUND.FUND_ID '; if ($fundId) { - $sql .= "and lower(FUND.FUND_NAME) = :fund "; + $sql .= 'and lower(FUND.FUND_NAME) = :fund '; } $sql .= "and LINE_ITEM.CREATE_DATE >= to_date(:startdate, 'dd-mm-yyyy') " . "and LINE_ITEM.CREATE_DATE < to_date(:enddate, 'dd-mm-yyyy') " . - "group by LINE_ITEM.BIB_ID, LINE_ITEM.CREATE_DATE " . - "order by LINE_ITEM.CREATE_DATE desc) a " . - "where rownum <= :endRow) " . - "where rnum >= :startRow"; + 'group by LINE_ITEM.BIB_ID, LINE_ITEM.CREATE_DATE ' . + 'order by LINE_ITEM.CREATE_DATE desc) a ' . + 'where rownum <= :endRow) ' . + 'where rnum >= :startRow'; try { $sqlStmt = $this->executeSQL($sql, $bindParams); while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { @@ -2226,7 +2226,7 @@ public function getFunds() $bindParams = []; $whereClause = ''; } - $sql = "select distinct lower(FUND.FUND_NAME) as name " . + $sql = 'select distinct lower(FUND.FUND_NAME) as name ' . "from $this->dbName.FUND {$whereClause} order by name"; try { $sqlStmt = $this->executeSQL($sql, $bindParams); @@ -2275,15 +2275,15 @@ public function getDepartments() { $deptList = []; - $sql = "select DEPARTMENT.DEPARTMENT_ID, DEPARTMENT.DEPARTMENT_NAME " . + $sql = 'select DEPARTMENT.DEPARTMENT_ID, DEPARTMENT.DEPARTMENT_NAME ' . "from $this->dbName.RESERVE_LIST, " . "$this->dbName.RESERVE_LIST_COURSES, $this->dbName.DEPARTMENT " . - "where " . - "RESERVE_LIST.RESERVE_LIST_ID = " . - "RESERVE_LIST_COURSES.RESERVE_LIST_ID and " . - "RESERVE_LIST_COURSES.DEPARTMENT_ID = DEPARTMENT.DEPARTMENT_ID " . - "group by DEPARTMENT.DEPARTMENT_ID, DEPARTMENT_NAME " . - "order by DEPARTMENT_NAME"; + 'where ' . + 'RESERVE_LIST.RESERVE_LIST_ID = ' . + 'RESERVE_LIST_COURSES.RESERVE_LIST_ID and ' . + 'RESERVE_LIST_COURSES.DEPARTMENT_ID = DEPARTMENT.DEPARTMENT_ID ' . + 'group by DEPARTMENT.DEPARTMENT_ID, DEPARTMENT_NAME ' . + 'order by DEPARTMENT_NAME'; try { $sqlStmt = $this->executeSQL($sql); while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { @@ -2308,15 +2308,15 @@ public function getInstructors() { $instList = []; - $sql = "select INSTRUCTOR.INSTRUCTOR_ID, " . + $sql = 'select INSTRUCTOR.INSTRUCTOR_ID, ' . "INSTRUCTOR.LAST_NAME || ', ' || INSTRUCTOR.FIRST_NAME as NAME " . "from $this->dbName.RESERVE_LIST, " . "$this->dbName.RESERVE_LIST_COURSES, $this->dbName.INSTRUCTOR " . - "where RESERVE_LIST.RESERVE_LIST_ID = " . - "RESERVE_LIST_COURSES.RESERVE_LIST_ID and " . - "RESERVE_LIST_COURSES.INSTRUCTOR_ID = INSTRUCTOR.INSTRUCTOR_ID " . - "group by INSTRUCTOR.INSTRUCTOR_ID, LAST_NAME, FIRST_NAME " . - "order by LAST_NAME"; + 'where RESERVE_LIST.RESERVE_LIST_ID = ' . + 'RESERVE_LIST_COURSES.RESERVE_LIST_ID and ' . + 'RESERVE_LIST_COURSES.INSTRUCTOR_ID = INSTRUCTOR.INSTRUCTOR_ID ' . + 'group by INSTRUCTOR.INSTRUCTOR_ID, LAST_NAME, FIRST_NAME ' . + 'order by LAST_NAME'; try { $sqlStmt = $this->executeSQL($sql); while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { @@ -2342,14 +2342,14 @@ public function getCourses() $courseList = []; $sql = "select COURSE.COURSE_NUMBER || ': ' || COURSE.COURSE_NAME as NAME," . - " COURSE.COURSE_ID " . + ' COURSE.COURSE_ID ' . "from $this->dbName.RESERVE_LIST, " . "$this->dbName.RESERVE_LIST_COURSES, $this->dbName.COURSE " . - "where RESERVE_LIST.RESERVE_LIST_ID = " . - "RESERVE_LIST_COURSES.RESERVE_LIST_ID and " . - "RESERVE_LIST_COURSES.COURSE_ID = COURSE.COURSE_ID " . - "group by COURSE.COURSE_ID, COURSE_NUMBER, COURSE_NAME " . - "order by COURSE_NUMBER"; + 'where RESERVE_LIST.RESERVE_LIST_ID = ' . + 'RESERVE_LIST_COURSES.RESERVE_LIST_ID and ' . + 'RESERVE_LIST_COURSES.COURSE_ID = COURSE.COURSE_ID ' . + 'group by COURSE.COURSE_ID, COURSE_NUMBER, COURSE_NAME ' . + 'order by COURSE_NUMBER'; try { $sqlStmt = $this->executeSQL($sql); while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { @@ -2385,20 +2385,20 @@ public function findReserves($course, $inst, $dept) $bindParams = []; if ($course != '') { - $reserveWhere[] = "RESERVE_LIST_COURSES.COURSE_ID = :course"; + $reserveWhere[] = 'RESERVE_LIST_COURSES.COURSE_ID = :course'; $bindParams[':course'] = $course; } if ($inst != '') { - $reserveWhere[] = "RESERVE_LIST_COURSES.INSTRUCTOR_ID = :inst"; + $reserveWhere[] = 'RESERVE_LIST_COURSES.INSTRUCTOR_ID = :inst'; $bindParams[':inst'] = $inst; } if ($dept != '') { - $reserveWhere[] = "RESERVE_LIST_COURSES.DEPARTMENT_ID = :dept"; + $reserveWhere[] = 'RESERVE_LIST_COURSES.DEPARTMENT_ID = :dept'; $bindParams[':dept'] = $dept; } $reserveWhere = empty($reserveWhere) ? - "" : "where (" . implode(' AND ', $reserveWhere) . ")"; + '' : 'where (' . implode(' AND ', $reserveWhere) . ')'; /* OLD SQL -- simpler but without support for the Solr-based reserves * module: @@ -2428,43 +2428,43 @@ public function findReserves($course, $inst, $dept) " $this->dbName.reserve_list_courses $reserveWhere )) )) " . " ) "; */ - $sql = " select MFHD_MASTER.DISPLAY_CALL_NO, BIB_TEXT.BIB_ID, " . - " BIB_TEXT.AUTHOR, BIB_TEXT.TITLE, " . - " BIB_TEXT.PUBLISHER, BIB_TEXT.PUBLISHER_DATE, subquery.COURSE_ID, " . - " subquery.INSTRUCTOR_ID, subquery.DEPARTMENT_ID " . + $sql = ' select MFHD_MASTER.DISPLAY_CALL_NO, BIB_TEXT.BIB_ID, ' . + ' BIB_TEXT.AUTHOR, BIB_TEXT.TITLE, ' . + ' BIB_TEXT.PUBLISHER, BIB_TEXT.PUBLISHER_DATE, subquery.COURSE_ID, ' . + ' subquery.INSTRUCTOR_ID, subquery.DEPARTMENT_ID ' . " FROM $this->dbName.BIB_TEXT " . " JOIN $this->dbName.BIB_MFHD ON BIB_TEXT.BIB_ID=BIB_MFHD.BIB_ID " . " JOIN $this->dbName.MFHD_MASTER " . - " ON BIB_MFHD.MFHD_ID = MFHD_MASTER.MFHD_ID" . - " JOIN " . - " ( " . - " ((select distinct eitem.mfhd_id, subsubquery1.COURSE_ID, " . - " subsubquery1.INSTRUCTOR_ID, subsubquery1.DEPARTMENT_ID " . + ' ON BIB_MFHD.MFHD_ID = MFHD_MASTER.MFHD_ID' . + ' JOIN ' . + ' ( ' . + ' ((select distinct eitem.mfhd_id, subsubquery1.COURSE_ID, ' . + ' subsubquery1.INSTRUCTOR_ID, subsubquery1.DEPARTMENT_ID ' . " from $this->dbName.eitem join " . - " (select distinct reserve_list_eitems.eitem_id, " . - " RESERVE_LIST_COURSES.COURSE_ID, " . - " RESERVE_LIST_COURSES.INSTRUCTOR_ID, " . - " RESERVE_LIST_COURSES.DEPARTMENT_ID from " . + ' (select distinct reserve_list_eitems.eitem_id, ' . + ' RESERVE_LIST_COURSES.COURSE_ID, ' . + ' RESERVE_LIST_COURSES.INSTRUCTOR_ID, ' . + ' RESERVE_LIST_COURSES.DEPARTMENT_ID from ' . " $this->dbName.reserve_list_eitems" . " JOIN $this->dbName.reserve_list_courses ON " . - " reserve_list_courses.reserve_list_id = " . - " reserve_list_eitems.reserve_list_id" . + ' reserve_list_courses.reserve_list_id = ' . + ' reserve_list_eitems.reserve_list_id' . " $reserveWhere ) subsubquery1 ON " . - " subsubquery1.eitem_id = eitem.eitem_id)) union " . - " ((select distinct mfhd_item.mfhd_id, subsubquery2.COURSE_ID, " . - " subsubquery2.INSTRUCTOR_ID, subsubquery2.DEPARTMENT_ID " . + ' subsubquery1.eitem_id = eitem.eitem_id)) union ' . + ' ((select distinct mfhd_item.mfhd_id, subsubquery2.COURSE_ID, ' . + ' subsubquery2.INSTRUCTOR_ID, subsubquery2.DEPARTMENT_ID ' . " from $this->dbName.mfhd_item join" . - " (select distinct reserve_list_items.item_id, " . - " RESERVE_LIST_COURSES.COURSE_ID, " . - " RESERVE_LIST_COURSES.INSTRUCTOR_ID, " . - " RESERVE_LIST_COURSES.DEPARTMENT_ID from " . + ' (select distinct reserve_list_items.item_id, ' . + ' RESERVE_LIST_COURSES.COURSE_ID, ' . + ' RESERVE_LIST_COURSES.INSTRUCTOR_ID, ' . + ' RESERVE_LIST_COURSES.DEPARTMENT_ID from ' . " $this->dbName.reserve_list_items" . " JOIN $this->dbName.reserve_list_courses on " . - " reserve_list_items.reserve_list_id = " . - " reserve_list_courses.reserve_list_id" . + ' reserve_list_items.reserve_list_id = ' . + ' reserve_list_courses.reserve_list_id' . " $reserveWhere) subsubquery2 ON " . - " subsubquery2.item_id = mfhd_item.item_id )) " . - " ) subquery ON mfhd_master.mfhd_id = subquery.mfhd_id "; + ' subsubquery2.item_id = mfhd_item.item_id )) ' . + ' ) subquery ON mfhd_master.mfhd_id = subquery.mfhd_id '; try { $sqlStmt = $this->executeSQL($sql, $bindParams); @@ -2504,19 +2504,19 @@ public function getRecentlyReturnedBibs( $safeLimit = $intLimit < 1 ? 30 : $intLimit; $sql = "select /*+ FIRST_ROWS($safeLimit) */ BIB_MFHD.BIB_ID, " - . "max(CIRC_TRANS_ARCHIVE.DISCHARGE_DATE) as RETURNED " + . 'max(CIRC_TRANS_ARCHIVE.DISCHARGE_DATE) as RETURNED ' . "from $this->dbName.CIRC_TRANS_ARCHIVE " . "join $this->dbName.MFHD_ITEM " - . "on CIRC_TRANS_ARCHIVE.ITEM_ID = MFHD_ITEM.ITEM_ID " + . 'on CIRC_TRANS_ARCHIVE.ITEM_ID = MFHD_ITEM.ITEM_ID ' . "join $this->dbName.BIB_MFHD " - . "on BIB_MFHD.MFHD_ID = MFHD_ITEM.MFHD_ID " + . 'on BIB_MFHD.MFHD_ID = MFHD_ITEM.MFHD_ID ' . "join $this->dbName.BIB_MASTER " - . "on BIB_MASTER.BIB_ID = BIB_MFHD.BIB_ID " - . "where CIRC_TRANS_ARCHIVE.DISCHARGE_DATE is not null " - . "and CIRC_TRANS_ARCHIVE.DISCHARGE_DATE > SYSDATE - :maxage " + . 'on BIB_MASTER.BIB_ID = BIB_MFHD.BIB_ID ' + . 'where CIRC_TRANS_ARCHIVE.DISCHARGE_DATE is not null ' + . 'and CIRC_TRANS_ARCHIVE.DISCHARGE_DATE > SYSDATE - :maxage ' . "and BIB_MASTER.SUPPRESS_IN_OPAC='N' " - . "group by BIB_MFHD.BIB_ID " - . "order by RETURNED desc"; + . 'group by BIB_MFHD.BIB_ID ' + . 'order by RETURNED desc'; try { $sqlStmt = $this->executeSQL($sql, [':maxage' => $maxage]); while ( @@ -2553,22 +2553,22 @@ public function getTrendingBibs($limit = 30, $maxage = 30, $patron = null) $safeLimit = $intLimit < 1 ? 30 : $intLimit; $sql = "select /*+ FIRST_ROWS($safeLimit) */ BIB_MFHD.BIB_ID, " - . "count(CIRC_TRANS_ARCHIVE.DISCHARGE_DATE) as RECENT, " - . "sum(ITEM.HISTORICAL_CHARGES) as OVERALL " + . 'count(CIRC_TRANS_ARCHIVE.DISCHARGE_DATE) as RECENT, ' + . 'sum(ITEM.HISTORICAL_CHARGES) as OVERALL ' . "from $this->dbName.CIRC_TRANS_ARCHIVE " . "join $this->dbName.MFHD_ITEM " - . "on CIRC_TRANS_ARCHIVE.ITEM_ID = MFHD_ITEM.ITEM_ID " + . 'on CIRC_TRANS_ARCHIVE.ITEM_ID = MFHD_ITEM.ITEM_ID ' . "join $this->dbName.BIB_MFHD " - . "on BIB_MFHD.MFHD_ID = MFHD_ITEM.MFHD_ID " + . 'on BIB_MFHD.MFHD_ID = MFHD_ITEM.MFHD_ID ' . "join $this->dbName.ITEM " - . "on CIRC_TRANS_ARCHIVE.ITEM_ID = ITEM.ITEM_ID " + . 'on CIRC_TRANS_ARCHIVE.ITEM_ID = ITEM.ITEM_ID ' . "join $this->dbName.BIB_MASTER " - . "on BIB_MASTER.BIB_ID = BIB_MFHD.BIB_ID " - . "where CIRC_TRANS_ARCHIVE.DISCHARGE_DATE is not null " - . "and CIRC_TRANS_ARCHIVE.DISCHARGE_DATE > SYSDATE - :maxage " + . 'on BIB_MASTER.BIB_ID = BIB_MFHD.BIB_ID ' + . 'where CIRC_TRANS_ARCHIVE.DISCHARGE_DATE is not null ' + . 'and CIRC_TRANS_ARCHIVE.DISCHARGE_DATE > SYSDATE - :maxage ' . "and BIB_MASTER.SUPPRESS_IN_OPAC='N' " - . "group by BIB_MFHD.BIB_ID " - . "order by RECENT desc, OVERALL desc"; + . 'group by BIB_MFHD.BIB_ID ' + . 'order by RECENT desc, OVERALL desc'; try { $sqlStmt = $this->executeSQL($sql, [':maxage' => $maxage]); while ( @@ -2593,7 +2593,7 @@ public function getSuppressedRecords() { $list = []; - $sql = "select BIB_MASTER.BIB_ID " . + $sql = 'select BIB_MASTER.BIB_ID ' . "from $this->dbName.BIB_MASTER " . "where BIB_MASTER.SUPPRESS_IN_OPAC='Y'"; try { diff --git a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php index d043f7892c9..f72f1a84fcf 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php +++ b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php @@ -714,23 +714,23 @@ public function getPickUpLocations($patron = false, $holdDetails = null) && $this->pickupLocationsInRequestGroup && !empty($holdDetails['requestGroupId']) ) { - $sql = "SELECT CIRC_POLICY_LOCS.LOCATION_ID as location_id, " . - "NVL(LOCATION.LOCATION_DISPLAY_NAME, LOCATION.LOCATION_NAME) " . - "as location_name from " . + $sql = 'SELECT CIRC_POLICY_LOCS.LOCATION_ID as location_id, ' . + 'NVL(LOCATION.LOCATION_DISPLAY_NAME, LOCATION.LOCATION_NAME) ' . + 'as location_name from ' . $this->dbName . ".CIRC_POLICY_LOCS, $this->dbName.LOCATION, " . "$this->dbName.REQUEST_GROUP_LOCATION rgl " . "where CIRC_POLICY_LOCS.PICKUP_LOCATION = 'Y' " . - "and CIRC_POLICY_LOCS.LOCATION_ID = LOCATION.LOCATION_ID " . - "and rgl.GROUP_ID=:requestGroupId " . - "and rgl.LOCATION_ID = LOCATION.LOCATION_ID"; + 'and CIRC_POLICY_LOCS.LOCATION_ID = LOCATION.LOCATION_ID ' . + 'and rgl.GROUP_ID=:requestGroupId ' . + 'and rgl.LOCATION_ID = LOCATION.LOCATION_ID'; $params['requestGroupId'] = $holdDetails['requestGroupId']; } else { - $sql = "SELECT CIRC_POLICY_LOCS.LOCATION_ID as location_id, " . - "NVL(LOCATION.LOCATION_DISPLAY_NAME, LOCATION.LOCATION_NAME) " . - "as location_name from " . + $sql = 'SELECT CIRC_POLICY_LOCS.LOCATION_ID as location_id, ' . + 'NVL(LOCATION.LOCATION_DISPLAY_NAME, LOCATION.LOCATION_NAME) ' . + 'as location_name from ' . $this->dbName . ".CIRC_POLICY_LOCS, $this->dbName.LOCATION " . "where CIRC_POLICY_LOCS.PICKUP_LOCATION = 'Y' " . - "and CIRC_POLICY_LOCS.LOCATION_ID = LOCATION.LOCATION_ID"; + 'and CIRC_POLICY_LOCS.LOCATION_ID = LOCATION.LOCATION_ID'; } try { @@ -1158,7 +1158,7 @@ protected function buildBasicXML($xml) $xmlString .= ''; } - $xmlComplete = "" . $xmlString; + $xmlComplete = '' . $xmlString; return $xmlComplete; } @@ -1864,14 +1864,14 @@ protected function getMyHoldsSQL($patron) // We need to significantly change the where clauses to account for remote // holds $sqlArray['where'] = [ - "HOLD_RECALL.PATRON_ID = :id", - "HOLD_RECALL.HOLD_RECALL_ID = HOLD_RECALL_ITEMS.HOLD_RECALL_ID(+)", - "HOLD_RECALL_ITEMS.ITEM_ID = MFHD_ITEM.ITEM_ID(+)", - "(HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS IS NULL OR " . - "HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS < 3)", - "HOLD_RECALL.BIB_ID = BIB_TEXT.BIB_ID(+)", - "HOLD_RECALL.REQUEST_GROUP_ID = REQUEST_GROUP.GROUP_ID(+)", - "HOLD_RECALL.HOLDING_DB_ID = VOYAGER_DATABASES.DB_ID(+)", + 'HOLD_RECALL.PATRON_ID = :id', + 'HOLD_RECALL.HOLD_RECALL_ID = HOLD_RECALL_ITEMS.HOLD_RECALL_ID(+)', + 'HOLD_RECALL_ITEMS.ITEM_ID = MFHD_ITEM.ITEM_ID(+)', + '(HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS IS NULL OR ' . + 'HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS < 3)', + 'HOLD_RECALL.BIB_ID = BIB_TEXT.BIB_ID(+)', + 'HOLD_RECALL.REQUEST_GROUP_ID = REQUEST_GROUP.GROUP_ID(+)', + 'HOLD_RECALL.HOLDING_DB_ID = VOYAGER_DATABASES.DB_ID(+)', ]; return $sqlArray; diff --git a/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php b/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php index 0d158290e0a..cb3be3ee603 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php +++ b/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php @@ -414,7 +414,7 @@ protected function loadPickUpLocationsFromFile($filename) "Cannot load pickup locations file: {$pickupLocationsFile}." ); } - if (($handle = fopen($pickupLocationsFile, "r")) !== false) { + if (($handle = fopen($pickupLocationsFile, 'r')) !== false) { while (($data = fgetcsv($handle)) !== false) { $agencyId = $data[0] . '|' . $data[1]; $this->pickupLocations[$agencyId] = [ @@ -1164,7 +1164,7 @@ public function getMyTransactions($patron) ); // Hack to account for bibs from other non-local institutions // temporarily until consortial functionality is enabled. - $bibId = !empty($bibId) ? (string)$bibId[0] : "1"; + $bibId = !empty($bibId) ? (string)$bibId[0] : '1'; } if ($itemAgencyId === null && isset($itemResponse)) { $itemAgencyId = $itemResponse->xpath( @@ -1773,7 +1773,7 @@ public function placeStorageRetrievalRequest($details) public function getRenewDetails($checkOutDetails) { return $checkOutDetails['item_agency_id'] . - "|" . $checkOutDetails['item_id']; + '|' . $checkOutDetails['item_id']; } /** @@ -1817,7 +1817,7 @@ public function placeRequest($details, $type = 'Hold') $requestType = $details['holdtype'] ?? $type; $pickUpLocation = null; if (isset($details['pickUpLocation'])) { - [, $pickUpLocation] = explode("|", $details['pickUpLocation']); + [, $pickUpLocation] = explode('|', $details['pickUpLocation']); } $convertedDate = $this->dateConverter->convertFromDisplayDate( @@ -1835,7 +1835,7 @@ public function placeRequest($details, $type = 'Hold') $details['patron']['patronAgencyId'], $details['item_agency_id'], $requestType, - "Item", + 'Item', $lastInterestDateStr, $pickUpLocation, $username @@ -1903,7 +1903,7 @@ public function handleCancelRequest($cancelDetails, $type = 'Hold') ]; foreach ($details as $detail) { - [$itemAgencyId, $requestId, $itemId] = explode("|", $detail); + [$itemAgencyId, $requestId, $itemId] = explode('|', $detail); $request = $this->getCancelRequest( $username, $password, @@ -1969,8 +1969,8 @@ public function getCancelRequestDetails($details) return ''; } return $details['item_agency_id'] . - "|" . $details['requestId'] . - "|" . $details['item_id']; + '|' . $details['requestId'] . + '|' . $details['item_id']; } /** @@ -2046,10 +2046,10 @@ public function renewMyItems($renewDetails) $details = []; $username = $renewDetails['patron']['cat_username']; foreach ($renewDetails['details'] as $detail) { - [$agencyId, $itemId] = explode("|", $detail); + [$agencyId, $itemId] = explode('|', $detail); $failureReturn = [ - "success" => false, - "item_id" => $itemId, + 'success' => false, + 'item_id' => $itemId, ]; if ($this->disableRenewals) { $details[$itemId] = $failureReturn; @@ -2075,10 +2075,10 @@ public function renewMyItems($renewDetails) if ($dueDate !== '') { $details[$itemId] = [ - "success" => true, - "new_date" => $dueDate, - "new_time" => $dueTime, - "item_id" => $itemId, + 'success' => true, + 'new_date' => $dueDate, + 'new_time' => $dueTime, + 'item_id' => $itemId, ]; } else { $details[$itemId] = $failureReturn; diff --git a/module/VuFind/src/VuFind/ILS/Logic/Holds.php b/module/VuFind/src/VuFind/ILS/Logic/Holds.php index 32868db9ca1..56b6ae86770 100644 --- a/module/VuFind/src/VuFind/ILS/Logic/Holds.php +++ b/module/VuFind/src/VuFind/ILS/Logic/Holds.php @@ -226,9 +226,9 @@ public function getHoldings($id, $ids = null, $options = []) $mode = $this->catalog->getHoldsMode(); - if ($mode == "disabled") { + if ($mode == 'disabled') { $holdings = $this->standardHoldings($result); - } elseif ($mode == "driver") { + } elseif ($mode == 'driver') { $holdings = $this->driverHoldings($result, $config, !empty($blocks)); } else { $holdings = $this->generateHoldings($result, $mode, $config); @@ -361,16 +361,16 @@ protected function generateHoldings($result, $type, $holdConfig) ? $copy['holdOverride'] : $type; switch ($currentType) { - case "all": + case 'all': $addlink = true; // always provide link break; - case "holds": + case 'holds': $addlink = $copy['availability']; break; - case "recalls": + case 'recalls': $addlink = !$copy['availability']; break; - case "availability": + case 'availability': $addlink = !$copy['availability'] && ($any_available == false); break; @@ -381,7 +381,7 @@ protected function generateHoldings($result, $type, $holdConfig) // If a valid holdable status has been set, use it to // determine if a hold link is created if ($addlink && ($copy['is_holdable'] ?? true)) { - if ($holdConfig['function'] == "getHoldLink") { + if ($holdConfig['function'] == 'getHoldLink') { /* Build opac link */ $holdings[$location_key][$copy_key]['link'] = $this->catalog->getHoldLink( @@ -539,19 +539,19 @@ protected function getRequestDetails($details, $HMACKeys, $action) foreach ($details as $key => $param) { $needle = in_array($key, $HMACKeys); if ($needle) { - $queryString[] = $key . "=" . urlencode($param); + $queryString[] = $key . '=' . urlencode($param); } } // Add HMAC - $queryString[] = "hashKey=" . urlencode($HMACkey); + $queryString[] = 'hashKey=' . urlencode($HMACkey); $queryString = implode('&', $queryString); // Build Params return [ 'action' => $action, 'record' => $details['id'], 'source' => $details['source'] ?? DEFAULT_SEARCH_BACKEND, - 'query' => $queryString, 'anchor' => "#tabnav", + 'query' => $queryString, 'anchor' => '#tabnav', ]; } @@ -568,10 +568,10 @@ protected function getHoldingsGroupKey($copy) $grouping = $this->config->Catalog->holdings_grouping ?? 'holdings_id,location'; - $groupKey = ""; + $groupKey = ''; // Multiple keys may be used here (delimited by comma) - foreach (array_map('trim', explode(",", $grouping)) as $key) { + foreach (array_map('trim', explode(',', $grouping)) as $key) { // backwards-compatibility: // The config.ini file originally expected only // two possible settings: holdings_id and location_name. @@ -580,12 +580,12 @@ protected function getHoldingsGroupKey($copy) // From now on, we will expect (via config.ini documentation) // the value of 'location', but still continue to honor // 'location_name'. - if ($key == "location_name") { - $key = "location"; + if ($key == 'location_name') { + $key = 'location'; } if (isset($copy[$key])) { - if ($groupKey != "") { + if ($groupKey != '') { $groupKey .= '|'; } $groupKey .= $copy[$key]; @@ -593,7 +593,7 @@ protected function getHoldingsGroupKey($copy) } // default: - if ($groupKey == "") { + if ($groupKey == '') { $groupKey = $copy['location']; } diff --git a/module/VuFind/src/VuFind/ImageLoader.php b/module/VuFind/src/VuFind/ImageLoader.php index 3bc4d83260c..83a5c3f9371 100644 --- a/module/VuFind/src/VuFind/ImageLoader.php +++ b/module/VuFind/src/VuFind/ImageLoader.php @@ -86,10 +86,10 @@ class ImageLoader implements \Laminas\Log\LoggerAwareInterface * @var array */ protected $allowedFileExtensions = [ - "gif" => "image/gif", - "jpeg" => "image/jpeg", "jpg" => "image/jpeg", - "png" => "image/png", - "tiff" => "image/tiff", "tif" => "image/tiff", + 'gif' => 'image/gif', + 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', + 'png' => 'image/png', + 'tiff' => 'image/tiff', 'tif' => 'image/tiff', ]; /** diff --git a/module/VuFind/src/VuFind/Log/LoggerFactory.php b/module/VuFind/src/VuFind/Log/LoggerFactory.php index 5553a5e0850..af9c24a13b7 100644 --- a/module/VuFind/src/VuFind/Log/LoggerFactory.php +++ b/module/VuFind/src/VuFind/Log/LoggerFactory.php @@ -181,7 +181,7 @@ protected function addSlackWriters( ); $writer->setContentType('application/json'); $formatter = new \Laminas\Log\Formatter\Simple( - "*%priorityName%*: %message%" + '*%priorityName%*: %message%' ); $writer->setFormatter($formatter); $this->addWriters($logger, $writer, $filters); @@ -216,7 +216,7 @@ protected function addOffice365Writers( ); $writer->setContentType('application/json'); $formatter = new \Laminas\Log\Formatter\Simple( - "*%priorityName%*: %message%" + '*%priorityName%*: %message%' ); $writer->setFormatter($formatter); $this->addWriters($logger, $writer, $filters); diff --git a/module/VuFind/src/VuFind/Log/Writer/Office365.php b/module/VuFind/src/VuFind/Log/Writer/Office365.php index b408edf5e3c..d27a10be0b7 100644 --- a/module/VuFind/src/VuFind/Log/Writer/Office365.php +++ b/module/VuFind/src/VuFind/Log/Writer/Office365.php @@ -75,11 +75,11 @@ public function __construct($url, Client $client, array $options = []) protected function getBody($event) { $data = [ - "@context" => "https://schema.org/extensions", - "@type" => "MessageCard", - "themeColor" => "0072C6", - "title" => $this->title, - "text" => $this->formatter->format($event), + '@context' => 'https://schema.org/extensions', + '@type' => 'MessageCard', + 'themeColor' => '0072C6', + 'title' => $this->title, + 'text' => $this->formatter->format($event), ]; return json_encode($data); } diff --git a/module/VuFind/src/VuFind/OAI/Server.php b/module/VuFind/src/VuFind/OAI/Server.php index 6c24b6a5aee..0ab5bf53fa9 100644 --- a/module/VuFind/src/VuFind/OAI/Server.php +++ b/module/VuFind/src/VuFind/OAI/Server.php @@ -1150,11 +1150,11 @@ protected function listRecordsGetParams() */ protected function isBadDate($from, $until) { - $dt = \DateTime::createFromFormat("Y-m-d", substr($until, 0, 10)); + $dt = \DateTime::createFromFormat('Y-m-d', substr($until, 0, 10)); if ($dt === false || array_sum($dt->getLastErrors())) { return true; } - $dt = \DateTime::createFromFormat("Y-m-d", substr($from, 0, 10)); + $dt = \DateTime::createFromFormat('Y-m-d', substr($from, 0, 10)); if ($dt === false || array_sum($dt->getLastErrors())) { return true; } diff --git a/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php b/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php index 29330303066..d65eb5249db 100644 --- a/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php +++ b/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php @@ -155,7 +155,7 @@ public function setConfig($settings) if (!empty($this->excludeProviders)) { $this->excludeProviders = explode(',', $this->excludeProviders); } - $this->searchSite = "Europeana.eu"; + $this->searchSite = 'Europeana.eu'; } /** @@ -171,7 +171,7 @@ public function setConfig($settings) protected function getURL($targetUrl, $requestParam, $excludeProviders) { // build url - $url = $targetUrl . "?" . $requestParam . "=" . $this->lookfor; + $url = $targetUrl . '?' . $requestParam . '=' . $this->lookfor; // add providers to ignore foreach ($excludeProviders as $provider) { $provider = trim($provider); diff --git a/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjects.php b/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjects.php index 645667433f0..f9ea8b056d4 100644 --- a/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjects.php +++ b/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjects.php @@ -124,7 +124,7 @@ public function setConfig($settings) if (isset($params[3])) { $this->subjectTypes = explode(',', $params[3]); } else { - $this->subjectTypes = ["topic"]; + $this->subjectTypes = ['topic']; } // A 4th parameter is not specified in searches.ini, if it exists diff --git a/module/VuFind/src/VuFind/Recommend/PubDateVisAjax.php b/module/VuFind/src/VuFind/Recommend/PubDateVisAjax.php index 41458835a63..cf65cf647af 100644 --- a/module/VuFind/src/VuFind/Recommend/PubDateVisAjax.php +++ b/module/VuFind/src/VuFind/Recommend/PubDateVisAjax.php @@ -84,11 +84,11 @@ public function setConfig($settings) // Parse the additional settings: $params = explode(':', $settings); - if ($params[0] == "true" || $params[0] == "false") { + if ($params[0] == 'true' || $params[0] == 'false') { $this->zooming = $params[0]; $this->dateFacets = array_slice($params, 1); } else { - $this->zooming = "false"; + $this->zooming = 'false'; $this->dateFacets = $params; } } diff --git a/module/VuFind/src/VuFind/Recommend/RandomRecommend.php b/module/VuFind/src/VuFind/Recommend/RandomRecommend.php index a0b6f25a50d..0f4e38902bf 100644 --- a/module/VuFind/src/VuFind/Recommend/RandomRecommend.php +++ b/module/VuFind/src/VuFind/Recommend/RandomRecommend.php @@ -174,7 +174,7 @@ public function setConfig($settings) */ public function init($params, $request) { - if ("retain" !== $this->mode) { + if ('retain' !== $this->mode) { $randomParams = $this->paramManager->get($params->getSearchClassId()); } else { $randomParams = clone $params; diff --git a/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php b/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php index ba16afea002..6939865bc34 100644 --- a/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php +++ b/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php @@ -676,7 +676,7 @@ public function getLCCN() // If there is a forward slash (/) in the string, remove it, and remove all // characters to the right of the forward slash. if (strpos($raw, '/') > 0) { - $tmpArray = explode("/", $raw); + $tmpArray = explode('/', $raw); $raw = $tmpArray[0]; } /* If there is a hyphen in the string: @@ -691,8 +691,8 @@ public function getLCCN() if (strpos($raw, '-') > 0) { // haven't checked for i. above. If they aren't all digits, there is // nothing that can be done, so might as well leave it. - $tmpArray = explode("-", $raw); - $raw = $tmpArray[0] . str_pad($tmpArray[1], 6, "0", STR_PAD_LEFT); + $tmpArray = explode('-', $raw); + $raw = $tmpArray[0] . str_pad($tmpArray[1], 6, '0', STR_PAD_LEFT); } return $raw; } @@ -954,7 +954,7 @@ public function getOpenUrl($overrideSupportsOpenUrl = false) $query[] = urlencode($key) . '=' . urlencode($sub); } } - return implode("&", $query); + return implode('&', $query); } /** diff --git a/module/VuFind/src/VuFind/RecordDriver/EDS.php b/module/VuFind/src/VuFind/RecordDriver/EDS.php index 095ebc64248..04e4a9d5180 100644 --- a/module/VuFind/src/VuFind/RecordDriver/EDS.php +++ b/module/VuFind/src/VuFind/RecordDriver/EDS.php @@ -510,7 +510,7 @@ public function linkUrls($string) "/\b(https?):\/\/([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)\b/i", function ($matches) { return "" - . htmlentities($matches[0]) . ""; + . htmlentities($matches[0]) . ''; }, $string ); @@ -575,7 +575,7 @@ protected function toHTML($data, $group = null) ]; // The XML data is escaped, let's unescape html entities (e.g. < => <) - $data = html_entity_decode($data, ENT_QUOTES, "utf-8"); + $data = html_entity_decode($data, ENT_QUOTES, 'utf-8'); // Start parsing the xml data if (!empty($data)) { diff --git a/module/VuFind/src/VuFind/RecordDriver/EIT.php b/module/VuFind/src/VuFind/RecordDriver/EIT.php index e01c1caee6b..e5a9c3dfc16 100644 --- a/module/VuFind/src/VuFind/RecordDriver/EIT.php +++ b/module/VuFind/src/VuFind/RecordDriver/EIT.php @@ -438,7 +438,7 @@ protected function getOpenUrlFormat() protected function getCoinsID() { // Added at Richard and Leslie's request, to facilitate ILL - return parent::getCoinsID() . ".ebsco"; + return parent::getCoinsID() . '.ebsco'; } /** diff --git a/module/VuFind/src/VuFind/RecordDriver/Feature/IlsAwareTrait.php b/module/VuFind/src/VuFind/RecordDriver/Feature/IlsAwareTrait.php index 131c81a2483..dde2eb7427c 100644 --- a/module/VuFind/src/VuFind/RecordDriver/Feature/IlsAwareTrait.php +++ b/module/VuFind/src/VuFind/RecordDriver/Feature/IlsAwareTrait.php @@ -145,8 +145,8 @@ public function getRealTimeTitleHold() { if ($this->hasILS()) { $biblioLevel = strtolower($this->tryMethod('getBibliographicLevel')); - if ("monograph" == $biblioLevel || strstr($biblioLevel, "part")) { - if ($this->ils->getTitleHoldsMode() != "disabled") { + if ('monograph' == $biblioLevel || strstr($biblioLevel, 'part')) { + if ($this->ils->getTitleHoldsMode() != 'disabled') { return $this->titleHoldLogic->getHold($this->getUniqueID()); } } diff --git a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php index 3faf2094250..2a659698e74 100644 --- a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php +++ b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php @@ -192,21 +192,21 @@ public function getBibliographicLevel() switch ($biblioLevel) { case 'M': // Monograph - return "Monograph"; + return 'Monograph'; case 'S': // Serial - return "Serial"; + return 'Serial'; case 'A': // Monograph Part - return "MonographPart"; + return 'MonographPart'; case 'B': // Serial Part - return "SerialPart"; + return 'SerialPart'; case 'C': // Collection - return "Collection"; + return 'Collection'; case 'D': // Collection Part - return "CollectionPart"; + return 'CollectionPart'; case 'I': // Integrating Resource - return "IntegratingResource"; + return 'IntegratingResource'; default: - return "Unknown"; + return 'Unknown'; } } @@ -953,7 +953,7 @@ public function getXML($format, $baseUrl = null, $linker = null) } // Set up proper namespacing and extract just the tag: - $xml->record->addAttribute('xmlns', "http://www.loc.gov/MARC21/slim"); + $xml->record->addAttribute('xmlns', 'http://www.loc.gov/MARC21/slim'); // There's a quirk in SimpleXML that strips the first namespace // declaration, hence the double xmlns: prefix: $xml->record->addAttribute( diff --git a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcBasicTrait.php b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcBasicTrait.php index 33d3258184d..0ec7d43fd3f 100644 --- a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcBasicTrait.php +++ b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcBasicTrait.php @@ -55,7 +55,7 @@ public function getISBNs() $this->getFieldArray('773', ['z']) ); foreach ($isbn as $key => $num) { - $isbn[$key] = str_replace("-", "", $num); + $isbn[$key] = str_replace('-', '', $num); } $isbn = array_unique($isbn); return $isbn; diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrOverdrive.php b/module/VuFind/src/VuFind/RecordDriver/SolrOverdrive.php index 26c79c94d61..ff56148098f 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SolrOverdrive.php +++ b/module/VuFind/src/VuFind/RecordDriver/SolrOverdrive.php @@ -180,28 +180,28 @@ public function getFormattedDigitalFormats() if ($format->fileSize > 0) { if ($format->fileSize > 1000000) { $size = round($format->fileSize / 1000000); - $size .= " GB"; + $size .= ' GB'; } elseif ($format->fileSize > 1000) { $size = round($format->fileSize / 1000); - $size .= " MB"; + $size .= ' MB'; } else { $size = $format->fileSize; - $size .= " KB"; + $size .= ' KB'; } - $tmpresults["File Size"] = $size; + $tmpresults['File Size'] = $size; } if ($format->partCount) { - $tmpresults["Parts"] = $format->partCount; + $tmpresults['Parts'] = $format->partCount; } if ($format->identifiers) { foreach ($format->identifiers as $id) { - if (in_array($id->type, ["ISBN", "ASIN"])) { + if (in_array($id->type, ['ISBN', 'ASIN'])) { $tmpresults[$id->type] = $id->value; } } } if ($format->onSaleDate) { - $tmpresults["Release Date"] = $format->onSaleDate; + $tmpresults['Release Date'] = $format->onSaleDate; } $results[$format->name] = $tmpresults; } @@ -237,7 +237,7 @@ public function getPreviewLinks() } } } - $this->debug("previewlinks:" . print_r($results, true)); + $this->debug('previewlinks:' . print_r($results, true)); return $results; } @@ -329,7 +329,7 @@ public function getOverdriveAvailability() */ public function isCheckedOut() { - $this->debug(" ischeckout", [], true); + $this->debug(' ischeckout', [], true); $overdriveID = $this->getOverdriveID(); $result = $this->connector->getCheckouts(true); if ($result->status) { @@ -466,11 +466,11 @@ public function getSummary() return parent::getSummary(); } // Non-MARC case: - $desc = $this->fields["description"] ?? ''; + $desc = $this->fields['description'] ?? ''; - $newDesc = preg_replace("/’/i", "", $desc); + $newDesc = preg_replace('/’/i', '', $desc); $newDesc = strip_tags($newDesc); - return ["Summary" => $newDesc]; + return ['Summary' => $newDesc]; } /** @@ -535,12 +535,12 @@ public function getFormattedRawData() $data = json_decode($jsonData, true); $c_arr = []; foreach ($data['creators'] as $creator) { - $c_arr[] = "{$creator["role"]}: " - . $creator["name"]; + $c_arr[] = "{$creator['role']}: " + . $creator['name']; } - $data['creators'] = implode("
", $c_arr); + $data['creators'] = implode('
', $c_arr); - $this->debug("raw data:" . print_r($data, true)); + $this->debug('raw data:' . print_r($data, true)); return $data; } diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Jop.php b/module/VuFind/src/VuFind/Resolver/Driver/Jop.php index a0236c1c453..52df05d7a9a 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/Jop.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/Jop.php @@ -216,7 +216,7 @@ protected function downgradeOpenUrl($parsed) { // we need 'genre' but only the values // article or journal are allowed... - $downgraded[] = "genre=article"; + $downgraded[] = 'genre=article'; // prepare content for downgrading // resolver only accepts date formats YYYY, YYYY-MM, and YYYY-MM-DD @@ -268,8 +268,8 @@ protected function downgradeOpenUrl($parsed) protected function getElectronicResults($state, $coverage, &$records, $xpath) { $results = $xpath->query( - "/OpenURLResponseXML/Full/ElectronicData/ResultList/Result[@state=" . - $state . "]" + '/OpenURLResponseXML/Full/ElectronicData/ResultList/Result[@state=' . + $state . ']' ); /* @@ -303,8 +303,8 @@ protected function getElectronicResults($state, $coverage, &$records, $xpath) $record = []; // get title from XPath Element defined in $xpathTitleSelector - $titleXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" . - "Result[@state={$state}][" . ($i + 1) . "]/" . + $titleXP = '/OpenURLResponseXML/Full/ElectronicData/ResultList/' . + "Result[@state={$state}][" . ($i + 1) . ']/' . $this->xpathTitleSelector; $title = $xpath->query($titleXP, $result)->item(0); if (isset($title)) { @@ -312,8 +312,8 @@ protected function getElectronicResults($state, $coverage, &$records, $xpath) } // get additional coverage information - $additionalXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" . - "Result[@state={$state}][" . ($i + 1) . "]/Additionals/Additional"; + $additionalXP = '/OpenURLResponseXML/Full/ElectronicData/ResultList/' . + "Result[@state={$state}][" . ($i + 1) . ']/Additionals/Additional'; $additionalType = ['nali', 'intervall', 'moving_wall']; $additionals = []; foreach ($additionalType as $type) { @@ -325,18 +325,18 @@ protected function getElectronicResults($state, $coverage, &$records, $xpath) } } $record['coverage'] - = !empty($additionals) ? implode("; ", $additionals) : $coverage; + = !empty($additionals) ? implode('; ', $additionals) : $coverage; $record['access'] = $state_access_mapping[$state]; // try to find direct access URL - $accessUrlXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" . - "Result[@state={$state}][" . ($i + 1) . "]/AccessURL"; + $accessUrlXP = '/OpenURLResponseXML/Full/ElectronicData/ResultList/' . + "Result[@state={$state}][" . ($i + 1) . ']/AccessURL'; $accessUrl = $xpath->query($accessUrlXP, $result)->item(0); // try to find journal URL as fallback for direct access URL - $journalUrlXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" . - "Result[@state={$state}][" . ($i + 1) . "]/JournalURL"; + $journalUrlXP = '/OpenURLResponseXML/Full/ElectronicData/ResultList/' . + "Result[@state={$state}][" . ($i + 1) . ']/JournalURL'; $journalUrl = $xpath->query($journalUrlXP, $result)->item(0); // return direct access URL if available otherwise journal URL fallback @@ -397,24 +397,24 @@ protected function getPrintResults($state, $coverage, &$records, $xpath) $record = []; $record['title'] = $coverage; - $resultXP = "/OpenURLResponseXML/Full/PrintData/ResultList/" . - "Result[@state={$state}][" . ($i + 1) . "]"; + $resultXP = '/OpenURLResponseXML/Full/PrintData/ResultList/' . + "Result[@state={$state}][" . ($i + 1) . ']'; $resultElements = [ 'Title', 'Location', 'Signature', 'Period', 'Holding_comment', ]; $elements = []; foreach ($resultElements as $element) { - $elem = $xpath->query($resultXP . "/" . $element, $result)->item(0); + $elem = $xpath->query($resultXP . '/' . $element, $result)->item(0); if (isset($elem->nodeValue)) { $elements[$element] = strip_tags($elem->nodeValue); } } $record['coverage'] - = !empty($elements) ? implode("; ", $elements) : $coverage; + = !empty($elements) ? implode('; ', $elements) : $coverage; $record['access'] = $state_access_mapping[$state]; - $urlXP = "/OpenURLResponseXML/Full/PrintData/References/Reference/URL"; + $urlXP = '/OpenURLResponseXML/Full/PrintData/References/Reference/URL'; $url = $xpath->query($urlXP, $result)->item($i); if (isset($url->nodeValue)) { $record['href'] = $url->nodeValue; diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Redi.php b/module/VuFind/src/VuFind/Resolver/Driver/Redi.php index c5f7bcb2cc8..6cf4e2db7ae 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/Redi.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/Redi.php @@ -138,7 +138,7 @@ protected function parseDOI($xml) if ($doiTerm->length == $doiDefinition->length) { for ($i = 0; $i < $doiTerm->length; $i++) { $href = $xpath - ->query(".//@href", $doiDefinition->item($i)) + ->query('.//@href', $doiDefinition->item($i)) ->item(0)->textContent; $retval[] = [ 'title' => $doiTerm->item($i)->textContent @@ -206,11 +206,11 @@ protected function parseRediOpenURLs($xml) for ($i = 0; $i < $ezbResultsNodesText->length; $i++) { $accessClass = 'unknown'; $accessClassExpressions = [ - "denied" => "//div[@class='t_ezb_result'][" + 'denied' => "//div[@class='t_ezb_result'][" . ($i + 1) . "]/p/span[@class='t_ezb_red']", - "limited" => "//div[@class='t_ezb_result'][" + 'limited' => "//div[@class='t_ezb_result'][" . ($i + 1) . "]/p/span[@class='t_ezb_yellow']", - "open" => "//div[@class='t_ezb_result'][" + 'open' => "//div[@class='t_ezb_result'][" . ($i + 1) . "]/p/span[@class='t_ezb_green']", ]; // $i+1 because XPath-element-counting starts with 1 foreach ($accessClassExpressions as $key => $value) { @@ -222,7 +222,7 @@ protected function parseRediOpenURLs($xml) $itemInfo = ''; $expression = "//div[@class='t_ezb_result'][" - . ($i + 1) . "]/p/sup"; + . ($i + 1) . ']/p/sup'; if ($xpath->evaluate("count({$expression})") == 1) { $itemInfo = $this->parseRediInfo( $xml, @@ -233,7 +233,7 @@ protected function parseRediOpenURLs($xml) $retval[] = [ 'title' => $ezbResultsNodesText->item($i)->textContent, 'href' => $ezbResultsNodesURL->item($i) - ->attributes->getNamedItem("href")->textContent, + ->attributes->getNamedItem('href')->textContent, 'access' => $accessClass, 'coverage' => $itemInfo, 'service_type' => 'getFullTxt', diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Sfx.php b/module/VuFind/src/VuFind/Resolver/Driver/Sfx.php index 33a1e6710f3..d6039c14d3c 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/Sfx.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/Sfx.php @@ -100,7 +100,7 @@ public function parseLinks($xmlstr) return $records; } - $root = $xml->xpath("//ctx_obj_targets"); + $root = $xml->xpath('//ctx_obj_targets'); $xml = $root[0]; foreach ($xml->children() as $target) { $record = []; diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php b/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php index ef48ad04e66..f9e28690327 100644 --- a/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php +++ b/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php @@ -138,25 +138,25 @@ public function parseLinks($xmlstr) $record['service_type'] = 'getHolding'; } $elems = $xpath->query( - ".//ssopenurl:holdingData/ssopenurl:providerName", + './/ssopenurl:holdingData/ssopenurl:providerName', $linkGroup ); $title = $elems->item(0)->textContent; $elems = $xpath->query( - ".//ssopenurl:holdingData/ssopenurl:databaseName", + './/ssopenurl:holdingData/ssopenurl:databaseName', $linkGroup ); $title .= ' - ' . $elems->item(0)->textContent; $record['title'] = $title; $elems = $xpath->query( - ".//ssopenurl:holdingData/ssopenurl:startDate", + './/ssopenurl:holdingData/ssopenurl:startDate', $linkGroup ); if ($elems->length > 0) { $record['coverage'] = $elems->item(0)->textContent . ' - '; } $elems = $xpath->query( - ".//ssopenurl:holdingData/ssopenurl:endDate", + './/ssopenurl:holdingData/ssopenurl:endDate', $linkGroup ); if ($elems->length > 0) { diff --git a/module/VuFind/src/VuFind/Role/PermissionProvider/ServerParam.php b/module/VuFind/src/VuFind/Role/PermissionProvider/ServerParam.php index 8f96f041dc9..0f9e97cdb41 100644 --- a/module/VuFind/src/VuFind/Role/PermissionProvider/ServerParam.php +++ b/module/VuFind/src/VuFind/Role/PermissionProvider/ServerParam.php @@ -102,10 +102,10 @@ public function getPermissions($options) foreach ((array)$options as $option) { $this->debug("getPermissions: option '{$option}'"); if (!$this->checkServerParam($option)) { - $this->debug("getPermissions: result = false"); + $this->debug('getPermissions: result = false'); return []; } - $this->debug("getPermissions: result = true"); + $this->debug('getPermissions: result = true'); } return ['guest', 'loggedin']; } diff --git a/module/VuFind/src/VuFind/SMS/Clickatell.php b/module/VuFind/src/VuFind/SMS/Clickatell.php index e979bea4436..c074890847a 100644 --- a/module/VuFind/src/VuFind/SMS/Clickatell.php +++ b/module/VuFind/src/VuFind/SMS/Clickatell.php @@ -148,14 +148,14 @@ protected function getApiUrl($to, $message) // Get base URL: $url = isset($this->smsConfig->Clickatell->url) ? trim($this->smsConfig->Clickatell->url, '?') - : "https://api.clickatell.com/http/sendmsg"; + : 'https://api.clickatell.com/http/sendmsg'; // Add parameters to URL: - $url .= "?api_id=" . urlencode($this->getApiId()); - $url .= "&user=" . urlencode($this->getApiUsername()); - $url .= "&password=" . urlencode($this->getApiPassword()); - $url .= "&to=" . urlencode($this->filterPhoneNumber($to)); - $url .= "&text=" . urlencode($this->formatMessage($message)); + $url .= '?api_id=' . urlencode($this->getApiId()); + $url .= '&user=' . urlencode($this->getApiUsername()); + $url .= '&password=' . urlencode($this->getApiPassword()); + $url .= '&to=' . urlencode($this->filterPhoneNumber($to)); + $url .= '&text=' . urlencode($this->formatMessage($message)); return $url; } diff --git a/module/VuFind/src/VuFind/Search/Base/Options.php b/module/VuFind/src/VuFind/Search/Base/Options.php index e7830adffc6..64248aa94fb 100644 --- a/module/VuFind/src/VuFind/Search/Base/Options.php +++ b/module/VuFind/src/VuFind/Search/Base/Options.php @@ -283,7 +283,7 @@ abstract class Options implements TranslatorAwareInterface * * @var string */ - protected $listviewOption = "full"; + protected $listviewOption = 'full'; /** * Configuration loader diff --git a/module/VuFind/src/VuFind/Search/Base/Params.php b/module/VuFind/src/VuFind/Search/Base/Params.php index 471feeee41b..d533052988b 100644 --- a/module/VuFind/src/VuFind/Search/Base/Params.php +++ b/module/VuFind/src/VuFind/Search/Base/Params.php @@ -443,7 +443,7 @@ protected function initBasicSearch($request) // to great lengths for compatibility. if (is_array($lookfor)) { if (count($lookfor) > 1) { - throw new \Exception("Unsupported search URL."); + throw new \Exception('Unsupported search URL.'); } $lookfor = $lookfor[0]; } diff --git a/module/VuFind/src/VuFind/Search/Base/Results.php b/module/VuFind/src/VuFind/Search/Base/Results.php index 5b2057317ed..389fed56adf 100644 --- a/module/VuFind/src/VuFind/Search/Base/Results.php +++ b/module/VuFind/src/VuFind/Search/Base/Results.php @@ -520,7 +520,7 @@ public function updateSaveStatus($row) protected function startQueryTimer() { // Get time before the query - $time = explode(" ", microtime()); + $time = explode(' ', microtime()); $this->queryStartTime = $time[1] + $time[0]; } @@ -532,7 +532,7 @@ protected function startQueryTimer() */ protected function stopQueryTimer() { - $time = explode(" ", microtime()); + $time = explode(' ', microtime()); $this->queryEndTime = $time[1] + $time[0]; $this->queryTime = $this->queryEndTime - $this->queryStartTime; } diff --git a/module/VuFind/src/VuFind/Search/EDS/Options.php b/module/VuFind/src/VuFind/Search/EDS/Options.php index 9d97923241c..6e7d60a26fd 100644 --- a/module/VuFind/src/VuFind/Search/EDS/Options.php +++ b/module/VuFind/src/VuFind/Search/EDS/Options.php @@ -472,7 +472,7 @@ protected function setOptionsFromConfig() } if (isset($this->searchSettings->General->limit_options)) { $this->limitOptions - = explode(",", $this->searchSettings->General->limit_options); + = explode(',', $this->searchSettings->General->limit_options); } // Set up highlighting preference diff --git a/module/VuFind/src/VuFind/Search/EDS/Results.php b/module/VuFind/src/VuFind/Search/EDS/Results.php index a2ea2be79cd..d2dd73bad13 100644 --- a/module/VuFind/src/VuFind/Search/EDS/Results.php +++ b/module/VuFind/src/VuFind/Search/EDS/Results.php @@ -88,7 +88,7 @@ protected function performSearch() $dateFacets = $this->getParams()->getDateFacetSettings(); if (!empty($dateFacets)) { foreach ($dateFacets as $dateFacet) { - $this->responseFacets[$dateFacet] = [""]; + $this->responseFacets[$dateFacet] = ['']; } } diff --git a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php index f0478419e9b..a9886dd735c 100644 --- a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php @@ -111,10 +111,10 @@ protected function createConnector() { // Validate configuration: if (empty($this->browzineConfig->General->access_token)) { - throw new \Exception("Missing access token in BrowZine.ini"); + throw new \Exception('Missing access token in BrowZine.ini'); } if (empty($this->browzineConfig->General->library_id)) { - throw new \Exception("Missing library ID in BrowZine.ini"); + throw new \Exception('Missing library ID in BrowZine.ini'); } // Create connector: diff --git a/module/VuFind/src/VuFind/Search/Factory/LibGuidesAZBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/LibGuidesAZBackendFactory.php index b27a5d7c7eb..c663d836640 100644 --- a/module/VuFind/src/VuFind/Search/Factory/LibGuidesAZBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/LibGuidesAZBackendFactory.php @@ -64,7 +64,7 @@ protected function createQueryBuilder() $builder = new QueryBuilder(); // Widget type 2 = Databases A-Z - $builder->setDefaultWidgetType("2"); + $builder->setDefaultWidgetType('2'); return $builder; } diff --git a/module/VuFind/src/VuFind/Search/LibGuides/Options.php b/module/VuFind/src/VuFind/Search/LibGuides/Options.php index 0a220ef7b5e..104773ed398 100644 --- a/module/VuFind/src/VuFind/Search/LibGuides/Options.php +++ b/module/VuFind/src/VuFind/Search/LibGuides/Options.php @@ -62,7 +62,7 @@ public function __construct(\VuFind\Config\PluginManager $configLoader) } if (isset($searchSettings->General->limit_options)) { $this->limitOptions - = explode(",", $searchSettings->General->limit_options); + = explode(',', $searchSettings->General->limit_options); } } diff --git a/module/VuFind/src/VuFind/Search/Primo/Options.php b/module/VuFind/src/VuFind/Search/Primo/Options.php index 851478cb221..220e97d646a 100644 --- a/module/VuFind/src/VuFind/Search/Primo/Options.php +++ b/module/VuFind/src/VuFind/Search/Primo/Options.php @@ -81,7 +81,7 @@ public function __construct(\VuFind\Config\PluginManager $configLoader) } if (isset($searchSettings->General->limit_options)) { $this->limitOptions - = explode(",", $searchSettings->General->limit_options); + = explode(',', $searchSettings->General->limit_options); } // Load search preferences: diff --git a/module/VuFind/src/VuFind/Search/Solr/Options.php b/module/VuFind/src/VuFind/Search/Solr/Options.php index b73789aeaf2..77754670474 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Options.php +++ b/module/VuFind/src/VuFind/Search/Solr/Options.php @@ -86,7 +86,7 @@ public function __construct(\VuFind\Config\PluginManager $configLoader) } if (isset($searchSettings->General->limit_options)) { $this->limitOptions - = explode(",", $searchSettings->General->limit_options); + = explode(',', $searchSettings->General->limit_options); } if (isset($searchSettings->General->default_sort)) { $this->defaultSort = $searchSettings->General->default_sort; diff --git a/module/VuFind/src/VuFind/Search/Solr/Results.php b/module/VuFind/src/VuFind/Search/Solr/Results.php index 9f633e8c72b..e48ee4171e2 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Results.php +++ b/module/VuFind/src/VuFind/Search/Solr/Results.php @@ -408,7 +408,7 @@ public function getPivotFacetList() // Start building the flare object: $flare = new \stdClass(); - $flare->name = "flare"; + $flare->name = 'flare'; $flare->total = $this->resultTotal; $flare->children = $this->responsePivotFacets; return $flare; diff --git a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php index 755dcfaf66d..fefdf2d94ee 100644 --- a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php +++ b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php @@ -130,10 +130,10 @@ public function getSpellingLimit() public function tokenize($input) { // Exclusion list of useless tokens: - $joins = ["AND", "OR", "NOT"]; + $joins = ['AND', 'OR', 'NOT']; // Strip out parentheses -- irrelevant for tokenization: - $paren = ["(" => " ", ")" => " "]; + $paren = ['(' => ' ', ')' => ' ']; $input = trim(strtr($input, $paren)); // Base of this algorithm comes straight from PHP doc example by @@ -260,7 +260,7 @@ public function processSuggestions($suggestions, $query, Params $params) foreach ($suggestions as $term => $details) { // Find out if our suggestion is part of a token $inToken = false; - $targetTerm = ""; + $targetTerm = ''; foreach ($this->tokenize($query) as $token) { // Is the term part of the current token? if (str_contains($token, (string)$term)) { @@ -279,7 +279,7 @@ public function processSuggestions($suggestions, $query, Params $params) } } // If no tokens were found, just look for the suggestion 'as is' - if ($targetTerm == "") { + if ($targetTerm == '') { $targetTerm = $term; $returnArray = $this->doSingleReplace( $term, @@ -337,7 +337,7 @@ protected function doSingleReplace( // Only generate expansions if enabled in config if ($this->expand) { // Parentheses differ for shingles - $replacement = (strstr($targetTerm, " ") !== false) + $replacement = (strstr($targetTerm, ' ') !== false) ? "(($targetTerm) OR ($replacement))" : "($targetTerm OR $replacement)"; $returnArray[$targetTerm]['suggestions'][$label]['expand_term'] diff --git a/module/VuFind/src/VuFind/Search/Summon/Options.php b/module/VuFind/src/VuFind/Search/Summon/Options.php index fb33303d4b2..3dcc407812b 100644 --- a/module/VuFind/src/VuFind/Search/Summon/Options.php +++ b/module/VuFind/src/VuFind/Search/Summon/Options.php @@ -89,7 +89,7 @@ public function __construct(\VuFind\Config\PluginManager $configLoader) } if (isset($searchSettings->General->limit_options)) { $this->limitOptions - = explode(",", $searchSettings->General->limit_options); + = explode(',', $searchSettings->General->limit_options); } // Set up highlighting preference diff --git a/module/VuFind/src/VuFind/Search/Summon/Params.php b/module/VuFind/src/VuFind/Search/Summon/Params.php index 51dd9280213..fb351fbe2e8 100644 --- a/module/VuFind/src/VuFind/Search/Summon/Params.php +++ b/module/VuFind/src/VuFind/Search/Summon/Params.php @@ -311,7 +311,7 @@ public function createBackendFilterParameters(ParamBag $params) // Special case -- support a checkbox for excluding // newspapers: $params - ->add('filters', "ContentType,Newspaper Article,true"); + ->add('filters', 'ContentType,Newspaper Article,true'); } elseif ($range = SolrUtils::parseRange($filt['value'])) { // Special case -- range query (translate [x TO y] syntax): $from = SummonQuery::escapeParam($range['from']); diff --git a/module/VuFind/src/VuFind/Session/File.php b/module/VuFind/src/VuFind/Session/File.php index 3fbd0f884a3..a833d0be668 100644 --- a/module/VuFind/src/VuFind/Session/File.php +++ b/module/VuFind/src/VuFind/Session/File.php @@ -73,7 +73,7 @@ public function __construct(Config $config = null) (!file_exists($this->path) || !is_dir($this->path)) && !mkdir($this->path) ) { - throw new \Exception("Cannot access session save path: " . $this->path); + throw new \Exception('Cannot access session save path: ' . $this->path); } } @@ -133,7 +133,7 @@ public function destroy($sessId): bool #[\ReturnTypeWillChange] public function gc($maxlifetime) { - foreach (glob($this->path . "/sess_*") as $filename) { + foreach (glob($this->path . '/sess_*') as $filename) { if (filemtime($filename) + $maxlifetime < time()) { unlink($filename); } @@ -152,7 +152,7 @@ public function gc($maxlifetime) protected function saveSession($sessId, $data): bool { $sessFile = $this->path . '/sess_' . $sessId; - if ($handle = fopen($sessFile, "w")) { + if ($handle = fopen($sessFile, 'w')) { $return = false; // Lock the file for exclusive access to avoid issues with multiple // processes writing session simultaneously: diff --git a/module/VuFind/src/VuFind/Sitemap/Generator.php b/module/VuFind/src/VuFind/Sitemap/Generator.php index 247aa521229..8304529dac0 100644 --- a/module/VuFind/src/VuFind/Sitemap/Generator.php +++ b/module/VuFind/src/VuFind/Sitemap/Generator.php @@ -241,7 +241,7 @@ public function setFileLocation(?string $newLocation = null): string */ protected function getTime() { - $time = explode(" ", microtime()); + $time = explode(' ', microtime()); return $time[1] + $time[0]; } @@ -298,7 +298,7 @@ protected function generateWithPlugins(): array $plugin = $this->getPlugin($pluginName); $sitemapName = $plugin->getSitemapName(); $msgName = empty($sitemapName) - ? "core sitemap" : "sitemap '$sitemapName'"; + ? 'core sitemap' : "sitemap '$sitemapName'"; $this->verboseMsg( "Generating $msgName with '$pluginName'" ); diff --git a/module/VuFind/src/VuFind/Solr/Utils.php b/module/VuFind/src/VuFind/Solr/Utils.php index 9f73ecd5ddc..57310a51e1b 100644 --- a/module/VuFind/src/VuFind/Solr/Utils.php +++ b/module/VuFind/src/VuFind/Solr/Utils.php @@ -101,7 +101,7 @@ public static function sanitizeDate($date) } $time = @strtotime($date); if ($time) { - $date = @date("Y-m-d", $time); + $date = @date('Y-m-d', $time); if ($year) { $date = str_replace('1999', $year, $date); } @@ -133,7 +133,7 @@ public static function sanitizeDate($date) if (strlen($date) < 8) { $day = '01'; if (preg_match('/^[0-9]{4}-([0-9]{1,2})/', $date, $matches)) { - $month = str_pad($matches[1], 2, "0", STR_PAD_LEFT); + $month = str_pad($matches[1], 2, '0', STR_PAD_LEFT); } else { $month = '01'; } @@ -141,8 +141,8 @@ public static function sanitizeDate($date) // If we have year + month + day, parse that out: $ymdRegex = '/^[0-9]{4}-([0-9]{1,2})-([0-9]{1,2})/'; if (preg_match($ymdRegex, $date, $matches)) { - $month = str_pad($matches[1], 2, "0", STR_PAD_LEFT); - $day = str_pad($matches[2], 2, "0", STR_PAD_LEFT); + $month = str_pad($matches[1], 2, '0', STR_PAD_LEFT); + $day = str_pad($matches[2], 2, '0', STR_PAD_LEFT); } else { $month = $day = '01'; } diff --git a/module/VuFind/src/VuFind/View/Helper/Bootstrap3/LayoutClass.php b/module/VuFind/src/VuFind/View/Helper/Bootstrap3/LayoutClass.php index 8306976a409..efbf4a14d4c 100644 --- a/module/VuFind/src/VuFind/View/Helper/Bootstrap3/LayoutClass.php +++ b/module/VuFind/src/VuFind/View/Helper/Bootstrap3/LayoutClass.php @@ -64,7 +64,7 @@ public function __invoke($class) : 'sidebar right hidden-print'; case 'offcanvas-row': if (!$this->offcanvas) { - return ""; + return ''; } return $this->sidebarOnLeft ? 'offcanvas offcanvas-left' diff --git a/module/VuFind/src/VuFind/View/Helper/Root/DateTime.php b/module/VuFind/src/VuFind/View/Helper/Root/DateTime.php index f02a0c45eb1..38b96dde8d8 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/DateTime.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/DateTime.php @@ -83,12 +83,12 @@ public function extractYear($date) public function getDisplayDateFormat() { $dueDateHelpString - = $this->converter->convertToDisplayDate("m-d-y", "11-22-3333"); - $search = ["1", "2", "3"]; + = $this->converter->convertToDisplayDate('m-d-y', '11-22-3333'); + $search = ['1', '2', '3']; $replace = [ - $this->view->translate("date_month_placeholder"), - $this->view->translate("date_day_placeholder"), - $this->view->translate("date_year_placeholder"), + $this->view->translate('date_month_placeholder'), + $this->view->translate('date_day_placeholder'), + $this->view->translate('date_year_placeholder'), ]; return str_replace($search, $replace, $dueDateHelpString); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/OpenUrl.php b/module/VuFind/src/VuFind/View/Helper/Root/OpenUrl.php index 104c71c8238..45f5d1d8476 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/OpenUrl.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/OpenUrl.php @@ -191,7 +191,7 @@ public function renderTemplate($imagebased = null) // ini values 'true'/'false' are provided via ini reader as 1/0 // only check embedAutoLoad for area if the current area passed checkContext if ( - !($embedAutoLoad === "1" || $embedAutoLoad === "0") + !($embedAutoLoad === '1' || $embedAutoLoad === '0') && !empty($this->area) ) { // embedAutoLoad is neither true nor false, so check if it contains an diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Overdrive.php b/module/VuFind/src/VuFind/View/Helper/Root/Overdrive.php index 63aca19c9c1..e1f7ec3d074 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Overdrive.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Overdrive.php @@ -71,15 +71,15 @@ public function showMyContentLink() return false; } $config = $this->connector->getConfig(); - if ($config->showMyContent == "always") { + if ($config->showMyContent == 'always') { return true; - } elseif ($config->showMyContent == "never") { + } elseif ($config->showMyContent == 'never') { return false; } else { //assume that it is accessOnly $result = $this->connector->getAccess(); - if (!$result->status && $result->code == "od_account_noaccess") { + if (!$result->status && $result->code == 'od_account_noaccess') { return false; } return true; diff --git a/module/VuFind/src/VuFind/View/Helper/Root/OverdriveFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/OverdriveFactory.php index a7a2d35e523..daa48dec8de 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/OverdriveFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/OverdriveFactory.php @@ -78,7 +78,7 @@ public function __invoke( $connector = null; $showMyContent = $config->Overdrive->showMyContent; $showAdmin = $config->Overdrive->showOverdriveAdminMenu; - if ($showAdmin || $showMyContent != "never") { + if ($showAdmin || $showMyContent != 'never') { $connector = $container->get( \VuFind\DigitalContent\OverdriveConnector::class ); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/PrintArrayHtml.php b/module/VuFind/src/VuFind/View/Helper/Root/PrintArrayHtml.php index 7dd46d01508..9092fddb467 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/PrintArrayHtml.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/PrintArrayHtml.php @@ -56,13 +56,13 @@ class PrintArrayHtml extends AbstractHelper public function __invoke($entry, $indentLevel = 0, $indentFirst = true) { $makeTag = $this->getView()->plugin('makeTag'); - $html = ""; + $html = ''; if (is_array($entry)) { $isList = $this->isArrayList($entry); $isFlat = $this->isArrayFlat($entry); foreach ($entry as $key => $value) { if ($indentFirst || $key != array_key_first($entry)) { - $html .= str_repeat(" ", $indentLevel); + $html .= str_repeat(' ', $indentLevel); } $valueIsSingleKeyList = $this->isSingleKeyList($value); @@ -76,19 +76,19 @@ public function __invoke($entry, $indentLevel = 0, $indentFirst = true) } if (!$isFlat && $isList && !$valueIsSingleKeyList) { // Integer keyed arrays use a hyphen list unless they're flat - $html .= "– "; + $html .= '– '; } elseif (!$isList) { - $html .= $makeTag("span", $key . ":", ["class" => "term"]) + $html .= $makeTag('span', $key . ':', ['class' => 'term']) . ( (is_array($value) && !$valueIsSingleKeyList) - ? "
\n" : " " + ? "
\n" : ' ' ); } $html .= $this->__invoke($value, $nextIndentLevel, $nextIndentFirst); } } else { - $html = $makeTag("span", $entry, ["class" => "detail"]) . "
\n"; + $html = $makeTag('span', $entry, ['class' => 'detail']) . "
\n"; } return $html; } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Printms.php b/module/VuFind/src/VuFind/View/Helper/Root/Printms.php index 951b936341a..18420ee558f 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Printms.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Printms.php @@ -74,7 +74,7 @@ public function __invoke($ms) if ($years) { return sprintf( - "%d years %d days %d hours %d minutes %d seconds", + '%d years %d days %d hours %d minutes %d seconds', $years, $days, $hours, @@ -83,7 +83,7 @@ public function __invoke($ms) ); } else { return sprintf( - "%d days %d hours %d minutes %d seconds", + '%d days %d hours %d minutes %d seconds', $days, $hours, $minutes, @@ -92,14 +92,14 @@ public function __invoke($ms) } } else { return sprintf( - "%d hours %d minutes %d seconds", + '%d hours %d minutes %d seconds', $hours, $minutes, $seconds ); } } else { - return sprintf("%d minutes %d seconds", $minutes, $seconds); + return sprintf('%d minutes %d seconds', $minutes, $seconds); } } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Record.php b/module/VuFind/src/VuFind/View/Helper/Root/Record.php index 2fe86483262..94181a1526a 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Record.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Record.php @@ -555,7 +555,7 @@ public function getThumbnailAlignment($context = 'result') public function getQrCode( $context, $extra = [], - $level = "L", + $level = 'L', $size = 3, $margin = 4 ) { @@ -564,8 +564,8 @@ public function getQrCode( } switch ($context) { - case "core": - case "results": + case 'core': + case 'results': $key = 'showIn' . ucwords(strtolower($context)); break; default: @@ -579,7 +579,7 @@ public function getQrCode( return false; } - $template = $context . "-qrcode.phtml"; + $template = $context . '-qrcode.phtml'; // Try to build text: $text = $this->renderTemplate( @@ -587,7 +587,7 @@ public function getQrCode( $extra + ['driver' => $this->driver] ); $qrcode = [ - "text" => $text, 'level' => $level, 'size' => $size, 'margin' => $margin, + 'text' => $text, 'level' => $level, 'size' => $size, 'margin' => $margin, ]; $urlHelper = $this->getView()->plugin('url'); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlus.php b/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlus.php index 189469703aa..47cd8715d10 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlus.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SyndeticsPlus.php @@ -81,7 +81,7 @@ public function getScript() if (isset($this->config->plus_id)) { $baseUrl = (isset($this->config->use_ssl) && $this->config->use_ssl) ? 'https://secure.syndetics.com' : 'http://plus.syndetics.com'; - return $baseUrl . "/widget.php?id=" + return $baseUrl . '/widget.php?id=' . urlencode($this->config->plus_id); } diff --git a/module/VuFind/src/VuFind/XSLT/Import/VuFind.php b/module/VuFind/src/VuFind/XSLT/Import/VuFind.php index fc01463fb66..bbcd03eb89d 100644 --- a/module/VuFind/src/VuFind/XSLT/Import/VuFind.php +++ b/module/VuFind/src/VuFind/XSLT/Import/VuFind.php @@ -203,7 +203,7 @@ public static function harvestWithParser($url) public static function getApertureCommand( $input, $output, - $method = "webcrawler" + $method = 'webcrawler' ) { // get the path to our sh/bat from the config $settings = static::getConfig('fulltext'); @@ -213,7 +213,7 @@ public static function getApertureCommand( $cmd = $settings->Aperture->webcrawler; // if we're using another method - substitute that into the path - $cmd = ($method != "webcrawler") + $cmd = ($method != 'webcrawler') ? str_replace('webcrawler', $method, $cmd) : $cmd; // return the full command @@ -244,7 +244,7 @@ public static function stripBadChars($in) * * @return string text contents of file. */ - public static function harvestWithAperture($url, $method = "webcrawler") + public static function harvestWithAperture($url, $method = 'webcrawler') { // Build a filename for temporary XML storage: $xmlFile = tempnam('/tmp', 'apt'); @@ -314,7 +314,7 @@ public static function getTikaCommand($input, $output, $arg) * * @return string text contents of file. */ - public static function harvestWithTika($url, $arg = "--text") + public static function harvestWithTika($url, $arg = '--text') { // Build a filename for temporary XML storage: $outputFile = tempnam('/tmp', 'tika'); diff --git a/module/VuFind/src/VuFind/XSLT/Importer.php b/module/VuFind/src/VuFind/XSLT/Importer.php index 248c2588108..5bbc9ce3007 100644 --- a/module/VuFind/src/VuFind/XSLT/Importer.php +++ b/module/VuFind/src/VuFind/XSLT/Importer.php @@ -136,7 +136,7 @@ protected function generateXML($xmlFile, $properties) // Process and return the XML through the style sheet $result = $xsl->transformToXML($xml); if (!$result) { - throw new \Exception("Problem transforming XML."); + throw new \Exception('Problem transforming XML.'); } return $result; } diff --git a/module/VuFind/src/VuFindTest/Feature/DemoDriverTestTrait.php b/module/VuFind/src/VuFindTest/Feature/DemoDriverTestTrait.php index db297ad684f..a7236129a85 100644 --- a/module/VuFind/src/VuFindTest/Feature/DemoDriverTestTrait.php +++ b/module/VuFind/src/VuFindTest/Feature/DemoDriverTestTrait.php @@ -51,7 +51,7 @@ trait DemoDriverTestTrait */ protected function getFakeTransactions($bibId) { - $rawDueDate = strtotime("now +5 days"); + $rawDueDate = strtotime('now +5 days'); return json_encode( [ [ @@ -186,7 +186,7 @@ protected function getFakeItem() 'addLink' => true, 'addStorageRetrievalRequestLink' => 'check', 'addILLRequestLink' => 'check', - "__electronic__" => false, + '__electronic__' => false, ]; } diff --git a/module/VuFind/src/VuFindTest/Integration/MinkTestCase.php b/module/VuFind/src/VuFindTest/Integration/MinkTestCase.php index 365a0f4787f..6317597b69d 100644 --- a/module/VuFind/src/VuFindTest/Integration/MinkTestCase.php +++ b/module/VuFind/src/VuFindTest/Integration/MinkTestCase.php @@ -682,7 +682,7 @@ protected function waitForPageLoad( ); $session->wait( $timeout, - "window.__documentIsReady === true" + 'window.__documentIsReady === true' ); } diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AccountActionsTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AccountActionsTest.php index c52caecbca0..bc3f5862298 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AccountActionsTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AccountActionsTest.php @@ -240,7 +240,7 @@ public function testDefaultPickUpLocation(): void $page, [ 'username' => 'username2', - 'email' => "username2@ignore.com", + 'email' => 'username2@ignore.com', ] ); $this->clickCss($page, '.modal-body .btn.btn-primary'); diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AdvancedSearchTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AdvancedSearchTest.php index 3da19f22377..a9f28f9b69e 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AdvancedSearchTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AdvancedSearchTest.php @@ -118,16 +118,16 @@ public function testAdvancedSearchForm() $page = $this->goToAdvancedSearch($session); // Add a group - $session->executeScript("addGroup()"); + $session->executeScript('addGroup()'); $this->findCss($page, '#group1'); // Add a search term - $session->executeScript("addSearch(0)"); // add_search_link_0 click + $session->executeScript('addSearch(0)'); // add_search_link_0 click $this->findCss($page, '#search0_3'); // No visible x next to lonely search term $this->findCss($page, '#search1_0 .adv-term-remove.hidden'); // Add a search term in another group - $session->executeScript("addSearch(1)"); // add_search_link_1 click + $session->executeScript('addSearch(1)'); // add_search_link_1 click $this->findCss($page, '#search1_1'); // Visible x next to lonely search term $this->findCss($page, '#search1_0 .adv-term-remove:not(.hidden)'); @@ -162,14 +162,14 @@ public function testAdvancedSearchForm() $this->assertEquals('miller', $this->findCss($page, '#search_lookfor1_0')->getValue()); // Term removal - $session->executeScript("deleteSearch(0, 2)"); // search0_2 x click + $session->executeScript('deleteSearch(0, 2)'); // search0_2 x click $this->assertNull($page->findById('search0_3')); // Terms collapsing up $this->assertEquals('1883', $this->findCss($page, '#search_lookfor0_2')->getValue()); $this->assertEquals('year', $this->findCss($page, '#search_type0_2')->getValue()); // Group removal - $session->executeScript("deleteGroup(0)"); + $session->executeScript('deleteGroup(0)'); // Submit search form $this->findCss($page, '[type=submit]')->press(); @@ -207,7 +207,7 @@ public function testAdvancedMultiGroupSearchWithNotOperator() $page = $this->goToAdvancedSearch($session); // Add a group - $session->executeScript("addGroup()"); + $session->executeScript('addGroup()'); $this->findCss($page, '#group1'); // Enter search criteria @@ -273,7 +273,7 @@ public function testDefaultLimitSorting(): void // By default, everything is sorted alphabetically: $this->assertEquals( 'Article Book Book Chapter Conference Proceeding eBook Electronic Journal Microfilm Serial', - $this->findCss($page, "#limit_format")->getText() + $this->findCss($page, '#limit_format')->getText() ); // Change the language: $this->clickCss($page, '.language.dropdown'); @@ -282,7 +282,7 @@ public function testDefaultLimitSorting(): void // Still sorted alphabetically, even though in a different language: $this->assertEquals( 'Artikel Buch Buchkapitel E-Book Elektronisch Mikrofilm Schriftenreihe Tagungsbericht Zeitschrift', - $this->findCss($page, "#limit_format")->getText() + $this->findCss($page, '#limit_format')->getText() ); } @@ -309,7 +309,7 @@ public function testLimitSortingWithOrderOverride(): void // By default, everything is sorted alphabetically: $this->assertEquals( 'Book eBook Article Book Chapter Conference Proceeding Electronic Journal Microfilm Serial', - $this->findCss($page, "#limit_format")->getText() + $this->findCss($page, '#limit_format')->getText() ); // Change the language: $this->clickCss($page, '.language.dropdown'); @@ -318,7 +318,7 @@ public function testLimitSortingWithOrderOverride(): void // Still sorted alphabetically, even though in a different language: $this->assertEquals( 'Buch E-Book Artikel Buchkapitel Elektronisch Mikrofilm Schriftenreihe Tagungsbericht Zeitschrift', - $this->findCss($page, "#limit_format")->getText() + $this->findCss($page, '#limit_format')->getText() ); } } diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/ApiTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/ApiTest.php index be3d55730d4..b6cd3228974 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/ApiTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/ApiTest.php @@ -55,10 +55,10 @@ protected function makeRecordApiCall($id = 'testbug2'): Element $session = $this->getMinkSession(); $session->visit($this->getVuFindUrl() . '/api'); $page = $session->getPage(); - $this->clickCss($page, "#operations-Record-get_record button"); - $this->clickCss($page, "#operations-Record-get_record .try-out button"); + $this->clickCss($page, '#operations-Record-get_record button'); + $this->clickCss($page, '#operations-Record-get_record .try-out button'); $this->findCss($page, '#operations-Record-get_record input[type="text"]')->setValue($id); - $this->clickCss($page, "#operations-Record-get_record .execute-wrapper button"); + $this->clickCss($page, '#operations-Record-get_record .execute-wrapper button'); return $page; } diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AuthorSearchTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AuthorSearchTest.php index ba91d4207ca..4eeb3c6b564 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AuthorSearchTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/AuthorSearchTest.php @@ -52,7 +52,7 @@ public function testCorporateAuthorSearch(): void $facets = $this->findCss($page, '#side-collapse-building a')->getText(); // We'll check for a known count from a known MARC file to confirm that // results came back. - $this->assertStringContainsString("author_relators.mrc 10", $facets); + $this->assertStringContainsString('author_relators.mrc 10', $facets); } /** @@ -66,6 +66,6 @@ public function testPrimaryAuthorSearch(): void $facets = $this->findCss($page, '#side-collapse-building a')->getText(); // We'll check for a known count from a known MARC file to confirm that // results came back. - $this->assertStringContainsString("author_relators.mrc 11", $facets); + $this->assertStringContainsString('author_relators.mrc 11', $facets); } } diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CombinedSearchTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CombinedSearchTest.php index bca60227644..6c7af1bc912 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CombinedSearchTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CombinedSearchTest.php @@ -74,9 +74,9 @@ protected function getCombinedIniOverrides() protected function assertResultsForDefaultQuery($page) { $expectedResults = [ - "#combined_Solr____one" => "Journal of rational emotive therapy : " - . "the journal of the Institute for Rational-Emotive Therapy.", - "#combined_Solr____two" => "Pluses and Minuses of Pluses and Minuses", + '#combined_Solr____one' => 'Journal of rational emotive therapy : ' + . 'the journal of the Institute for Rational-Emotive Therapy.', + '#combined_Solr____two' => 'Pluses and Minuses of Pluses and Minuses', ]; foreach ($expectedResults as $container => $title) { $this->assertEquals( diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CookieConsentTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CookieConsentTest.php index 6a52cc679a8..ea2a618d429 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CookieConsentTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/CookieConsentTest.php @@ -154,7 +154,7 @@ public function testCookieConsent() "window._paq[window._paq.length-1][0] === 'setCookieConsentGiven'" ); $this->waitStatement('VuFind.cookie.isServiceAllowed("matomo")'); - $this->waitStatement("window._paq.pop()"); + $this->waitStatement('window._paq.pop()'); // Open settings again and accept only essential cookies: $this->clickSettings($page); @@ -164,7 +164,7 @@ public function testCookieConsent() "window._paq[window._paq.length-1][0] !== 'setCookieConsentGiven'" ); $this->waitStatement('!VuFind.cookie.isServiceAllowed("matomo")'); - $this->waitStatement("window._paq.pop()"); + $this->waitStatement('window._paq.pop()'); // Open settings again and accept all cookies: $this->clickSettings($page); diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/FeedbackTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/FeedbackTest.php index a8abc0808fb..cf053a4f9a6 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/FeedbackTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/FeedbackTest.php @@ -95,7 +95,7 @@ protected function fillInAndSubmitFeedbackForm($page) $this->findCss($page, '#modal .form-control[name="name"]')->setValue('Me'); $this->findCss($page, '#modal .form-control[name="email"]') ->setValue('test@test.com'); - $this->findCss($page, "#modal #form_FeedbackSite_message") + $this->findCss($page, '#modal #form_FeedbackSite_message') ->setValue('test test test'); $this->clickCss($page, '#modal input[type="submit"]'); } diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HoldingsTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HoldingsTest.php index 11c4a23a55a..9bcee7bf034 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HoldingsTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HoldingsTest.php @@ -204,13 +204,13 @@ public function testItemStatusFull( if ($availability) { // Extra items, check both: - $location = $this->findCss($page, ".result-body .fullLocation"); + $location = $this->findCss($page, '.result-body .fullLocation'); $this->assertEquals('Test Location', $location->getText()); - $location = $this->findCss($page, ".result-body .fullLocation", null, 1); + $location = $this->findCss($page, '.result-body .fullLocation', null, 1); $this->assertEquals('Main Library', $location->getText()); } else { // No extra items to care for: - $location = $this->findCss($page, ".result-body .fullLocation"); + $location = $this->findCss($page, '.result-body .fullLocation'); $this->assertEquals('Main Library', $location->getText()); } } @@ -377,7 +377,7 @@ protected function goToSearchResults(): DocumentElement $session = $this->getMinkSession(); $session->visit( $this->getVuFindUrl() . '/Search/Results?lookfor=' - . urlencode("id:(testsample1)") + . urlencode('id:(testsample1)') ); $page = $session->getPage(); $this->waitForPageLoad($page); diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HoldsTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HoldsTest.php index 42a16e8de71..3a9c080f29d 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HoldsTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HoldsTest.php @@ -287,7 +287,7 @@ public function testPlaceHoldWithOptionalRequiredBy(): void $page, [ 'username' => 'username4', - 'email' => "username4@ignore.com", + 'email' => 'username4@ignore.com', ] ); $this->clickCss($page, 'input.btn.btn-primary'); @@ -439,15 +439,15 @@ protected function setUpFrozenHold(): DocumentElement $this->submitLoginForm($page, false); // Place the hold: - $futureDate = date("m-d-Y", strtotime("+2 days")); - $expectedDate = date("m-d-Y", strtotime("+1 day")); + $futureDate = date('m-d-Y', strtotime('+2 days')); + $expectedDate = date('m-d-Y', strtotime('+1 day')); $this->placeHoldAndGoToHoldsScreen($page, ['#startDate' => $futureDate]); // Confirm that the hold is frozen, as expected (note that the expected // date differs from the date entered, because the date entered indicates // when the hold will start, and the freeze ends on the previous day): $expected = "Frozen (temporarily suspended) through $expectedDate"; - $elementText = $this->findCss($page, ".media-body")->getText(); + $elementText = $this->findCss($page, '.media-body')->getText(); $this->assertTrue( false !== strstr($elementText, $expected), "Missing expected text: '$expected' in '$elementText'" @@ -558,8 +558,8 @@ public function testEditingDifferentPickupLocations() // Confirm that the popup contains a warning message about mismatched // pickup locations: - $expectedMsg = "Selected holds have different options for pick up location. " - . "Edit a single hold to change its pick up location."; + $expectedMsg = 'Selected holds have different options for pick up location. ' + . 'Edit a single hold to change its pick up location.'; $this->assertStringContainsString( $expectedMsg, $this->findCss($page, '#modal .hold-pickup-location')->getText() @@ -628,7 +628,7 @@ public function testFrozenHoldEditingWithCancellation(): void // Confirm that the values have changed $this->waitForPageLoad($page); $expected = "Frozen (temporarily suspended) through $futureDate"; - $elementText = $this->findCss($page, ".media-body")->getText(); + $elementText = $this->findCss($page, '.media-body')->getText(); $this->assertTrue( false !== strstr($elementText, $expected), "Missing expected text: '$expected' in '$elementText'" @@ -734,7 +734,7 @@ public function testPlaceHoldWithoutPickUpLocations(): void $page, [ 'username' => 'username3', - 'email' => "username3@ignore.com", + 'email' => 'username3@ignore.com', ] ); $this->clickCss($page, 'input.btn.btn-primary'); diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HomePageFacetsTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HomePageFacetsTest.php index 31cb962a2bd..fdc92679b59 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HomePageFacetsTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/HomePageFacetsTest.php @@ -67,7 +67,7 @@ public function testHierarchicalFacets() $session->visit($this->getVuFindUrl() . '/Search/Home'); $page = $session->getPage(); $this->waitForPageLoad($page); - $container = $this->findCss($page, "#facet_hierarchical_facet_str_mv"); + $container = $this->findCss($page, '#facet_hierarchical_facet_str_mv'); $this->assertEquals('level1a level1z', $container->getText()); } } diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/IlsActionsTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/IlsActionsTest.php index 8b8a1faf069..65272f903ab 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/IlsActionsTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/IlsActionsTest.php @@ -197,7 +197,7 @@ protected function cancelSelectedProcedure(Element $page, string $type): void // Test that control becomes active if we click a checkbox (but don't // actually cancel anything yet). - $this->clickCss($page, "#checkbox_testsample1"); + $this->clickCss($page, '#checkbox_testsample1'); $this->clickCss($page, '#cancelSelected'); $this->clickButtonGroupLink($page, 'No'); $this->assertEquals( @@ -340,12 +340,12 @@ public function testDisabledUserLogin(): void $this->clickCss($page, 'input.btn.btn-primary'); // Confirm that login form is disabled: - $this->unFindCss($page, "#profile_cat_username"); + $this->unFindCss($page, '#profile_cat_username'); $this->assertEquals( - "Connection to the library management system failed. " - . "Information related to your library account cannot be displayed. " - . "If the problem persists, please contact your library.", - $this->findCss($page, "div.alert-warning")->getText() + 'Connection to the library management system failed. ' + . 'Information related to your library account cannot be displayed. ' + . 'If the problem persists, please contact your library.', + $this->findCss($page, 'div.alert-warning')->getText() ); // Clean up the user account so we can sign up again in the next test: diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/JumpToRecordTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/JumpToRecordTest.php index b7f327aac35..c30dc624bb1 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/JumpToRecordTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/JumpToRecordTest.php @@ -49,7 +49,7 @@ class JumpToRecordTest extends \VuFindTest\Integration\MinkTestCase public function testJumpToFirst() { $this->changeConfigs( - ["config" => ["Record" => ["jump_to_single_search_result" => true]]] + ['config' => ['Record' => ['jump_to_single_search_result' => true]]] ); $page = $this->performSearch('id:testbug2'); diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/LibraryCardsTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/LibraryCardsTest.php index 870cb4ab8bb..de0ba879174 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/LibraryCardsTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/LibraryCardsTest.php @@ -210,8 +210,8 @@ public function testSwitchingCards(): void $this->waitForPageLoad($page); // Confirm the presence of a library card selector on the page: - $firstCard = $this->findCss($page, "#library_card option:nth-child(1)"); - $secondCard = $this->findCss($page, "#library_card option:nth-child(2)"); + $firstCard = $this->findCss($page, '#library_card option:nth-child(1)'); + $secondCard = $this->findCss($page, '#library_card option:nth-child(2)'); $card2Value = $secondCard->getValue(); $this->assertEquals('card 1', $firstCard->getText()); $this->assertEquals('card 2', $secondCard->getText()); diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/NextPrevNavTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/NextPrevNavTest.php index fe013121d0b..88e1d736188 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/NextPrevNavTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/NextPrevNavTest.php @@ -52,7 +52,7 @@ class NextPrevNavTest extends \VuFindTest\Integration\MinkTestCase public function testEmptySearchResultsCauseNoProblems() { $this->changeConfigs( - ["config" => ["Record" => ["next_prev_navigation" => true, "first_last_navigation" => true]]] + ['config' => ['Record' => ['next_prev_navigation' => true, 'first_last_navigation' => true]]] ); // when a search returns no results @@ -60,16 +60,16 @@ public function testEmptySearchResultsCauseNoProblems() $session = $this->getMinkSession(); $page = $session->getPage(); - $session->visit($this->getVuFindUrl() . "/Search/Results?lookfor=__ReturnNoResults__&type=AllField"); - $this->assertEquals($this->findCss($page, ".search-stats > h2")->getText(), "No Results!"); + $session->visit($this->getVuFindUrl() . '/Search/Results?lookfor=__ReturnNoResults__&type=AllField'); + $this->assertEquals($this->findCss($page, '.search-stats > h2')->getText(), 'No Results!'); // collection should render as normal - $session->visit($this->getVuFindUrl() . "/Record/geo20001"); + $session->visit($this->getVuFindUrl() . '/Record/geo20001'); // should fail if exception is thrown $this->assertStringContainsString( - "Test Publication 20001", - $this->findCss($page, "div.media-body > h1[property=name]")->getText() + 'Test Publication 20001', + $this->findCss($page, 'div.media-body > h1[property=name]')->getText() ); } } diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/OAuth2Test.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/OAuth2Test.php index 957fd05e163..5bc66de4f36 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/OAuth2Test.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/OAuth2Test.php @@ -237,7 +237,7 @@ public function testOAuth2Authorization(): void $this->assertEquals( 200, $response->getStatusCode(), - "Response: " . $response->getContent() + 'Response: ' . $response->getContent() ); $jwks = json_decode($response->getBody(), true); $this->assertArrayHasKey('n', $jwks['keys'][0] ?? []); @@ -277,7 +277,7 @@ public function testOAuth2Authorization(): void $this->assertEquals( 200, $response->getStatusCode(), - "Response: " . $response->getContent() + 'Response: ' . $response->getContent() ); $userInfo = json_decode($response->getBody(), true); @@ -302,7 +302,7 @@ public function testOAuth2Authorization(): void $this->assertEquals( 401, $response->getStatusCode(), - "Response: " . $response->getContent() + 'Response: ' . $response->getContent() ); $tokenResult = json_decode($response->getBody(), true); $this->assertArrayHasKey('error', $tokenResult); diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SavedSearchesTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SavedSearchesTest.php index 44903307945..5ad00d31cd1 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SavedSearchesTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SavedSearchesTest.php @@ -158,7 +158,7 @@ public function testSavedSearchDeduplication(): void // in our search history. $this->findAndAssertLink($page, 'Search History')->click(); $this->waitForPageLoad($page); - $this->assertSavedSearchList(["test"], $page); + $this->assertSavedSearchList(['test'], $page); } /** @@ -371,7 +371,7 @@ public function testNotificationsInSearchToolbar() // Now confirm that we have the expected text: $link = $this->findCss($page, '.searchtools .manageSchedule'); - $this->assertEquals("Alert schedule: None", $link->getText()); + $this->assertEquals('Alert schedule: None', $link->getText()); $link->click(); $this->waitForPageLoad($page); @@ -389,7 +389,7 @@ public function testNotificationsInSearchToolbar() // Let's confirm that if we repeat the search, the alert will now be set: $page = $this->performSearch('employment'); $link = $this->findCss($page, '.searchtools .manageSchedule'); - $this->assertEquals("Alert schedule: Weekly", $link->getText()); + $this->assertEquals('Alert schedule: Weekly', $link->getText()); } /** @@ -409,7 +409,7 @@ public function testNotificationsInSearchToolbarDeduplication() // We are not logged in, so we won't see the appropriate alert schedule yet // (it's always "None" for logged-out users). $link = $this->findCss($page, '.searchtools .manageSchedule'); - $this->assertEquals("Alert schedule: None", $link->getText()); + $this->assertEquals('Alert schedule: None', $link->getText()); $link->click(); $this->waitForPageLoad($page); @@ -471,7 +471,7 @@ public function testNotificationsInSearchHistoryDeduplication() // look at! From previous tests, we expect to have two in our history, but // the important one ("employment") should be first, which enables us to // safely rely on the final assertion below. - $this->assertSavedSearchList(["employment", "test"], $page); + $this->assertSavedSearchList(['employment', 'test'], $page); $this->assertCount( 2, $page->findAll('css', '#saved-searches ' . $scheduleSelector) diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchLimitTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchLimitTest.php index 5c2a9f9465a..6abbed9739d 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchLimitTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchLimitTest.php @@ -62,7 +62,7 @@ class SearchLimitTest extends \VuFindTest\Integration\MinkTestCase protected function setUpLimitedSearch( string $limitParam, string $options = null, - string $default = "20" + string $default = '20' ): Element { $config = ['default_limit' => $default, 'limit_options' => $options]; $this->changeConfigs(['searches' => ['General' => $config]]); @@ -142,12 +142,12 @@ public function testDefaults(): void public function testCustomLimits(): void { // Test that non-default value gets selected: - $page = $this->setUpLimitedSearch("9", "3,6,9", "6"); + $page = $this->setUpLimitedSearch('9', '3,6,9', '6'); $this->assertResultSize($page, 9); $this->assertLimitControl($page, [3, 6, 9], 9); // Test that default is used for empty setting: - $page = $this->setUpLimitedSearch("", "3,6,9", "6"); + $page = $this->setUpLimitedSearch('', '3,6,9', '6'); $this->assertResultSize($page, 6); $this->assertLimitControl($page, [3, 6, 9], 6); } @@ -162,14 +162,14 @@ public function testInvalidLimits(): void // If we request 40 items when only 3/6/9 are supported and default is 6, // we should get 6 results. VuFind blocks limits that are higher than the // highest supported value. - $page = $this->setUpLimitedSearch("40", "3,6,9", "6"); + $page = $this->setUpLimitedSearch('40', '3,6,9', '6'); $this->assertResultSize($page, 6); $this->assertLimitControl($page, [3, 6, 9], 6); // If we request 4 items when only 3/6/9 are supported and default is 6, // we should get 4 results. VuFind allows non-standard limits that are lower // than the highest supported value. - $page = $this->setUpLimitedSearch("4", "3,6,9", "6"); + $page = $this->setUpLimitedSearch('4', '3,6,9', '6'); $this->assertResultSize($page, 4); $this->assertLimitControl($page, [3, 6, 9], 3); } @@ -182,12 +182,12 @@ public function testInvalidLimits(): void public function testNonNumericLimitValues(): void { // Characters at end of number should get ignored: - $page = $this->setUpLimitedSearch("9%27A=0", "3,6,9", "6"); + $page = $this->setUpLimitedSearch('9%27A=0', '3,6,9', '6'); $this->assertResultSize($page, 9); $this->assertLimitControl($page, [3, 6, 9], 9); // Entirely nonsensical limit should give default value: - $page = $this->setUpLimitedSearch("GARBAGE", "3,6,9", "6"); + $page = $this->setUpLimitedSearch('GARBAGE', '3,6,9', '6'); $this->assertResultSize($page, 6); $this->assertLimitControl($page, [3, 6, 9], 6); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/DatabaseUnitTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/DatabaseUnitTest.php index 6ed8195fc75..0dd90e79f28 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/DatabaseUnitTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/DatabaseUnitTest.php @@ -270,8 +270,8 @@ public function testCreateWithBadPasswordPolicyPattern(): void public function getTestCreateWithUsernamePolicyData(): array { $defaultConfig = [ - 'username_pattern' => "([\\x21\\x23-\\x2B\\x2D-\\x2F\\x3D\\x3F\\x40" - . "\\x5E-\\x60\\x7B-\\x7E\\p{L}\\p{Nd}]+)", + 'username_pattern' => '([\\x21\\x23-\\x2B\\x2D-\\x2F\\x3D\\x3F\\x40' + . '\\x5E-\\x60\\x7B-\\x7E\\p{L}\\p{Nd}]+)', ]; $numericConfig = [ 'minimum_username_length' => 4, diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/CSV/ImportHelper/ScopusTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/CSV/ImportHelper/ScopusTest.php index 12778281939..188ed2dc6ca 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/CSV/ImportHelper/ScopusTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/CSV/ImportHelper/ScopusTest.php @@ -49,14 +49,14 @@ class ScopusTest extends \PHPUnit\Framework\TestCase */ public function testNameSplittingDefaultBehavior(): void { - $input = "Rai, P., Bajgai, Y., Rabgyal, J., Katwal, T.B., Delmond, A.R."; + $input = 'Rai, P., Bajgai, Y., Rabgyal, J., Katwal, T.B., Delmond, A.R.'; $this->assertEquals( [ - "Rai, P.", - "Bajgai, Y.", - "Rabgyal, J.", - "Katwal, T.B.", - "Delmond, A.R.", + 'Rai, P.', + 'Bajgai, Y.', + 'Rabgyal, J.', + 'Katwal, T.B.', + 'Delmond, A.R.', ], Scopus::splitNames($input) ); @@ -69,11 +69,11 @@ public function testNameSplittingDefaultBehavior(): void */ public function testNameSplittingWithHyphenatedInitials(): void { - $input = "Bellone, R., Failloux, A.-B."; + $input = 'Bellone, R., Failloux, A.-B.'; $this->assertEquals( [ - "Bellone, R.", - "Failloux, A.-B.", + 'Bellone, R.', + 'Failloux, A.-B.', ], Scopus::splitNames($input) ); @@ -86,14 +86,14 @@ public function testNameSplittingWithHyphenatedInitials(): void */ public function testNameSplittingWithMissingInitials(): void { - $input = "Khan, M.Q., Yaseen, Zahid, H., Numan, M., da Silva Vaz, I."; + $input = 'Khan, M.Q., Yaseen, Zahid, H., Numan, M., da Silva Vaz, I.'; $this->assertEquals( [ - "Khan, M.Q.", - "Yaseen", - "Zahid, H.", - "Numan, M.", - "da Silva Vaz, I.", + 'Khan, M.Q.', + 'Yaseen', + 'Zahid, H.', + 'Numan, M.', + 'da Silva Vaz, I.', ], Scopus::splitNames($input) ); @@ -106,10 +106,10 @@ public function testNameSplittingWithMissingInitials(): void */ public function testNameSplittingWithFirstOnlyFlag(): void { - $input = "Rai, P., Bajgai, Y., Rabgyal, J., Katwal, T.B., Delmond, A.R."; + $input = 'Rai, P., Bajgai, Y., Rabgyal, J., Katwal, T.B., Delmond, A.R.'; $this->assertEquals( [ - "Rai, P.", + 'Rai, P.', ], Scopus::splitNames($input, 1) ); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Config/UpgradeTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Config/UpgradeTest.php index bb8afd26199..2a7579a508c 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Config/UpgradeTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Config/UpgradeTest.php @@ -102,15 +102,15 @@ protected function checkVersion($version) . 'For usage tracking, please configure Google Analytics or Matomo.', ]; if ((float)$version < 1.3) { - $expectedWarnings[] = "WARNING: This version of VuFind does not support " - . "the default theme. Your config.ini [Site] theme setting " - . "has been reset to the default: bootprint3. You may need to " - . "reimplement your custom theme."; + $expectedWarnings[] = 'WARNING: This version of VuFind does not support ' + . 'the default theme. Your config.ini [Site] theme setting ' + . 'has been reset to the default: bootprint3. You may need to ' + . 'reimplement your custom theme.'; } elseif ((float)$version < 2.4) { - $expectedWarnings[] = "WARNING: This version of VuFind does not support " - . "the blueprint theme. Your config.ini [Site] theme setting " - . "has been reset to the default: bootprint3. You may need to " - . "reimplement your custom theme."; + $expectedWarnings[] = 'WARNING: This version of VuFind does not support ' + . 'the blueprint theme. Your config.ini [Site] theme setting ' + . 'has been reset to the default: bootprint3. You may need to ' + . 'reimplement your custom theme.'; } $this->assertEquals($expectedWarnings, $warnings); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Connection/LibGuidesTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Connection/LibGuidesTest.php index cef21e0f85b..3ba8a24e2b5 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Connection/LibGuidesTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Connection/LibGuidesTest.php @@ -94,7 +94,7 @@ protected function getConfig() protected function getClient($fixture) { $adapter = new TestAdapter(); - $adapter->addResponse($this->getFixture("libguides/api/token")); + $adapter->addResponse($this->getFixture('libguides/api/token')); $adapter->addResponse($this->getFixture("libguides/api/$fixture")); $adapter->setResponseIndex(1); $client = new HttpClient(); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Http/CachingDownloaderTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Http/CachingDownloaderTest.php index 5de53a1dbf9..8d578c6d404 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Http/CachingDownloaderTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Http/CachingDownloaderTest.php @@ -125,7 +125,7 @@ public function testException() $service->expects($this->once()) ->method('get') ->with($testUrl) - ->willThrowException(new \Exception("Download failed (404): " . $testUrl)); + ->willThrowException(new \Exception('Download failed (404): ' . $testUrl)); // cacheManager $storage = $this->getMockBuilder(\Laminas\Cache\Storage\StorageInterface::class) diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/AlephTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/AlephTest.php index c3db639d4e0..2e2ca71576d 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/AlephTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/AlephTest.php @@ -70,7 +70,7 @@ public function testGetMyFines(): void [ 'cat_username' => 'my_login', 'cat_password' => 'my_password', - 'id' => "patron_id", + 'id' => 'patron_id', ] ); $expected = [ diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/AlmaTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/AlmaTest.php index d9b5ae0ae00..165b0226922 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/AlmaTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/AlmaTest.php @@ -204,10 +204,10 @@ public function testGetHoldingWithMappings(): void $config = $this->defaultDriverConfig; $config['Holdings'] = [ 'locationTypeItemStatus' => [ - 'AVAIL' => "Always There:available", - 'ORDER' => "Order Only", // availability determined by other attributes - 'STAFF' => "Staff Use:uncertain", - 'UNAVAIL' => "Newer There:unavailable", + 'AVAIL' => 'Always There:available', + 'ORDER' => 'Order Only', // availability determined by other attributes + 'STAFF' => 'Staff Use:uncertain', + 'UNAVAIL' => 'Newer There:unavailable', ], ]; $this->createConnector('get-holding-with-mappings', $config); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/DAIATest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/DAIATest.php index cbf8231ddc4..df5a8c04633 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/DAIATest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/DAIATest.php @@ -55,13 +55,13 @@ class DAIATest extends \VuFindTest\Unit\ILSDriverTestCase 'availability' => true, 'duedate' => null, 'requests_placed' => '', - 'id' => "027586081", - 'item_id' => "http://uri.gbv.de/document/opac-de-000:epn:711134758", - 'ilslink' => "http://opac.example-library.edu/loan/REQ?EPN=711134758", + 'id' => '027586081', + 'item_id' => 'http://uri.gbv.de/document/opac-de-000:epn:711134758', + 'ilslink' => 'http://opac.example-library.edu/loan/REQ?EPN=711134758', 'number' => 1, - 'barcode' => "1", - 'reserve' => "N", - 'callnumber' => "ABC 12", + 'barcode' => '1', + 'reserve' => 'N', + 'callnumber' => 'ABC 12', 'location' => 'Example Library for DAIA Tests', 'locationid' => 'http://uri.gbv.de/organization/isil/DE-000', 'locationhref' => 'http://www.example-library.edu', @@ -84,13 +84,13 @@ class DAIATest extends \VuFindTest\Unit\ILSDriverTestCase 'availability' => true, 'duedate' => null, 'requests_placed' => '', - 'id' => "027586081", - 'item_id' => "http://uri.gbv.de/document/opac-de-000:epn:711134766", - 'ilslink' => "http://opac.example-library.edu/DB=1/PPNSET?PPN=027586081", + 'id' => '027586081', + 'item_id' => 'http://uri.gbv.de/document/opac-de-000:epn:711134766', + 'ilslink' => 'http://opac.example-library.edu/DB=1/PPNSET?PPN=027586081', 'number' => 2, - 'barcode' => "1", - 'reserve' => "N", - 'callnumber' => "DEF 34", + 'barcode' => '1', + 'reserve' => 'N', + 'callnumber' => 'DEF 34', 'location' => 'Example Library for DAIA Tests', 'locationid' => 'http://uri.gbv.de/organization/isil/DE-000', 'locationhref' => 'http://www.example-library.edu', @@ -111,15 +111,15 @@ class DAIATest extends \VuFindTest\Unit\ILSDriverTestCase [ 'status' => '', 'availability' => false, - 'duedate' => "02-09-2115", + 'duedate' => '02-09-2115', 'requests_placed' => '', - 'id' => "027586081", - 'item_id' => "http://uri.gbv.de/document/opac-de-000:epn:7111347777", - 'ilslink' => "http://opac.example-library.edu/DB=1/PPNSET?PPN=027586081", + 'id' => '027586081', + 'item_id' => 'http://uri.gbv.de/document/opac-de-000:epn:7111347777', + 'ilslink' => 'http://opac.example-library.edu/DB=1/PPNSET?PPN=027586081', 'number' => 3, - 'barcode' => "1", - 'reserve' => "N", - 'callnumber' => "GHI 56", + 'barcode' => '1', + 'reserve' => 'N', + 'callnumber' => 'GHI 56', 'location' => 'Example Library for DAIA Tests', 'locationid' => 'http://uri.gbv.de/organization/isil/DE-000', 'locationhref' => 'http://www.example-library.edu', diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/FolioTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/FolioTest.php index 92afbb6adf4..c33e9dcdbda 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/FolioTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/FolioTest.php @@ -100,8 +100,8 @@ class FolioTest extends \PHPUnit\Framework\TestCase * @return Response */ public function mockMakeRequest( - string $method = "GET", - string $path = "/", + string $method = 'GET', + string $path = '/', $params = [], array $headers = [] ): Response { @@ -139,7 +139,7 @@ public function mockMakeRequest( // Create response $response = new \Laminas\Http\Response(); $response->setStatusCode($testData['status'] ?? 200); - $bodyType = $testData['bodyType'] ?? "string"; + $bodyType = $testData['bodyType'] ?? 'string'; $rawBody = $testData['body'] ?? ''; $body = $bodyType === 'json' ? json_encode($rawBody) : $rawBody; $response->setContent($body); @@ -354,7 +354,7 @@ public function testUnsuccessfulPlaceHoldInvalidExpirationDate(): void 'pickUpLocation' => 'desk1', ]; $this->expectException(\VuFind\Exception\ILS::class); - $this->expectExceptionMessage("hold_date_invalid"); + $this->expectExceptionMessage('hold_date_invalid'); $result = $this->driver->placeHold($details); } @@ -550,8 +550,8 @@ public function testIsHoldableDefaultConfig(): void $driverConfig['Holds']['excludeHoldLocations'] = ['reserve']; // Test default mode is exact - $this->createConnector("empty", $driverConfig); - $this->assertFalse($this->callMethod($this->driver, "isHoldable", ["reserve"])); + $this->createConnector('empty', $driverConfig); + $this->assertFalse($this->callMethod($this->driver, 'isHoldable', ['reserve'])); } /** @@ -566,11 +566,11 @@ public function testIsHoldableExactMode(): void // Positive test for exact compare mode $driverConfig['Holds']['excludeHoldLocations'] = ['reserve']; $driverConfig['Holds']['excludeHoldLocationsCompareMode'] = 'exact'; - $this->createConnector("empty", $driverConfig); + $this->createConnector('empty', $driverConfig); - $this->assertFalse($this->callMethod($this->driver, "isHoldable", ["reserve"])); - $this->assertTrue($this->callMethod($this->driver, "isHoldable", ["Reserve"])); - $this->assertTrue($this->callMethod($this->driver, "isHoldable", ["library"])); + $this->assertFalse($this->callMethod($this->driver, 'isHoldable', ['reserve'])); + $this->assertTrue($this->callMethod($this->driver, 'isHoldable', ['Reserve'])); + $this->assertTrue($this->callMethod($this->driver, 'isHoldable', ['library'])); } /** @@ -585,11 +585,11 @@ public function testIsHoldableRegexMode(): void // Positive test for regex compare mode $driverConfig['Holds']['excludeHoldLocations'] = ['/RESERVE/i']; $driverConfig['Holds']['excludeHoldLocationsCompareMode'] = 'regex'; - $this->createConnector("empty", $driverConfig); - $this->assertFalse($this->callMethod($this->driver, "isHoldable", ["reserve"])); - $this->assertFalse($this->callMethod($this->driver, "isHoldable", ["Reserve"])); - $this->assertTrue($this->callMethod($this->driver, "isHoldable", ["library"])); - $this->assertFalse($this->callMethod($this->driver, "isHoldable", ["24 hour reserve desk"])); + $this->createConnector('empty', $driverConfig); + $this->assertFalse($this->callMethod($this->driver, 'isHoldable', ['reserve'])); + $this->assertFalse($this->callMethod($this->driver, 'isHoldable', ['Reserve'])); + $this->assertTrue($this->callMethod($this->driver, 'isHoldable', ['library'])); + $this->assertFalse($this->callMethod($this->driver, 'isHoldable', ['24 hour reserve desk'])); } /** @@ -605,15 +605,15 @@ public function testIsHoldableInvalidRegex(): void // Negative test for regex compare mode (invalid regex) $driverConfig['Holds']['excludeHoldLocations'] = ['RESERVE']; $driverConfig['Holds']['excludeHoldLocationsCompareMode'] = 'regex'; - $this->createConnector("empty", $driverConfig); - $this->assertTrue($this->callMethod($this->driver, "isHoldable", ["reserve"])); + $this->createConnector('empty', $driverConfig); + $this->assertTrue($this->callMethod($this->driver, 'isHoldable', ['reserve'])); // Negative test for regex compare mode (non-string setting and parameter used) $driverConfig['Holds']['excludeHoldLocations'] = [true]; - $this->createConnector("empty", $driverConfig); - $this->assertTrue($this->callMethod($this->driver, "isHoldable", ["library"])); - $this->assertTrue($this->callMethod($this->driver, "isHoldable", ["true"])); - $this->assertTrue($this->callMethod($this->driver, "isHoldable", [true])); + $this->createConnector('empty', $driverConfig); + $this->assertTrue($this->callMethod($this->driver, 'isHoldable', ['library'])); + $this->assertTrue($this->callMethod($this->driver, 'isHoldable', ['true'])); + $this->assertTrue($this->callMethod($this->driver, 'isHoldable', [true])); } /** @@ -629,15 +629,15 @@ public function testIsHoldableCaseSensitivityConfig(): void // Test that compare mode for exact is case insensitive $driverConfig['Holds']['excludeHoldLocationsCompareMode'] = 'Exact'; $driverConfig['Holds']['excludeHoldLocations'] = ['reserve']; - $this->createConnector("empty", $driverConfig); - $this->assertFalse($this->callMethod($this->driver, "isHoldable", ["reserve"])); + $this->createConnector('empty', $driverConfig); + $this->assertFalse($this->callMethod($this->driver, 'isHoldable', ['reserve'])); // Test that compare mode for regex is case insensitive $driverConfig['Holds']['excludeHoldLocations'] = ['/RESERVE/i']; $driverConfig['Holds']['excludeHoldLocationsCompareMode'] = ' ReGeX '; - $this->createConnector("empty", $driverConfig); - $this->assertTrue($this->callMethod($this->driver, "isHoldable", ["Library of Stuff"])); - $this->assertFalse($this->callMethod($this->driver, "isHoldable", ["Library of reservED Stuff"])); + $this->createConnector('empty', $driverConfig); + $this->assertTrue($this->callMethod($this->driver, 'isHoldable', ['Library of Stuff'])); + $this->assertFalse($this->callMethod($this->driver, 'isHoldable', ['Library of reservED Stuff'])); } /** @@ -653,10 +653,10 @@ public function testIsHoldableExactModeInvalidInput(): void // Negative test for exact compare mode (non-string setting and parameter used) $driverConfig['Holds']['excludeHoldLocations'] = [1]; $driverConfig['Holds']['excludeHoldLocationsCompareMode'] = 'exact'; - $this->createConnector("empty", $driverConfig); - $this->assertFalse($this->callMethod($this->driver, "isHoldable", [1])); - $this->assertTrue($this->callMethod($this->driver, "isHoldable", [0])); - $this->assertFalse($this->callMethod($this->driver, "isHoldable", ["1"])); + $this->createConnector('empty', $driverConfig); + $this->assertFalse($this->callMethod($this->driver, 'isHoldable', [1])); + $this->assertTrue($this->callMethod($this->driver, 'isHoldable', [0])); + $this->assertFalse($this->callMethod($this->driver, 'isHoldable', ['1'])); } /** @@ -725,7 +725,7 @@ protected function getExpectedGetHoldingResult(): array 'is_holdable' => true, 'holdings_notes' => null, 'item_notes' => null, - 'summary' => ["foo", "bar baz"], + 'summary' => ['foo', 'bar baz'], 'supplements' => [], 'indexes' => [], 'location' => 'Special Collections', @@ -745,8 +745,8 @@ public function testGetHoldingWithHridLookup(): void { $driverConfig = $this->defaultDriverConfig; $driverConfig['IDs']['type'] = 'hrid'; - $this->createConnector("get-holding", $driverConfig); - $this->assertEquals($this->getExpectedGetHoldingResult(), $this->driver->getHolding("foo")); + $this->createConnector('get-holding', $driverConfig); + $this->assertEquals($this->getExpectedGetHoldingResult(), $this->driver->getHolding('foo')); } /** @@ -760,8 +760,8 @@ public function testGetStatuses(): void // a minor variation of the test above. $driverConfig = $this->defaultDriverConfig; $driverConfig['IDs']['type'] = 'hrid'; - $this->createConnector("get-holding", $driverConfig); - $this->assertEquals([$this->getExpectedGetHoldingResult()], $this->driver->getStatuses(["foo"])); + $this->createConnector('get-holding', $driverConfig); + $this->assertEquals([$this->getExpectedGetHoldingResult()], $this->driver->getStatuses(['foo'])); } /** @@ -773,7 +773,7 @@ public function testGetHoldingWithFolioSorting(): void { $driverConfig = $this->defaultDriverConfig; $driverConfig['Holdings']['folio_sort'] = 'volume'; - $this->createConnector("get-holding-sorted", $driverConfig); + $this->createConnector('get-holding-sorted', $driverConfig); $expected = [ [ 'callnumber_prefix' => '', @@ -788,7 +788,7 @@ public function testGetHoldingWithFolioSorting(): void 'duedate' => '', 'availability' => true, 'is_holdable' => true, - 'holdings_notes' => ["Fake note"], + 'holdings_notes' => ['Fake note'], 'item_notes' => null, 'summary' => [], 'supplements' => ['Fake supplement statement With a note!'], @@ -799,7 +799,7 @@ public function testGetHoldingWithFolioSorting(): void 'addLink' => true, ], ]; - $this->assertEquals($expected, $this->driver->getHolding("instanceid")); + $this->assertEquals($expected, $this->driver->getHolding('instanceid')); } /** @@ -811,7 +811,7 @@ public function testGetHoldingFilteringOfEmptyHoldingStatements(): void { $driverConfig = $this->defaultDriverConfig; $driverConfig['Holdings']['folio_sort'] = 'volume'; - $this->createConnector("get-holding-empty-statements", $driverConfig); + $this->createConnector('get-holding-empty-statements', $driverConfig); $expected = [ [ 'callnumber_prefix' => '', @@ -826,7 +826,7 @@ public function testGetHoldingFilteringOfEmptyHoldingStatements(): void 'duedate' => '', 'availability' => true, 'is_holdable' => true, - 'holdings_notes' => ["Fake note"], + 'holdings_notes' => ['Fake note'], 'item_notes' => null, 'summary' => ['summ1', 'summ2'], 'supplements' => ['supp1', 'supp2'], @@ -837,7 +837,7 @@ public function testGetHoldingFilteringOfEmptyHoldingStatements(): void 'addLink' => true, ], ]; - $this->assertEquals($expected, $this->driver->getHolding("instanceid")); + $this->assertEquals($expected, $this->driver->getHolding('instanceid')); } /** @@ -847,7 +847,7 @@ public function testGetHoldingFilteringOfEmptyHoldingStatements(): void */ public function testGetHoldingWithDueDate(): void { - $this->createConnector("get-holding-checkedout"); + $this->createConnector('get-holding-checkedout'); $expected = [ [ 'callnumber_prefix' => '', @@ -862,7 +862,7 @@ public function testGetHoldingWithDueDate(): void 'duedate' => '06-01-2023', 'availability' => false, 'is_holdable' => true, - 'holdings_notes' => ["Fake note"], + 'holdings_notes' => ['Fake note'], 'item_notes' => null, 'summary' => [], 'supplements' => ['Fake supplement statement With a note!'], @@ -873,7 +873,7 @@ public function testGetHoldingWithDueDate(): void 'addLink' => true, ], ]; - $this->assertEquals($expected, $this->driver->getHolding("instanceid")); + $this->assertEquals($expected, $this->driver->getHolding('instanceid')); } /** @@ -885,7 +885,7 @@ public function testGetHoldingMultiVolumeWithVuFindSorting(): void { $driverConfig = $this->defaultDriverConfig; $driverConfig['Holdings']['vufind_sort'] = 'enumchron'; - $this->createConnector("get-holding-multi-volume", $driverConfig); + $this->createConnector('get-holding-multi-volume', $driverConfig); $expected = [ [ 'callnumber_prefix' => '', @@ -900,7 +900,7 @@ public function testGetHoldingMultiVolumeWithVuFindSorting(): void 'duedate' => '', 'availability' => true, 'is_holdable' => true, - 'holdings_notes' => ["Fake note"], + 'holdings_notes' => ['Fake note'], 'item_notes' => null, 'summary' => [], 'supplements' => ['Fake supplement statement With a note!'], @@ -923,7 +923,7 @@ public function testGetHoldingMultiVolumeWithVuFindSorting(): void 'duedate' => '', 'availability' => true, 'is_holdable' => true, - 'holdings_notes' => ["Fake note"], + 'holdings_notes' => ['Fake note'], 'item_notes' => null, 'summary' => [], 'supplements' => ['Fake supplement statement With a note!'], @@ -934,7 +934,7 @@ public function testGetHoldingMultiVolumeWithVuFindSorting(): void 'addLink' => true, ], ]; - $this->assertEquals($expected, $this->driver->getHolding("instanceid")); + $this->assertEquals($expected, $this->driver->getHolding('instanceid')); } /** diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php index 35bee6328dd..3cc229b38a7 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php @@ -318,8 +318,8 @@ public function testAddIdPrefixes() // Empty source must not add prefixes $expected = [ - 'id' => "record1", - 'cat_username' => "record2", + 'id' => 'record1', + 'cat_username' => 'record2', ]; $result = $this->callMethod($driver, 'addIdPrefixes', [$data, '']); $this->assertEquals($expected, $result); @@ -393,7 +393,7 @@ public function testStripIdPrefixes() $data = "$source.record"; $result = $this->callMethod($driver, 'stripIdPrefixes', [$data, $source]); - $this->assertEquals("record", $result); + $this->assertEquals('record', $result); $expected = [ 'id' => 'record1', @@ -447,7 +447,7 @@ public function testStripIdPrefixes() 'test' => ["$source.foo", "$source.bar"], ]; $expected = [ - 'id' => "record1", + 'id' => 'record1', 'test' => ["$source.foo", "$source.bar"], ]; $result = $this->callMethod( @@ -548,7 +548,7 @@ function ($param) { ->getHolding('d1.123456', ['cat_username' => 'test.patron']); $this->assertEquals($expectedReturn, $return); - $return = $driver->getHolding("fail.123456"); + $return = $driver->getHolding('fail.123456'); $this->assertEquals([], $return); $return = $driver->getHolding('d1.654321'); @@ -779,17 +779,17 @@ function ($driver) use ($ils1, $ils2) { ]; $expectedReturn = [ [ - ['id' => "d1.123456", 'status' => 'in'], - ['id' => "d1.123456", 'status' => 'out'], + ['id' => 'd1.123456', 'status' => 'in'], + ['id' => 'd1.123456', 'status' => 'out'], ], [ - ['id' => "d1.098765", 'status' => 'out'], + ['id' => 'd1.098765', 'status' => 'out'], ], [ - ['id' => "d2.654321", 'status' => 'out'], + ['id' => 'd2.654321', 'status' => 'out'], ], [ - ['id' => "d2.567890", 'status' => 'in'], + ['id' => 'd2.567890', 'status' => 'in'], ], ]; $return = $driver->getStatuses($ids); @@ -821,17 +821,17 @@ function ($driver) use ($ils1, $ils3) { ]; $expectedReturn = [ [ - ['id' => "d1.123456", 'status' => 'in'], - ['id' => "d1.123456", 'status' => 'out'], + ['id' => 'd1.123456', 'status' => 'in'], + ['id' => 'd1.123456', 'status' => 'out'], ], [ - ['id' => "d1.098765", 'status' => 'out'], + ['id' => 'd1.098765', 'status' => 'out'], ], [ - ['id' => "d3.654321", 'error' => 'An error has occurred'], + ['id' => 'd3.654321', 'error' => 'An error has occurred'], ], [ - ['id' => "d3.567890", 'error' => 'An error has occurred'], + ['id' => 'd3.567890', 'error' => 'An error has occurred'], ], ]; $return = $driver->getStatuses($ids); @@ -849,9 +849,9 @@ function ($driver) use ($ils1, $ils3) { public function testGetLocalId() { $driver = $this->getDriver(); - $term = "source.local"; + $term = 'source.local'; $return = $this->callMethod($driver, 'getLocalId', [$term]); - $this->assertEquals("local", $return); + $this->assertEquals('local', $return); } /** @@ -1183,7 +1183,7 @@ public function testPatronLogin() ); $this->expectException(\VuFind\Exception\ILS::class); - $driver->patronLogin("bad", "info"); + $driver->patronLogin('bad', 'info'); } /** diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/PAIATest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/PAIATest.php index 5cfd2679cc2..b6ac4f90e9e 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/PAIATest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/PAIATest.php @@ -303,9 +303,9 @@ class PAIATest extends \VuFindTest\Unit\ILSDriverTestCase 'details' => [ 'http://uri.gbv.de/document/opac-de-830:bar:830$22061137' => [ 'success' => true, - 'new_date' => "07-18-2016", + 'new_date' => '07-18-2016', 'item_id' => 0, - 'sysMessage' => "Successfully renewed", + 'sysMessage' => 'Successfully renewed', ], ], ]; @@ -317,21 +317,21 @@ class PAIATest extends \VuFindTest\Unit\ILSDriverTestCase protected $pwchangeTestResult = [ 'success' => true, - 'status' => "Successfully changed", + 'status' => 'Successfully changed', ]; protected $profileTestResult = [ - 'firstname' => "Susan Q.", - 'lastname' => "Nothing", - 'address1' => "No street at all 8, D-21073 Hamburg", + 'firstname' => 'Susan Q.', + 'lastname' => 'Nothing', + 'address1' => 'No street at all 8, D-21073 Hamburg', 'address2' => null, 'city' => null, 'country' => null, 'zip' => null, 'phone' => null, - 'group' => "de-830:user-type:2", + 'group' => 'de-830:user-type:2', 'mobile_phone' => null, - 'expires' => "12-31-9999", + 'expires' => '12-31-9999', 'statuscode' => 0, 'canWrite' => true, ]; @@ -372,11 +372,11 @@ public function setUp(): void public function testChangePassword() { $changePasswordTestdata = [ - "patron" => [ - "cat_username" => "08301001001", + 'patron' => [ + 'cat_username' => '08301001001', ], - "oldPassword" => "oldsecret", - "newPassword" => "newsecret", + 'oldPassword' => 'oldsecret', + 'newPassword' => 'newsecret', ]; $conn = $this->createMockConnector('changePassword.json'); @@ -518,9 +518,9 @@ public function testRenewDetails() public function testPlaceHold() { $sr_request = [ - "item_id" => "http://uri.gbv.de/document/opac-de-830:bar:830$24014292", - "patron" => [ - "cat_username" => "08301001001", + 'item_id' => 'http://uri.gbv.de/document/opac-de-830:bar:830$24014292', + 'patron' => [ + 'cat_username' => '08301001001', ], ]; @@ -537,9 +537,9 @@ public function testPlaceHold() public function testPlaceStorageRetrievalRequest() { $sr_request = [ - "item_id" => "http://uri.gbv.de/document/opac-de-830:bar:830$24014292", - "patron" => [ - "cat_username" => "08301001001", + 'item_id' => 'http://uri.gbv.de/document/opac-de-830:bar:830$24014292', + 'patron' => [ + 'cat_username' => '08301001001', ], ]; @@ -556,11 +556,11 @@ public function testPlaceStorageRetrievalRequest() public function testRenew() { $renew_request = [ - "details" => [ - "item" => "http://uri.gbv.de/document/opac-de-830:bar:830$22061137", + 'details' => [ + 'item' => 'http://uri.gbv.de/document/opac-de-830:bar:830$22061137', ], - "patron" => [ - "cat_username" => "08301001001", + 'patron' => [ + 'cat_username' => '08301001001', ], ]; diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/XCNCIP2Test.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/XCNCIP2Test.php index 7445b8aa06e..bd07368ccda 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/XCNCIP2Test.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/XCNCIP2Test.php @@ -758,7 +758,7 @@ public function testGetMyTransactions() $transactions = $this->driver->getMyTransactions( [ 'cat_username' => 'my_login', 'cat_password' => 'my_password', - 'patronAgencyId' => 'Test agency', 'id' => "patron_id", + 'patronAgencyId' => 'Test agency', 'id' => 'patron_id', ] ); $this->assertEquals( @@ -790,7 +790,7 @@ public function testDisableRenewalsConfiguration() $transactions = $this->driver->getMyTransactions( [ 'cat_username' => 'my_login', 'cat_password' => 'my_password', - 'patronAgencyId' => 'Test agency', 'id' => "patron_id", + 'patronAgencyId' => 'Test agency', 'id' => 'patron_id', ] ); $this->assertEquals( @@ -826,7 +826,7 @@ public function testDisableRenewalsConfiguration() $transactions = $this->driver->getMyTransactions( [ 'cat_username' => 'my_login', 'cat_password' => 'my_password', - 'patronAgencyId' => 'Test agency', 'id' => "patron_id", + 'patronAgencyId' => 'Test agency', 'id' => 'patron_id', ] ); $this->assertEquals( @@ -850,7 +850,7 @@ public function testGetMyFines() $fines = $this->driver->getMyFines( [ 'cat_username' => 'my_login', 'cat_password' => 'my_password', - 'patronAgencyId' => 'Test agency', 'id' => "patron_id", + 'patronAgencyId' => 'Test agency', 'id' => 'patron_id', ] ); $this->assertEquals( @@ -893,7 +893,7 @@ public function testGetMyHolds() $holds = $this->driver->getMyHolds( [ 'cat_username' => 'my_login', 'cat_password' => 'my_password', - 'patronAgencyId' => 'Test agency', 'id' => "patron_id", + 'patronAgencyId' => 'Test agency', 'id' => 'patron_id', ] ); $this->assertEquals( @@ -917,7 +917,7 @@ public function testGetMyProfile() $profile = $this->driver->getMyProfile( [ 'cat_username' => 'my_login', 'cat_password' => 'my_password', - 'patronAgencyId' => 'Test agency', 'id' => "patron_id", + 'patronAgencyId' => 'Test agency', 'id' => 'patron_id', ] ); $this->assertEquals( @@ -941,7 +941,7 @@ public function testGetMyStorageRetrievalRequests() $storageRetrievals = $this->driver->getMyStorageRetrievalRequests( [ 'cat_username' => 'my_login', 'cat_password' => 'my_password', - 'patronAgencyId' => 'Test agency', 'id' => "patron_id", + 'patronAgencyId' => 'Test agency', 'id' => 'patron_id', ] ); $this->assertEquals( @@ -1513,7 +1513,7 @@ public function testInvalidateResponseCache() $method->setAccessible(true); $patron = [ 'cat_username' => 'my_login', 'cat_password' => 'my_password', - 'patronAgencyId' => 'Test agency', 'id' => "patron_id", + 'patronAgencyId' => 'Test agency', 'id' => 'patron_id', ]; $this->mockResponse('lookupUserResponse.xml'); $profile = $this->driver->getMyProfile($patron); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Log/Writer/SlackTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Log/Writer/SlackTest.php index 1986c748216..371fcda19d4 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Log/Writer/SlackTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Log/Writer/SlackTest.php @@ -55,9 +55,9 @@ public function testWriter(): void $fakeUri = 'http://fake'; $expectedBody = json_encode( [ - "channel" => "#test", - "username" => "TestName", - "text" => ":rotating_light: Formatted message." . PHP_EOL, + 'channel' => '#test', + 'username' => 'TestName', + 'text' => ':rotating_light: Formatted message.' . PHP_EOL, ] ); $message = ['message' => 'test', 'priority' => 1]; diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/LibGuidesProfileTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/LibGuidesProfileTest.php index 9b86ca4584e..b3e86418e58 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/LibGuidesProfileTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/LibGuidesProfileTest.php @@ -92,7 +92,7 @@ public function setUp(): void $this->connector = $this->getMockBuilder(LibGuides::class) ->disableOriginalConstructor() ->getMock(); - $accountsFixture = $this->getFixture("libguides/api/accounts"); + $accountsFixture = $this->getFixture('libguides/api/accounts'); $accounts = json_decode(substr($accountsFixture, strpos($accountsFixture, '['))); $this->connector->method('getAccounts')->willReturn($accounts); 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 b0410434fb5..73b0e2116b0 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/RandomRecommendTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/RandomRecommendTest.php @@ -75,32 +75,32 @@ public function setUp(): void public function testCanSetSettings() { //[backend]:[limit]:[display mode]:[random mode]:[minimumset]:[facet1]:[facetvalue1] - $this->recommend->setConfig("SolrWeb:5:mixed:disregard:20:facet1:value1:facet2:value2"); + $this->recommend->setConfig('SolrWeb:5:mixed:disregard:20:facet1:value1:facet2:value2'); $this->assertEquals( - "SolrWeb", + 'SolrWeb', $this->getProperty($this->recommend, 'backend') ); $this->assertEquals( - "5", + '5', $this->getProperty($this->recommend, 'limit') ); $this->assertEquals( - "mixed", + 'mixed', $this->getProperty($this->recommend, 'displayMode') ); $this->assertEquals( - "disregard", + 'disregard', $this->getProperty($this->recommend, 'mode') ); $this->assertEquals( - "20", + '20', $this->getProperty($this->recommend, 'minimum') ); $filters = $this->getProperty($this->recommend, 'filters'); $this->assertIsArray($filters); $this->assertCount(2, $filters); - $this->assertEquals("facet1:value1", $filters[0]); - $this->assertEquals("facet2:value2", $filters[1]); + $this->assertEquals('facet1:value1', $filters[0]); + $this->assertEquals('facet2:value2', $filters[1]); } /** @@ -113,23 +113,23 @@ public function testDefaultSettings() //[backend]:[limit]:[display mode]:[random mode]:[minimumset]:[facet1]:[facetvalue1] $this->recommend->setConfig(''); $this->assertEquals( - "Solr", + 'Solr', $this->getProperty($this->recommend, 'backend') ); $this->assertEquals( - "10", + '10', $this->getProperty($this->recommend, 'limit') ); $this->assertEquals( - "standard", + 'standard', $this->getProperty($this->recommend, 'displayMode') ); $this->assertEquals( - "retain", + 'retain', $this->getProperty($this->recommend, 'mode') ); $this->assertEquals( - "0", + '0', $this->getProperty($this->recommend, 'minimum') ); $this->assertEquals( @@ -164,19 +164,19 @@ public function testCanInitialise() $checkCommand = function ($command) { return $command::class === \VuFindSearch\Command\RandomCommand::class - && $command->getTargetIdentifier() === "Solr" - && $command->getArguments()[0]->getAllTerms() === "john smith" + && $command->getTargetIdentifier() === 'Solr' + && $command->getArguments()[0]->getAllTerms() === 'john smith' && $command->getArguments()[1] === 10 && $command->getArguments()[2]->getArrayCopy() === ['spellcheck' => ['true'], 'fq' => ['facet1:"value1"', 'facet2:"value2"'], - 'hl' => ["false"]]; + 'hl' => ['false']]; }; $service->expects($this->once())->method('invoke') ->with($this->callback($checkCommand)) ->will($this->returnValue($commandObj)); - $recommend->setConfig("Solr:10:mixed:retain:20:facet1:value1:facet2:value2"); + $recommend->setConfig('Solr:10:mixed:retain:20:facet1:value1:facet2:value2'); $recommend->init($params, $request); } @@ -196,7 +196,7 @@ public function testCanInitialiseInDisregardMode() $params = $this->getSolrParams(); $paramManager->expects($this->once())->method('get') - ->with($this->equalTo("Solr")) + ->with($this->equalTo('Solr')) ->will($this->returnValue($params)); // Use Solr since some Base components are abstract: @@ -212,19 +212,19 @@ public function testCanInitialiseInDisregardMode() $checkCommand = function ($command) { return $command::class === \VuFindSearch\Command\RandomCommand::class - && $command->getTargetIdentifier() === "Solr" - && $command->getArguments()[0]->getAllTerms() === "john smith" + && $command->getTargetIdentifier() === 'Solr' + && $command->getArguments()[0]->getAllTerms() === 'john smith' && $command->getArguments()[1] === 10 && $command->getArguments()[2]->getArrayCopy() === ['spellcheck' => ['true'], 'fq' => ['facet1:"value1"', - 'facet2:"value2"'], 'hl' => ["false"]]; + 'facet2:"value2"'], 'hl' => ['false']]; }; $service->expects($this->once())->method('invoke') ->with($this->callback($checkCommand)) ->will($this->returnValue($commandObj)); - $recommend->setConfig("Solr:10:mixed:disregard:20:facet1:value1:facet2:value2"); + $recommend->setConfig('Solr:10:mixed:disregard:20:facet1:value1:facet2:value2'); $recommend->init($params, $request); } @@ -241,7 +241,7 @@ protected function getConfiguredModule($recConfig): Random ->disableOriginalConstructor()->getMock(); $paramManager = $this->createMock(\VuFind\Search\Params\PluginManager::class); $recommend = new Random($service, $paramManager); - $records = ["1", "2", "3", "4", "5"]; + $records = ['1', '2', '3', '4', '5']; // Use Solr since some Base components are abstract: $results = $this->getSolrResults(); @@ -263,13 +263,13 @@ protected function getConfiguredModule($recConfig): Random $checkCommand = function ($command) { return $command::class === \VuFindSearch\Command\RandomCommand::class - && $command->getTargetIdentifier() === "Solr" - && $command->getArguments()[0]->getAllTerms() === "john smith" + && $command->getTargetIdentifier() === 'Solr' + && $command->getArguments()[0]->getAllTerms() === 'john smith' && $command->getArguments()[1] === 10 && $command->getArguments()[2]->getArrayCopy() === ['spellcheck' => ['true'], 'fq' => ['facet1:"value1"', - 'facet2:"value2"'], 'hl' => ["false"]]; + 'facet2:"value2"'], 'hl' => ['false']]; }; $service->expects($this->once())->method('invoke') ->with($this->callback($checkCommand)) @@ -288,7 +288,7 @@ protected function getConfiguredModule($recConfig): Random */ public function testWillReturnEmptyForMinimumResultLimit() { - $recommend = $this->getConfiguredModule("Solr:10:mixed:retain:20:facet1:value1:facet2:value2"); + $recommend = $this->getConfiguredModule('Solr:10:mixed:retain:20:facet1:value1:facet2:value2'); $output = $recommend->getResults(); $this->assertEmpty($output); } @@ -300,9 +300,9 @@ public function testWillReturnEmptyForMinimumResultLimit() */ public function testWillReturnResults() { - $recommend = $this->getConfiguredModule("Solr:10:mixed:retain:0:facet1:value1:facet2:value2"); + $recommend = $this->getConfiguredModule('Solr:10:mixed:retain:0:facet1:value1:facet2:value2'); $output = $recommend->getResults(); - $this->assertEquals(["1", "2", "3", "4", "5"], $output); + $this->assertEquals(['1', '2', '3', '4', '5'], $output); } /** @@ -312,8 +312,8 @@ public function testWillReturnResults() */ public function testCanSetDisplayMode() { - $this->recommend->setConfig("Solr:10:mixed"); - $this->assertEquals("mixed", $this->recommend->getDisplayMode()); + $this->recommend->setConfig('Solr:10:mixed'); + $this->assertEquals('mixed', $this->recommend->getDisplayMode()); } /** diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonBestBetsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonBestBetsTest.php index 3d22f86b3af..4ef5ada0352 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonBestBetsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonBestBetsTest.php @@ -62,7 +62,7 @@ public function testGetResults(): void $results->expects($this->once())->method('getParams') ->will($this->returnValue($parms)); $parms->expects($this->once())->method('getSearchClassId') - ->will($this->returnValue("Summon")); + ->will($this->returnValue('Summon')); $obj->process($results); $results->expects($this->once())->method('getBestBets') ->will($this->returnValue(false)); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonDatabasesTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonDatabasesTest.php index bc5f3f8437c..65c6fbad74d 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonDatabasesTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonDatabasesTest.php @@ -62,7 +62,7 @@ public function testGetResults(): void $results->expects($this->once())->method('getParams') ->will($this->returnValue($parms)); $parms->expects($this->once())->method('getSearchClassId') - ->will($this->returnValue("Summon")); + ->will($this->returnValue('Summon')); $obj->process($results); $results->expects($this->once())->method('getDatabaseRecommendations') ->will($this->returnValue(false)); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonTopicsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonTopicsTest.php index 2ea52b0b215..88156f59dbd 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonTopicsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SummonTopicsTest.php @@ -62,7 +62,7 @@ public function testGetResults(): void $results->expects($this->once())->method('getParams') ->will($this->returnValue($parms)); $parms->expects($this->once())->method('getSearchClassId') - ->will($this->returnValue("Summon")); + ->will($this->returnValue('Summon')); $obj->process($results); $results->expects($this->once())->method('getTopicRecommendations') ->will($this->returnValue(false)); @@ -87,7 +87,7 @@ public function testInit(): void ->addMethods(['setMaxTopicRecommendations']) ->getMockForAbstractClass(); $parms->expects($this->once())->method('getSearchClassId') - ->will($this->returnValue("Summon")); + ->will($this->returnValue('Summon')); $parms->expects($this->once())->method('getOptions') ->will($this->returnValue($options)); $options->expects($this->once())->method('setMaxTopicRecommendations') diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SwitchTabTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SwitchTabTest.php index 36e6ee3b59f..4fd20fb4a1f 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SwitchTabTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SwitchTabTest.php @@ -53,48 +53,48 @@ public function tabConfigProvider(): array 'First tab selected' => [ [ [ - "id" => "A01", - "class" => "class01", - "label" => "label01", - "permission" => "permission01", - "selected" => true, - "url" => "http://newurl1", + 'id' => 'A01', + 'class' => 'class01', + 'label' => 'label01', + 'permission' => 'permission01', + 'selected' => true, + 'url' => 'http://newurl1', ], [ - "id" => "A02", - "class" => "class02", - "label" => "label02", - "permission" => "permission02", - "selected" => false, - "url" => "http://newurl2", + 'id' => 'A02', + 'class' => 'class02', + 'label' => 'label02', + 'permission' => 'permission02', + 'selected' => false, + 'url' => 'http://newurl2', ], ], [ - "id" => "A01", - "class" => "class01", - "label" => "label01", - "permission" => "permission01", - "selected" => true, - "url" => "http://newurl1", + 'id' => 'A01', + 'class' => 'class01', + 'label' => 'label01', + 'permission' => 'permission01', + 'selected' => true, + 'url' => 'http://newurl1', ], ], 'No tab selected' => [ [ [ - "id" => "A01", - "class" => "class01", - "label" => "label01", - "permission" => "permission01", - "selected" => false, - "url" => "http://newurl1", + 'id' => 'A01', + 'class' => 'class01', + 'label' => 'label01', + 'permission' => 'permission01', + 'selected' => false, + 'url' => 'http://newurl1', ], [ - "id" => "A02", - "class" => "class02", - "label" => "label02", - "permission" => "permission02", - "selected" => false, - "url" => "http://newurl2", + 'id' => 'A02', + 'class' => 'class02', + 'label' => 'label02', + 'permission' => 'permission02', + 'selected' => false, + 'url' => 'http://newurl2', ], ], null, @@ -129,30 +129,30 @@ public function inactiveTabConfigProvider(): array 'Test1' => [ [ [ - "id" => "A01", - "class" => "class01", - "label" => "label01", - "permission" => "permission01", - "selected" => true, - "url" => "http://newurl1", + 'id' => 'A01', + 'class' => 'class01', + 'label' => 'label01', + 'permission' => 'permission01', + 'selected' => true, + 'url' => 'http://newurl1', ], [ - "id" => "A02", - "class" => "class02", - "label" => "label02", - "permission" => "permission02", - "selected" => false, - "url" => "http://newurl2", + 'id' => 'A02', + 'class' => 'class02', + 'label' => 'label02', + 'permission' => 'permission02', + 'selected' => false, + 'url' => 'http://newurl2', ], ], [ [ - "id" => "A02", - "class" => "class02", - "label" => "label02", - "permission" => "permission02", - "selected" => false, - "url" => "http://newurl2", + 'id' => 'A02', + 'class' => 'class02', + 'label' => 'label02', + 'permission' => 'permission02', + 'selected' => false, + 'url' => 'http://newurl2', ], ], ], @@ -183,7 +183,7 @@ public function testGetInactiveTab(array $tabEnv, array $expectedResult): void public function testSetConfig(): void { $obj = new SwitchTab(); - $this->assertNull($obj->setConfig("")); + $this->assertNull($obj->setConfig('')); } /** diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SwitchTypeTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SwitchTypeTest.php index 664aaf87b87..075e9f656f9 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SwitchTypeTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SwitchTypeTest.php @@ -49,8 +49,8 @@ class SwitchTypeTest extends \PHPUnit\Framework\TestCase */ public function newHandlerNameProvider(): array { - return ['Test1' => ["foo:bar", "bar"], - 'Test2' => ["foo", "All Fields"], + return ['Test1' => ['foo:bar', 'bar'], + 'Test2' => ['foo', 'All Fields'], ]; } @@ -78,9 +78,9 @@ public function testGetNewHandlerName(string $settings, string $expectedResult): */ public function newHandlerProvider(): array { - return ['Test1' => ["foo:bar", "foo", false], - 'Test2' => ["", "foo", "AllFields"], - 'Test3' => ["foo:bar", "abc", "foo"], + return ['Test1' => ['foo:bar', 'foo', false], + 'Test2' => ['', 'foo', 'AllFields'], + 'Test3' => ['foo:bar', 'abc', 'foo'], ]; } @@ -122,7 +122,7 @@ public function testGetNewHandler(string $settings, string $searchHandler, $expe public function testGetResults(): void { $obj = new SwitchType(); - $obj->setConfig("foo"); + $obj->setConfig('foo'); $results = $this->getMockBuilder(\VuFind\Search\Base\Results::class) ->disableOriginalConstructor() ->getMock(); @@ -132,7 +132,7 @@ public function testGetResults(): void $results->expects($this->once())->method('getParams') ->will($this->returnValue($parms)); $parms->expects($this->once())->method('getSearchHandler') - ->will($this->returnValue("bar")); + ->will($this->returnValue('bar')); $obj->process($results); $this->assertSame($results, $obj->getResults()); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Record/FallbackLoader/SolrTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Record/FallbackLoader/SolrTest.php index fb0082f7007..d60eb65e0e0 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Record/FallbackLoader/SolrTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Record/FallbackLoader/SolrTest.php @@ -67,7 +67,7 @@ public function testEnabledLoader(): void ->will($this->returnValue($collection)); $checkCommand = function ($command) { return $command::class === \VuFindSearch\Command\SearchCommand::class - && $command->getTargetIdentifier() === "Solr" + && $command->getTargetIdentifier() === 'Solr' && $command->getArguments()[0]->getString() === 'previous_id_str_mv:"oldId"'; }; diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Record/FallbackLoader/SummonTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Record/FallbackLoader/SummonTest.php index 54711bc6694..ad32b1afa7a 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Record/FallbackLoader/SummonTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Record/FallbackLoader/SummonTest.php @@ -75,7 +75,7 @@ public function testLoader(): void ->will($this->returnValue($collection)); $checkCommand = function ($command) use ($expectedParams) { return $command::class === \VuFindSearch\Command\RetrieveCommand::class - && $command->getTargetIdentifier() === "Summon" + && $command->getTargetIdentifier() === 'Summon' && $command->getArguments()[0] === 'bar' && $command->getArguments()[1] == $expectedParams; }; diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Record/LoaderTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Record/LoaderTest.php index eed14fb1d42..94a8d95f80f 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Record/LoaderTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Record/LoaderTest.php @@ -67,7 +67,7 @@ public function testMissingRecord() ->will($this->returnValue($collection)); $service = $this->getMockBuilder(\VuFindSearch\Service::class) ->disableOriginalConstructor()->getMock(); - $arguments = ["test", new ParamBag()]; + $arguments = ['test', new ParamBag()]; $service->expects($this->once())->method('invoke') ->with($this->callback($this->getCommandChecker($arguments))) ->will($this->returnValue($commandObj)); @@ -91,7 +91,7 @@ public function testMissingRecordWithFallback() $service = $this->getMockBuilder(\VuFindSearch\Service::class) ->disableOriginalConstructor()->getMock(); $class = \VuFindSearch\Command\RetrieveCommand::class; - $arguments = ["test", new ParamBag()]; + $arguments = ['test', new ParamBag()]; $service->expects($this->once())->method('invoke') ->with( $this->callback( @@ -119,7 +119,7 @@ public function testToleratedMissingRecord() ->will($this->returnValue($collection)); $service = $this->getMockBuilder(\VuFindSearch\Service::class) ->disableOriginalConstructor()->getMock(); - $arguments = ["test", new ParamBag()]; + $arguments = ['test', new ParamBag()]; $service->expects($this->once())->method('invoke') ->with($this->callback($this->getCommandChecker($arguments))) ->will($this->returnValue($commandObj)); @@ -151,7 +151,7 @@ public function testSingleRecord() ->will($this->returnValue($collection)); $service = $this->getMockBuilder(\VuFindSearch\Service::class) ->disableOriginalConstructor()->getMock(); - $arguments = ["test", new ParamBag()]; + $arguments = ['test', new ParamBag()]; $service->expects($this->once())->method('invoke') ->with($this->callback($this->getCommandChecker($arguments))) ->will($this->returnValue($commandObj)); @@ -179,7 +179,7 @@ public function testSingleRecordWithBackendParameters() ->will($this->returnValue($collection)); $service = $this->getMockBuilder(\VuFindSearch\Service::class) ->disableOriginalConstructor()->getMock(); - $arguments = ["test", $params]; + $arguments = ['test', $params]; $service->expects($this->once())->method('invoke') ->with($this->callback($this->getCommandChecker($arguments))) ->will($this->returnValue($commandObj)); @@ -226,9 +226,9 @@ public function testBatchLoad() ->disableOriginalConstructor()->getMock(); $class = \VuFindSearch\Command\RetrieveBatchCommand::class; - $arguments1 = [["test1", "test2"], $solrParams]; - $arguments2 = [["test3"], new ParamBag()]; - $arguments3 = [["test4"], $worldCatParams]; + $arguments1 = [['test1', 'test2'], $solrParams]; + $arguments2 = [['test3'], new ParamBag()]; + $arguments3 = [['test4'], $worldCatParams]; $service->expects($this->exactly(3))->method('invoke') ->withConsecutive( @@ -279,8 +279,8 @@ public function testBatchLoadWithFallback() $service = $this->getMockBuilder(\VuFindSearch\Service::class) ->disableOriginalConstructor()->getMock(); - $arguments1 = [["test1", "test2"], $solrParams]; - $arguments2 = [["test3"], new ParamBag()]; + $arguments1 = [['test1', 'test2'], $solrParams]; + $arguments2 = [['test3'], new ParamBag()]; $class = \VuFindSearch\Command\RetrieveBatchCommand::class; $service->expects($this->exactly(2))->method('invoke') ->withConsecutive( diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php index ce621489a77..f9802b55762 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php @@ -100,7 +100,7 @@ public function testGetGeoLocation() */ public function testGetSchemaOrgFormats() { - $formats = "Book"; + $formats = 'Book'; $this->assertEquals($formats, $this->getDriver()->getSchemaOrgFormats()); } @@ -112,7 +112,7 @@ public function testGetSchemaOrgFormats() public function testGetSortTitle() { $this->assertEquals( - "congiura dei principi napoletani 1701 :(prima e seconda stesura)", + 'congiura dei principi napoletani 1701 :(prima e seconda stesura)', $this->getDriver()->getSortTitle() ); } @@ -124,7 +124,7 @@ public function testGetSortTitle() */ public function testGetContainerReference() { - $this->assertEquals("", $this->getDriver()->getContainerReference()); + $this->assertEquals('', $this->getDriver()->getContainerReference()); } /** @@ -154,7 +154,7 @@ public function testGetThumbnail() */ public function testGetURLs() { - $testURL = [['url' => "http://fictional.com/sample/url"]]; + $testURL = [['url' => 'http://fictional.com/sample/url']]; $this->assertEquals($testURL, $this->getDriver()->getURLs()); } @@ -205,7 +205,7 @@ public function testGetSecondaryAuthorsRoles() */ public function testGetSecondaryAuthors() { - $author2 = ["Pandolfi, Claudia."]; + $author2 = ['Pandolfi, Claudia.']; $this->assertEquals($author2, $this->getDriver()->getSecondaryAuthors()); } @@ -216,7 +216,7 @@ public function testGetSecondaryAuthors() */ public function testGetPublicationDetails() { - $pubDetails = [new PublicationDetails("", "Centro di Studi Vichiani,", "1992")]; + $pubDetails = [new PublicationDetails('', 'Centro di Studi Vichiani,', '1992')]; $this->assertEquals($pubDetails, $this->getDriver()->getPublicationDetails()); } @@ -237,7 +237,7 @@ public function testGetPrimaryAuthorsRoles() */ public function testGetPrimaryAuthor() { - $this->assertEquals("Vico, Giambattista, 1668-1744.", $this->getDriver()->getPrimaryAuthor()); + $this->assertEquals('Vico, Giambattista, 1668-1744.', $this->getDriver()->getPrimaryAuthor()); } /** @@ -257,7 +257,7 @@ public function testGetPreviousTitles() */ public function testGetPhysicalDescriptions() { - $physical = ["296 p. : ill. ; 24 cm."]; + $physical = ['296 p. : ill. ; 24 cm.']; $this->assertEquals($physical, $this->getDriver()->getPhysicalDescriptions()); } @@ -268,14 +268,14 @@ public function testGetPhysicalDescriptions() */ public function testGetCoinsOpenUrl() { - $coinsOpenUrl = "url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3A" - . "UTF-8&rfr_id=info%3Asid%2Fvufind.svn.sourceforge.net%3Agenerator&rft.title=La+co" - . "ngiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F&rft.da" - . "te=1992&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitl" - . "e=La+congiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F" - . "&rft.series=Vico%2C+Giambattista%2C+1668-1744.+Works.+1982+%3B&rft.au=Vico%2C+Gi" - . "ambattista%2C+1668-1744.&rft.pub=Centro+di+Studi+Vichiani%2C&rft.edition=Fiction" - . "al+edition.&rft.isbn=8820737493"; + $coinsOpenUrl = 'url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3A' + . 'UTF-8&rfr_id=info%3Asid%2Fvufind.svn.sourceforge.net%3Agenerator&rft.title=La+co' + . 'ngiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F&rft.da' + . 'te=1992&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitl' + . 'e=La+congiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F' + . '&rft.series=Vico%2C+Giambattista%2C+1668-1744.+Works.+1982+%3B&rft.au=Vico%2C+Gi' + . 'ambattista%2C+1668-1744.&rft.pub=Centro+di+Studi+Vichiani%2C&rft.edition=Fiction' + . 'al+edition.&rft.isbn=8820737493'; $this->assertEquals($coinsOpenUrl, $this->getDriver()->getCoinsOpenUrl()); } @@ -286,34 +286,34 @@ public function testGetCoinsOpenUrl() */ public function testGetOpenUrl() { - $openUrl = "url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3A" - . "UTF-8&rfr_id=info%3Asid%2Fvufind.svn.sourceforge.net%3Agenerator&rft.title=La+co" - . "ngiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F&rft.da" - . "te=1992&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitl" - . "e=La+congiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F" - . "&rft.series=Vico%2C+Giambattista%2C+1668-1744.+Works.+1982+%3B&rft.au=Vico%2C+Gi" - . "ambattista%2C+1668-1744.&rft.pub=Centro+di+Studi+Vichiani%2C&rft.edition=Fiction" - . "al+edition.&rft.isbn=8820737493&rft_id=info%3Adoi%2Fxxx&rft_id=pmid%3Ayyy"; + $openUrl = 'url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3A' + . 'UTF-8&rfr_id=info%3Asid%2Fvufind.svn.sourceforge.net%3Agenerator&rft.title=La+co' + . 'ngiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F&rft.da' + . 'te=1992&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitl' + . 'e=La+congiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F' + . '&rft.series=Vico%2C+Giambattista%2C+1668-1744.+Works.+1982+%3B&rft.au=Vico%2C+Gi' + . 'ambattista%2C+1668-1744.&rft.pub=Centro+di+Studi+Vichiani%2C&rft.edition=Fiction' + . 'al+edition.&rft.isbn=8820737493&rft_id=info%3Adoi%2Fxxx&rft_id=pmid%3Ayyy'; // Parameters returned by getBookOpenUrlParams with rft_id added $openUrlParams = [ - "url_ver" => "Z39.88-2004", - "ctx_ver" => "Z39.88-2004", - "ctx_enc" => "info:ofi/enc:UTF-8", - "rfr_id" => "info:sid/vufind.svn.sourceforge.net:generator", - "rft.title" => "La congiura dei Principi Napoletani 1701 : (prima e seconda stesura) /", - "rft.date" => "1992", - "rft_val_fmt" => "info:ofi/fmt:kev:mtx:book", - "rft.genre" => "book", - "rft.btitle" => "La congiura dei Principi Napoletani 1701 : (prima e seconda stesura) /", - "rft.series" => "Vico, Giambattista, 1668-1744. Works. 1982 ;", - "rft.au" => "Vico, Giambattista, 1668-1744.", - "rft.pub" => "Centro di Studi Vichiani,", - "rft.edition" => "Fictional edition.", - "rft.isbn" => "8820737493", - "rft_id" => [ - "info:doi/xxx", - "pmid:yyy", + 'url_ver' => 'Z39.88-2004', + 'ctx_ver' => 'Z39.88-2004', + 'ctx_enc' => 'info:ofi/enc:UTF-8', + 'rfr_id' => 'info:sid/vufind.svn.sourceforge.net:generator', + 'rft.title' => 'La congiura dei Principi Napoletani 1701 : (prima e seconda stesura) /', + 'rft.date' => '1992', + 'rft_val_fmt' => 'info:ofi/fmt:kev:mtx:book', + 'rft.genre' => 'book', + 'rft.btitle' => 'La congiura dei Principi Napoletani 1701 : (prima e seconda stesura) /', + 'rft.series' => 'Vico, Giambattista, 1668-1744. Works. 1982 ;', + 'rft.au' => 'Vico, Giambattista, 1668-1744.', + 'rft.pub' => 'Centro di Studi Vichiani,', + 'rft.edition' => 'Fictional edition.', + 'rft.isbn' => '8820737493', + 'rft_id' => [ + 'info:doi/xxx', + 'pmid:yyy', ], ]; @@ -347,7 +347,7 @@ public function testGetNewerTitles() */ public function testGetLCCN() { - $this->assertEquals("", $this->getDriver()->getLCCN()); + $this->assertEquals('', $this->getDriver()->getLCCN()); } /** @@ -357,7 +357,7 @@ public function testGetLCCN() */ public function testGetInstitutions() { - $institution = ["MyInstitution"]; + $institution = ['MyInstitution']; $this->assertEquals($institution, $this->getDriver()->getInstitutions()); } @@ -368,7 +368,7 @@ public function testGetInstitutions() */ public function testGetLastIndexed() { - $this->assertEquals("", $this->getDriver()->getLastIndexed()); + $this->assertEquals('', $this->getDriver()->getLastIndexed()); } /** @@ -378,7 +378,7 @@ public function testGetLastIndexed() */ public function testGetPrimaryAuthorsWithHighlighting() { - $primAuthHighlight = ["Vico, Giambattista, 1668-1744."]; + $primAuthHighlight = ['Vico, Giambattista, 1668-1744.']; $this->assertEquals($primAuthHighlight, $this->getDriver()->getPrimaryAuthorsWithHighlighting()); } @@ -430,7 +430,7 @@ public function testGetCleanDOI() */ public function testGetCallNumber() { - $this->assertEquals("", $this->getDriver()->getCallNumber()); + $this->assertEquals('', $this->getDriver()->getCallNumber()); } /** @@ -440,7 +440,7 @@ public function testGetCallNumber() */ public function testGetBreadcrumb() { - $breadcrumb = "La congiura dei Principi Napoletani 1701 :"; + $breadcrumb = 'La congiura dei Principi Napoletani 1701 :'; $this->assertEquals($breadcrumb, $this->getDriver()->getBreadcrumb()); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/SolrDefaultTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/SolrDefaultTest.php index b6df3a88d58..fc6aaafa330 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/SolrDefaultTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/SolrDefaultTest.php @@ -184,7 +184,7 @@ public function testDublinCore() */ public function testGetContainerRecordID() { - $this->assertEquals("", $this->getDriver()->getContainerRecordID()); + $this->assertEquals('', $this->getDriver()->getContainerRecordID()); } /** @@ -204,7 +204,7 @@ public function testGetChildRecordCount() */ public function testGetHighlightedTitle() { - $this->assertEquals("", $this->getDriver()->getHighlightedTitle()); + $this->assertEquals('', $this->getDriver()->getHighlightedTitle()); } /** diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/CollectionHierarchyTreeTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/CollectionHierarchyTreeTest.php index b9af2c0b8ca..758ec0c3550 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/CollectionHierarchyTreeTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/CollectionHierarchyTreeTest.php @@ -60,12 +60,12 @@ public function testGetActiveRecord(): void ->getMock(); $request->expects($this->once())->method('getQuery') ->with($this->equalTo('recordID'), $this->equalTo(false)) - ->will($this->returnValue("foo")); + ->will($this->returnValue('foo')); $recordDriver = $this->getMockBuilder(\VuFind\RecordDriver\AbstractBase::class) ->disableOriginalConstructor() ->getMock(); $load->expects($this->once())->method('load') - ->with($this->equalTo("foo")) + ->with($this->equalTo('foo')) ->will($this->returnValue($recordDriver)); $obj = new CollectionHierarchyTree($conf, $load); $obj->setRequest($request); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/ComponentPartsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/ComponentPartsTest.php index 5b214484f82..848f7dbbec4 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/ComponentPartsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/ComponentPartsTest.php @@ -118,9 +118,9 @@ public function testGetResults(): void ->disableOriginalConstructor() ->getMock(); $recordDriver->expects($this->any())->method('getUniqueID') - ->will($this->returnValue("foo")); + ->will($this->returnValue('foo')); $recordDriver->expects($this->any())->method('getSourceIdentifier') - ->will($this->returnValue("bar")); + ->will($this->returnValue('bar')); $commandObj = $this->getMockBuilder(\VuFindSearch\Command\AbstractBase::class) ->disableOriginalConstructor() ->getMock(); @@ -128,13 +128,13 @@ public function testGetResults(): void ->will($this->returnValue($rci)); $checkCommand = function ($command) { return $command::class === \VuFindSearch\Command\SearchCommand::class - && $command->getTargetIdentifier() === "bar" + && $command->getTargetIdentifier() === 'bar' && $command->getArguments()[0]->getAllTerms() === 'hierarchy_parent_id:"foo"' && $command->getArguments()[1] === 0 && $command->getArguments()[2] === 101 && $command->getArguments()[3]->getArrayCopy() === [ - "hl" => ["false"], - "sort" => ["hierarchy_sequence ASC,title ASC"], + 'hl' => ['false'], + 'sort' => ['hierarchy_sequence ASC,title ASC'], ]; }; $service->expects($this->once())->method('invoke') diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/HoldingsWorldCatTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/HoldingsWorldCatTest.php index 85a32dc8412..c496afde1cc 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/HoldingsWorldCatTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/HoldingsWorldCatTest.php @@ -64,7 +64,7 @@ public function testGetDescription(): void */ public function isActiveProvider(): array { - return ['Enabed' => ["foo", true], 'Not Enabled' => ["", false]]; + return ['Enabed' => ['foo', true], 'Not Enabled' => ['', false]]; } /** @@ -107,7 +107,7 @@ public function testGetHoldings(): void ->getMock(); $recordDriver->expects($this->once())->method('tryMethod') ->with($this->equalTo('getCleanOCLCNum')) - ->will($this->returnValue("bar")); + ->will($this->returnValue('bar')); $obj->setRecordDriver($recordDriver); $commandObj = $this->getMockBuilder(\VuFindSearch\Command\AbstractBase::class) ->disableOriginalConstructor() @@ -116,8 +116,8 @@ public function testGetHoldings(): void ->will($this->returnValue(true)); $checkCommand = function ($command) { return $command::class === \VuFindSearch\Backend\WorldCat\Command\GetHoldingsCommand::class - && $command->getArguments()[0] === "bar" - && $command->getTargetIdentifier() === "WorldCat"; + && $command->getArguments()[0] === 'bar' + && $command->getTargetIdentifier() === 'WorldCat'; }; $searchObj->expects($this->any())->method('invoke') ->with($this->callback($checkCommand)) diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/MapTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/MapTest.php index 35bb01645db..cb97514a96e 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/MapTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/MapTest.php @@ -51,8 +51,8 @@ public function getMap() { $mapTabDisplay = true; $basemapOptions = [ - 'basemap_url' => "www.foo.com", - 'basemap_attribution' => "bar", + 'basemap_url' => 'www.foo.com', + 'basemap_attribution' => 'bar', ]; $mapTabOptions = [ 'displayCoords' => true, @@ -107,7 +107,7 @@ public function testGetMapGraticule(): void public function testGetBasemap(): void { $obj = $this->getMap(); - $expected = ["www.foo.com","bar"]; + $expected = ['www.foo.com','bar']; $this->assertSame($expected, $obj->getBasemap()); } @@ -124,7 +124,7 @@ public function testIsActive(): void ->getMock(); $recordDriver->expects($this->exactly(2))->method('tryMethod') ->with($this->equalTo('getGeoLocation')) - ->willReturnOnConsecutiveCalls("555", null); + ->willReturnOnConsecutiveCalls('555', null); $obj->setRecordDriver($recordDriver); $this->assertTrue($obj->isActive()); $this->assertFalse($obj->isActive()); @@ -138,7 +138,7 @@ public function testIsActive(): void public function testGetDisplayCoords(): void { $obj = $this->getMap(); - $coordinates = ["00 00 56 56", "45 56 87 89"]; + $coordinates = ['00 00 56 56', '45 56 87 89']; $recordDriver = $this->getMockBuilder(\VuFind\RecordDriver\SolrDefault::class) ->disableOriginalConstructor() ->getMock(); @@ -146,7 +146,7 @@ public function testGetDisplayCoords(): void ->with($this->equalTo('getDisplayCoordinates')) ->will($this->returnValue($coordinates)); $obj->setRecordDriver($recordDriver); - $value = ["56 00", "89 87 45 56"]; + $value = ['56 00', '89 87 45 56']; $this->assertSame($value, $obj->getDisplayCoords()); } @@ -158,7 +158,7 @@ public function testGetDisplayCoords(): void public function testGetGeoLocationCoords(): void { $obj = $this->getMap(); - $coordinates = ["ENVELOPE(25.8,43.9,5.0,4.6)"]; + $coordinates = ['ENVELOPE(25.8,43.9,5.0,4.6)']; $recordDriver = $this->getMockBuilder(\VuFind\RecordDriver\SolrDefault::class) ->disableOriginalConstructor() ->getMock(); @@ -178,17 +178,17 @@ public function testGetGeoLocationCoords(): void public function testGetMapTabData(): void { $obj = $this->getMap(); - $coordinates = ["ENVELOPE(25.8,43.9,5.0,4.6)"]; - $displayCoord = ["45 56 87 89"]; + $coordinates = ['ENVELOPE(25.8,43.9,5.0,4.6)']; + $displayCoord = ['45 56 87 89']; $recordDriver = $this->getMockBuilder(\VuFind\RecordDriver\SolrDefault::class) ->disableOriginalConstructor() ->getMock(); $recordDriver->expects($this->exactly(2))->method('tryMethod') - ->withConsecutive(["getGeoLocation"], ["getDisplayCoordinates"]) + ->withConsecutive(['getGeoLocation'], ['getDisplayCoordinates']) ->willReturnOnConsecutiveCalls($coordinates, $displayCoord); $obj->setRecordDriver($recordDriver); - $expected = [[25.8,4.6,43.9,5.0,'',"89 87 45 56"]]; + $expected = [[25.8,4.6,43.9,5.0,'','89 87 45 56']]; $this->assertSame($expected, $obj->getMapTabData()); } } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/SimilarItemsCarouselTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/SimilarItemsCarouselTest.php index 9550788e05b..32cffcc95ef 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/SimilarItemsCarouselTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/SimilarItemsCarouselTest.php @@ -75,9 +75,9 @@ public function testGetResults(): void ->disableOriginalConstructor() ->getMock(); $recordDriver->expects($this->once())->method('getSourceIdentifier') - ->will($this->returnValue("foo")); + ->will($this->returnValue('foo')); $recordDriver->expects($this->once())->method('getUniqueId') - ->will($this->returnValue("bar")); + ->will($this->returnValue('bar')); $obj->setRecordDriver($recordDriver); $commandObj = $this->getMockBuilder(\VuFindSearch\Command\AbstractBase::class) @@ -88,8 +88,8 @@ public function testGetResults(): void $checkCommand = function ($command) { return $command::class === \VuFindSearch\Command\SimilarCommand::class - && $command->getTargetIdentifier() === "foo" - && $command->getArguments()[0] === "bar" + && $command->getTargetIdentifier() === 'foo' + && $command->getArguments()[0] === 'bar' && $command->getArguments()[1]->getArrayCopy() === ['rows' => [40]]; }; $service->expects($this->once())->method('invoke') diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/TOCTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/TOCTest.php index d297dea534d..849fda031c3 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/TOCTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/TOCTest.php @@ -61,7 +61,7 @@ public function testGetDescription(): void */ public function isActiveProvider(): array { - return ['Enabled' => ["foo", true], 'Not Enabled' => ["", false]]; + return ['Enabled' => ['foo', true], 'Not Enabled' => ['', false]]; } /** @@ -81,7 +81,7 @@ public function testIsActive(string $toc, bool $expectedResult): void ->getMock(); $recordDriver->expects($this->any())->method('tryMethod') ->withConsecutive([$this->equalTo('getTOC')], [$this->equalTo('getCleanISBN')]) - ->willReturnOnConsecutiveCalls($this->returnValue($toc), $this->returnValue("bar")); + ->willReturnOnConsecutiveCalls($this->returnValue($toc), $this->returnValue('bar')); $obj = new TOC(); $obj->setRecordDriver($recordDriver); $this->assertSame($expectedResult, $obj->isActive()); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/UserCommentsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/UserCommentsTest.php index dca331763a9..c209a2be083 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/UserCommentsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/UserCommentsTest.php @@ -50,7 +50,7 @@ class UserCommentsTest extends \PHPUnit\Framework\TestCase public function testGetDescription(): void { $obj = new UserComments(); - $this->assertSame("Comments", $obj->getDescription()); + $this->assertSame('Comments', $obj->getDescription()); } /** diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/VersionsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/VersionsTest.php index fb1119f8ede..93e13c33a91 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/VersionsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/VersionsTest.php @@ -65,7 +65,7 @@ public function testGetDescription(): void ->getMock(); $translator->expects($this->any())->method('translate') ->with($this->equalTo('other_versions_title'), $this->equalTo('default')) - ->will($this->returnValue("Count:%%count%%")); + ->will($this->returnValue('Count:%%count%%')); $obj->setTranslator($translator); $obj->getDescription(); $this->assertEquals("Count:$count", $obj->getDescription()); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Related/SimilarTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Related/SimilarTest.php index cb7531c6483..5252acb239e 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Related/SimilarTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Related/SimilarTest.php @@ -65,8 +65,8 @@ public function testGetResults() ->will($this->returnValue(['fakeresponse'])); $checkCommand = function ($command) { return $command::class === \VuFindSearch\Command\SimilarCommand::class - && $command->getTargetIdentifier() === "Solr" - && $command->getArguments()[0] === "fakeid"; + && $command->getTargetIdentifier() === 'Solr' + && $command->getArguments()[0] === 'fakeid'; }; $service = $this->getMockBuilder(\VuFindSearch\Service::class) ->getMock(); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Related/WorldCatSimilarTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Related/WorldCatSimilarTest.php index ee1a34afda5..b0343d7fc0f 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Related/WorldCatSimilarTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Related/WorldCatSimilarTest.php @@ -101,7 +101,7 @@ public function testGetResults() . 'srw.su all "fakesh1a fakesh1b" or srw.su all "fakesh2" or ' . 'srw.ti any "faketitle") not srw.no all "fakeid"'; return $command::class === \VuFindSearch\Command\SearchCommand::class - && $command->getTargetIdentifier() === "WorldCat" + && $command->getTargetIdentifier() === 'WorldCat' && $command->getArguments()[0]->getAllTerms() === $expectedTerms && $command->getArguments()[1] === 0 && $command->getArguments()[2] === 5; diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Reserves/CsvReaderTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Reserves/CsvReaderTest.php index cb755e9292b..9d1a4216de8 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Reserves/CsvReaderTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Reserves/CsvReaderTest.php @@ -131,7 +131,7 @@ public function testGetErrors() { $reader = $this->getReader(); $reader->getReserves(); - $fixture = $this->getFixtureDir() . "reserves/reserves.csv"; + $fixture = $this->getFixtureDir() . 'reserves/reserves.csv'; $errors = "Skipping empty/missing Bib ID: $fixture, line 3\nSkipping incomplete row: $fixture, line 5\n"; $this->assertEquals($errors, $reader->getErrors()); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/AlmaTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/AlmaTest.php index 3d28a8cdec4..16d35cbea72 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/AlmaTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/AlmaTest.php @@ -65,8 +65,8 @@ class AlmaTest extends \PHPUnit\Framework\TestCase 'url' => "http://na01.alma.exlibrisgroup.com/view/uresolver/TR_INTEGRATION_INST/openurl' . '?debug=true&u.ignore_date_coverage=true&rft.mms_id=9942811800561' . '&rfr_id=info:sid/primo.exlibrisgroup.com&svc_dat=CTO", - 'rfr_id' => "vufind.svn.sourceforge.net", - 'resolver' => "alma", + 'rfr_id' => 'vufind.svn.sourceforge.net', + 'resolver' => 'alma', 'window_settings' => "toolbar=no,location=no,directories=no,buttons=no,status=no,menubar=no,' . 'scrollbars=yes,resizable=yes,width=550,height=600", 'show_in_results' => false, @@ -191,7 +191,7 @@ protected function getExpectedParsedLinks($filterSet = false): array public function testParseLinks() { $conn = $this->createConnector('alma.xml'); - $openUrl = "url_ver=Z39.88-2004&ctx_ver=Z39.88-2004"; + $openUrl = 'url_ver=Z39.88-2004&ctx_ver=Z39.88-2004'; $result = $conn->parseLinks($conn->fetchLinks($openUrl)); $this->assertEquals($this->getExpectedParsedLinks(), $result); } @@ -204,7 +204,7 @@ public function testParseLinks() public function testParseLinksWithoutIgnoredFiltering() { $conn = $this->createConnector('alma.xml', ['ignoredFilterReasons' => '']); - $openUrl = "url_ver=Z39.88-2004&ctx_ver=Z39.88-2004"; + $openUrl = 'url_ver=Z39.88-2004&ctx_ver=Z39.88-2004'; $result = $conn->parseLinks($conn->fetchLinks($openUrl)); $this->assertEquals($this->getExpectedParsedLinks(true), $result); } @@ -228,7 +228,7 @@ protected function createConnector($fixture = null, $options = []) ); $adapter->setResponse($responseObj); } - $_SERVER['REMOTE_ADDR'] = "127.0.0.1"; + $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $client = new \Laminas\Http\Client(); $client->setAdapter($adapter); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/JopTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/JopTest.php index 6765da5d5c0..b6078b5745e 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/JopTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/JopTest.php @@ -56,11 +56,11 @@ class JopTest extends \PHPUnit\Framework\TestCase */ protected $openUrlConfig = [ 'OpenURL' => [ - 'url' => "http://services.d-nb.de/fize-service/gvr/full.xml", - 'rfr_id' => "www.ub.uni-leipzig.de", - 'resolver' => "jop", - 'window_settings' => "toolbar=no,location=no,directories=no,buttons=no,status=no," - . "menubar=no,scrollbars=yes,resizable=yes,width=550,height=600", + 'url' => 'http://services.d-nb.de/fize-service/gvr/full.xml', + 'rfr_id' => 'www.ub.uni-leipzig.de', + 'resolver' => 'jop', + 'window_settings' => 'toolbar=no,location=no,directories=no,buttons=no,status=no,' + . 'menubar=no,scrollbars=yes,resizable=yes,width=550,height=600', 'show_in_results' => false, 'show_in_record' => false, 'show_in_holdings' => true, diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php index 5b20b15e55f..f0fa3568b29 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php @@ -56,9 +56,9 @@ class RediTest extends \PHPUnit\Framework\TestCase */ protected $openUrlConfig = [ 'OpenURL' => [ - 'url' => "http://www.redi-bw.de/links/ubl", - 'rfr_id' => "www.ub.uni-leipzig.de", - 'resolver' => "redi", + 'url' => 'http://www.redi-bw.de/links/ubl', + 'rfr_id' => 'www.ub.uni-leipzig.de', + 'resolver' => 'redi', 'window_settings' => "toolbar=no,location=no,directories=no,buttons=no,status=no,menubar=no,' . 'scrollbars=yes,resizable=yes,width=550,height=600", 'show_in_results' => false, @@ -82,32 +82,32 @@ public function testParseLinks() $testResult = [ 0 => [ - 'title' => "DOI:10.1007/s11606-014-2915-9", + 'title' => 'DOI:10.1007/s11606-014-2915-9', 'href' => 'http://www-fr.redi-bw.de/links/?rl_site=ubl&rl_action=link&rl_link_target=citation' . '&rl_link_name=doi' . '&rl_citation=9443914d0e261c0c1f6a3fd8151213c1d4cec05f5d3053097da6fa5597bbb9d7', 'access' => 'unknown', 'coverage' => null, - 'service_type' => "getDOI", + 'service_type' => 'getDOI', ], 1 => [ - 'title' => "Zum Volltext (via SpringerLink)", + 'title' => 'Zum Volltext (via SpringerLink)', 'href' => 'http://www-fr.redi-bw.de/links/?rl_site=ubl&rl_action=link&rl_link_target=ezb' . '&rl_link_name=0.article' . '&rl_citation=9443914d0e261c0c1f6a3fd8151213c1d4cec05f5d3053097da6fa5597bbb9d7', 'access' => 'limited', - 'coverage' => "", - 'service_type' => "getFullTxt", + 'coverage' => '', + 'service_type' => 'getFullTxt', ], 2 => [ - 'title' => "Zur Zeitschriftenhomepage* (via www.ncbi.nlm.nih.gov)", + 'title' => 'Zur Zeitschriftenhomepage* (via www.ncbi.nlm.nih.gov)', 'href' => 'http://www-fr.redi-bw.de/links/?rl_site=ubl&rl_action=link&rl_link_target=ezb' . '&rl_link_name=1.article' . '&rl_citation=9443914d0e261c0c1f6a3fd8151213c1d4cec05f5d3053097da6fa5597bbb9d7', 'access' => 'open', - 'coverage' => "*Es konnte nicht zuverlässig festgestellt werden, ob der gesuchte Aufsatz " - . "in den Zeitraum fällt, für den bei diesem Anbieter der Volltext verfügbar ist.", - 'service_type' => "getFullTxt", + 'coverage' => '*Es konnte nicht zuverlässig festgestellt werden, ob der gesuchte Aufsatz ' + . 'in den Zeitraum fällt, für den bei diesem Anbieter der Volltext verfügbar ist.', + 'service_type' => 'getFullTxt', ], ]; diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionDeniedManagerTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionDeniedManagerTest.php index 313c31e96ae..573fe167943 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionDeniedManagerTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionDeniedManagerTest.php @@ -49,25 +49,25 @@ class PermissionDeniedManagerTest extends \PHPUnit\Framework\TestCase */ protected $permissionDeniedConfig = [ 'permissionDeniedTemplate' => [ - 'deniedTemplateBehavior' => "showTemplate:record/displayLogicTest:param1=noValue", - 'deniedControllerBehavior' => "showTemplate:record/ActionTest:param1=noValue", + 'deniedTemplateBehavior' => 'showTemplate:record/displayLogicTest:param1=noValue', + 'deniedControllerBehavior' => 'showTemplate:record/ActionTest:param1=noValue', ], 'permissionDeniedTemplateNoParams' => [ - 'deniedTemplateBehavior' => "showTemplate:record/displayLogicTest", - 'deniedControllerBehavior' => "showTemplate:record/ActionTest", + 'deniedTemplateBehavior' => 'showTemplate:record/displayLogicTest', + 'deniedControllerBehavior' => 'showTemplate:record/ActionTest', ], 'permissionDeniedMessage' => [ - 'deniedTemplateBehavior' => "showMessage:dl_translatable_test", - 'deniedControllerBehavior' => "showTemplate:action_translatable_test", + 'deniedTemplateBehavior' => 'showMessage:dl_translatable_test', + 'deniedControllerBehavior' => 'showTemplate:action_translatable_test', ], 'permissionDeniedLogin' => [ - 'deniedControllerBehavior' => "promptLogin", + 'deniedControllerBehavior' => 'promptLogin', ], 'permissionDeniedException' => [ - 'deniedControllerBehavior' => "exception:ForbiddenException:exception_message", + 'deniedControllerBehavior' => 'exception:ForbiddenException:exception_message', ], 'permissionDeniedNonExistentException' => [ - 'deniedControllerBehavior' => "exception:NonExistentException:exception_message", + 'deniedControllerBehavior' => 'exception:NonExistentException:exception_message', ], 'permissionDeniedNothing' => [ ], diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionManagerTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionManagerTest.php index d0132aaeee5..9cc7069bce2 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionManagerTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionManagerTest.php @@ -49,10 +49,10 @@ class PermissionManagerTest extends \PHPUnit\Framework\TestCase */ protected $permissionConfig = [ 'permission.all' => [ - 'permission' => "everyone", + 'permission' => 'everyone', ], 'permission.nobody' => [ - 'permission' => "nobody", + 'permission' => 'nobody', ], 'permission.empty' => [ ], diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionProvider/UserTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionProvider/UserTest.php index 356dfd4ea96..73c42a71872 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionProvider/UserTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Role/PermissionProvider/UserTest.php @@ -85,7 +85,7 @@ public function testGetPermissions() $this->check( 'testuser2', - ["college .*Freiburg"], + ['college .*Freiburg'], [] ); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/CustomFilterListenerTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/CustomFilterListenerTest.php index 07de8ac31fe..c006d8d9f54 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/CustomFilterListenerTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/CustomFilterListenerTest.php @@ -104,7 +104,7 @@ public function testAttach(): void public function testRemapping(): void { $normal = [ - 'vufind:"normal"' => "field1:normal OR field2:alsoNormal", + 'vufind:"normal"' => 'field1:normal OR field2:alsoNormal', ]; $listener = $this->getListener($normal); $params = new ParamBag(['fq' => ['foo:"bar"', 'vufind:"normal"']]); @@ -112,7 +112,7 @@ public function testRemapping(): void $event = new Event(null, null, compact('command')); $listener->onSearchPre($event); $this->assertEquals( - ['foo:"bar"', "field1:normal OR field2:alsoNormal"], + ['foo:"bar"', 'field1:normal OR field2:alsoNormal'], $params->get('fq') ); } @@ -125,7 +125,7 @@ public function testRemapping(): void public function testMismatchedBackendIsIgnored(): void { $normal = [ - 'vufind:"normal"' => "field1:normal OR field2:alsoNormal", + 'vufind:"normal"' => 'field1:normal OR field2:alsoNormal', ]; $listener = $this->getListener($normal); $params = new ParamBag(['fq' => ['foo:"bar"', 'vufind:"normal"']]); @@ -146,7 +146,7 @@ public function testMismatchedBackendIsIgnored(): void public function testWrongContextIsIgnored(): void { $normal = [ - 'vufind:"normal"' => "field1:normal OR field2:alsoNormal", + 'vufind:"normal"' => 'field1:normal OR field2:alsoNormal', ]; $listener = $this->getListener($normal); $params = new ParamBag(['fq' => ['foo:"bar"', 'vufind:"normal"']]); @@ -176,7 +176,7 @@ public function testMissingInvertedFilterAddsContent(): void $event = new Event(null, null, compact('command')); $listener->onSearchPre($event); $this->assertEquals( - ['foo:"bar"', "field3:invertedFilter"], + ['foo:"bar"', 'field3:invertedFilter'], $params->get('fq') ); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/FilterFieldConversionListenerTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/FilterFieldConversionListenerTest.php index bb3a53e7c1d..35510b52675 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/FilterFieldConversionListenerTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/FilterFieldConversionListenerTest.php @@ -78,7 +78,7 @@ public function testFilterTranslation() 'foo:value', 'baz:"foo:value"', 'foofoo:value', - "foo\\:value", + 'foo\\:value', 'baz:value OR foo:value', '(foo:value)', ], @@ -103,7 +103,7 @@ public function testFilterTranslation() 'bar:value', 'boo:"foo:value"', 'foofoo:value', - "foo\\:value", + 'foo\\:value', 'boo:value OR bar:value', '(bar:value)', ]; diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/ParamsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/ParamsTest.php index c4e1f0a98fc..9a9e13731e7 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/ParamsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/ParamsTest.php @@ -166,12 +166,12 @@ public function testCheckboxVisibility() */ public function sortValueProvider(): array { - return ['Test1' => ["year", "id", "publishDateSort desc,id asc"], - 'Test2' => ["year", "id desc", "publishDateSort desc,id desc"], - 'Test3' => ["year", "", "publishDateSort desc"], - 'Test4' => ["year", "title desc,id asc", "publishDateSort desc,title_sort desc,id asc"], - 'Test5' => ["year", "title desc,id", "publishDateSort desc,title_sort desc,id asc"], - 'Test6' => ["year,id", "id desc", "publishDateSort desc,id asc"], + return ['Test1' => ['year', 'id', 'publishDateSort desc,id asc'], + 'Test2' => ['year', 'id desc', 'publishDateSort desc,id desc'], + 'Test3' => ['year', '', 'publishDateSort desc'], + 'Test4' => ['year', 'title desc,id asc', 'publishDateSort desc,title_sort desc,id asc'], + 'Test5' => ['year', 'title desc,id', 'publishDateSort desc,title_sort desc,id asc'], + 'Test6' => ['year,id', 'id desc', 'publishDateSort desc,id asc'], ]; } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/ResultsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/ResultsTest.php index bfee5c047c5..18515a73236 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/ResultsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/ResultsTest.php @@ -102,7 +102,7 @@ public function testFacetTranslations(): void 'facet_counts' => [ 'facet_fields' => [ 'dewey-raw' => [ - ["000", 100], + ['000', 100], ], ], ], diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Service/ReCaptchaTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Service/ReCaptchaTest.php index e055935ffd4..61d7bd3349e 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Service/ReCaptchaTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Service/ReCaptchaTest.php @@ -97,7 +97,7 @@ public function testProxying(): void */ public function testUnsupportedMethodProxying(): void { - $this->expectExceptionMessage("Unsupported method: notSupportedMethod"); + $this->expectExceptionMessage('Unsupported method: notSupportedMethod'); $service = new ReCaptcha(...$this->getTestParams()); $service->notSupportedMethod('This does not work!'); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Solr/UtilsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Solr/UtilsTest.php index 77560b2d258..1e3d8cadade 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Solr/UtilsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Solr/UtilsTest.php @@ -50,12 +50,12 @@ class UtilsTest extends \PHPUnit\Framework\TestCase public function testParseRange() { // basic range test: - $result = Utils::parseRange("[1 TO 100]"); + $result = Utils::parseRange('[1 TO 100]'); $this->assertEquals('1', $result['from']); $this->assertEquals('100', $result['to']); // test whitespace handling: - $result = Utils::parseRange("[1 TO 100]"); + $result = Utils::parseRange('[1 TO 100]'); $this->assertEquals('1', $result['from']); $this->assertEquals('100', $result['to']); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/CitationTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/CitationTest.php index 16bbb793724..963bd9afc23 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/CitationTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/CitationTest.php @@ -376,15 +376,15 @@ public function testCitations() $cb = $citation($driver); // Normalize whitespace: - $apa = trim(preg_replace("/\s+/", " ", $cb->getCitation('APA'))); + $apa = trim(preg_replace("/\s+/", ' ', $cb->getCitation('APA'))); $this->assertEquals($current['apa'], $apa); // Normalize whitespace: - $mla = trim(preg_replace("/\s+/", " ", $cb->getCitation('MLA'))); + $mla = trim(preg_replace("/\s+/", ' ', $cb->getCitation('MLA'))); $this->assertEquals($current['mla'], $mla); // Normalize whitespace: - $chicago = trim(preg_replace("/\s+/", " ", $cb->getCitation('Chicago'))); + $chicago = trim(preg_replace("/\s+/", ' ', $cb->getCitation('Chicago'))); $this->assertEquals($current['chicago'], $chicago); } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/GoogleAnalyticsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/GoogleAnalyticsTest.php index 98e072ebcc5..db97f71cf42 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/GoogleAnalyticsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/GoogleAnalyticsTest.php @@ -51,7 +51,7 @@ class GoogleAnalyticsTest extends \PHPUnit\Framework\TestCase */ public function testBasicSetup(): void { - $expectedUrl = "https://www.googletagmanager.com/gtag/js?id=myfakekey"; + $expectedUrl = 'https://www.googletagmanager.com/gtag/js?id=myfakekey'; $expected = <<