diff --git a/module/VuFind/src/VuFind/Auth/AbstractBase.php b/module/VuFind/src/VuFind/Auth/AbstractBase.php index c4b96219d57d481ee60c3e0e8a2926fcb04c47ae..05a81a5de95c6b838ffcdb8297cf9333fe3b0bda 100644 --- a/module/VuFind/src/VuFind/Auth/AbstractBase.php +++ b/module/VuFind/src/VuFind/Auth/AbstractBase.php @@ -314,7 +314,7 @@ abstract class AbstractBase implements \VuFind\Db\Table\DbTableAwareInterface, $policy['hint'] = $config->Authentication->password_hint; } else { $policy['hint'] = $this->getCannedPasswordPolicyHint( - isset($policy['pattern']) ? $policy['pattern'] : null + $policy['pattern'] ?? null ); } return $policy; diff --git a/module/VuFind/src/VuFind/Auth/CAS.php b/module/VuFind/src/VuFind/Auth/CAS.php index 05193f232efeec6af66cd07660a409e687ad12f9..0182afa9ef3e193ec820ee0b32ebef8f67dca0c4 100644 --- a/module/VuFind/src/VuFind/Auth/CAS.php +++ b/module/VuFind/src/VuFind/Auth/CAS.php @@ -251,8 +251,7 @@ class CAS extends AbstractBase foreach ($cas as $key => $value) { if (preg_match("/userattribute_[0-9]{1,}/", $key)) { $valueKey = 'userattribute_value_' . substr($key, 14); - $sortedUserAttributes[$value] = isset($cas->$valueKey) - ? $cas->$valueKey : null; + $sortedUserAttributes[$value] = $cas->$valueKey ?? null; // Throw an exception if attributes are missing/empty. if (empty($sortedUserAttributes[$value])) { diff --git a/module/VuFind/src/VuFind/Auth/Facebook.php b/module/VuFind/src/VuFind/Auth/Facebook.php index dd02dd43ca70bc767b4cddafe38b7e57de426355..b2b257f7cc6a403a3709da88523378039c7dcb77 100644 --- a/module/VuFind/src/VuFind/Auth/Facebook.php +++ b/module/VuFind/src/VuFind/Auth/Facebook.php @@ -169,7 +169,7 @@ class Facebook extends AbstractBase implements $response = $this->httpService->get($requestUrl); $parts = explode('&', $response->getBody(), 2); $parts = explode('=', $parts[0], 2); - return isset($parts[1]) ? $parts[1] : null; + return $parts[1] ?? null; } /** diff --git a/module/VuFind/src/VuFind/Auth/ILS.php b/module/VuFind/src/VuFind/Auth/ILS.php index 298480c207ae168987248df2cf7c0731c96b6dfc..d9f5354e945dc552eed40fe35b5c8e6a25d08b4e 100644 --- a/module/VuFind/src/VuFind/Auth/ILS.php +++ b/module/VuFind/src/VuFind/Auth/ILS.php @@ -243,13 +243,13 @@ class ILS extends AbstractBase // Update user information based on ILS data: $fields = ['firstname', 'lastname', 'email', 'major', 'college']; foreach ($fields as $field) { - $user->$field = isset($info[$field]) ? $info[$field] : ' '; + $user->$field = $info[$field] ?? ' '; } // Update the user in the database, then return it to the caller: $user->saveCredentials( - isset($info['cat_username']) ? $info['cat_username'] : ' ', - isset($info['cat_password']) ? $info['cat_password'] : ' ' + $info['cat_username'] ?? ' ', + $info['cat_password'] ?? ' ' ); return $user; diff --git a/module/VuFind/src/VuFind/Auth/Shibboleth.php b/module/VuFind/src/VuFind/Auth/Shibboleth.php index 5422f352cce689caac3583b2b892e6bdfd707e53..b649a7bb9165f14ba1829d465d9617027e26ca6b 100644 --- a/module/VuFind/src/VuFind/Auth/Shibboleth.php +++ b/module/VuFind/src/VuFind/Auth/Shibboleth.php @@ -280,8 +280,7 @@ class Shibboleth extends AbstractBase foreach ($shib as $key => $value) { if (preg_match("/userattribute_[0-9]{1,}/", $key)) { $valueKey = 'userattribute_value_' . substr($key, 14); - $sortedUserAttributes[$value] = isset($shib->$valueKey) - ? $shib->$valueKey : null; + $sortedUserAttributes[$value] = $shib->$valueKey ?? null; // Throw an exception if attributes are missing/empty. if (empty($sortedUserAttributes[$value])) { diff --git a/module/VuFind/src/VuFind/Bootstrapper.php b/module/VuFind/src/VuFind/Bootstrapper.php index dfb5f08478f8d7722c17433c2b82042e60a5f6fc..7903784a8d1a5fb5da225d6a696c0c729725e087 100644 --- a/module/VuFind/src/VuFind/Bootstrapper.php +++ b/module/VuFind/src/VuFind/Bootstrapper.php @@ -190,7 +190,7 @@ class Bootstrapper $viewModel->setVariable('templateDir', $parts[0]); $viewModel->setVariable( 'templateName', - isset($parts[1]) ? $parts[1] : null + $parts[1] ?? null ); } } diff --git a/module/VuFind/src/VuFind/ChannelProvider/AlphaBrowse.php b/module/VuFind/src/VuFind/ChannelProvider/AlphaBrowse.php index a4d83529fbe2cba5446cf2116a891695eea97a23..71f0045ae5c0f2303fd74769726e31f0fa8fe891 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/AlphaBrowse.php +++ b/module/VuFind/src/VuFind/ChannelProvider/AlphaBrowse.php @@ -141,16 +141,11 @@ class AlphaBrowse extends AbstractChannelProvider */ public function setOptions(array $options) { - $this->channelSize = isset($options['channelSize']) - ? $options['channelSize'] : 20; - $this->maxRecordsToExamine = isset($options['maxRecordsToExamine']) - ? $options['maxRecordsToExamine'] : 2; - $this->browseIndex = isset($options['browseIndex']) ? - $options['browseIndex'] : 'lcc'; - $this->solrField = isset($options['solrField']) ? - $options['solrField'] : 'callnumber-raw'; - $this->rowsBefore = isset($options['rows_before']) ? - $options['rows_before'] : 10; + $this->channelSize = $options['channelSize'] ?? 20; + $this->maxRecordsToExamine = $options['maxRecordsToExamine'] ?? 2; + $this->browseIndex = $options['browseIndex'] ?? 'lcc'; + $this->solrField = $options['solrField'] ?? 'callnumber-raw'; + $this->rowsBefore = $options['rows_before'] ?? 10; } /** diff --git a/module/VuFind/src/VuFind/ChannelProvider/Facets.php b/module/VuFind/src/VuFind/ChannelProvider/Facets.php index f3f893246108e26cb7b8a500626b946283968c65..8d27fe07f74d1b468575c3d7e6f8e72135c897a2 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/Facets.php +++ b/module/VuFind/src/VuFind/ChannelProvider/Facets.php @@ -105,14 +105,11 @@ class Facets extends AbstractChannelProvider */ public function setOptions(array $options) { - $this->fields = isset($options['fields']) - ? $options['fields'] - : ['topic_facet' => 'Topic', 'author_facet' => 'Author']; - $this->maxFieldsToSuggest = isset($options['maxFieldsToSuggest']) - ? $options['maxFieldsToSuggest'] : 2; + $this->fields = $options['fields'] + ?? ['topic_facet' => 'Topic', 'author_facet' => 'Author']; + $this->maxFieldsToSuggest = $options['maxFieldsToSuggest'] ?? 2; $this->maxValuesToSuggestPerField - = isset($options['maxValuesToSuggestPerField']) - ? $options['maxValuesToSuggestPerField'] : 2; + = $options['maxValuesToSuggestPerField'] ?? 2; } /** diff --git a/module/VuFind/src/VuFind/ChannelProvider/ListItems.php b/module/VuFind/src/VuFind/ChannelProvider/ListItems.php index 8986237108ec03f728f5187aa5c70f878440400c..91abf6b323635e29ed5812e87ba7c75409334e69 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/ListItems.php +++ b/module/VuFind/src/VuFind/ChannelProvider/ListItems.php @@ -115,11 +115,10 @@ class ListItems extends AbstractChannelProvider */ public function setOptions(array $options) { - $this->ids = isset($options['ids']) ? $options['ids'] : []; + $this->ids = $options['ids'] ?? []; $this->displayPublicLists = isset($options['displayPublicLists']) ? (bool)$options['displayPublicLists'] : true; - $this->initialListsToDisplay = isset($options['initialListsToDisplay']) - ? $options['initialListsToDisplay'] : 2; + $this->initialListsToDisplay = $options['initialListsToDisplay'] ?? 2; } /** diff --git a/module/VuFind/src/VuFind/ChannelProvider/Random.php b/module/VuFind/src/VuFind/ChannelProvider/Random.php index ec9918cbac64f1581e0297136f64927a228e30cf..587b4ae2e62ee04c84fe8715081ce281a18acb1b 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/Random.php +++ b/module/VuFind/src/VuFind/ChannelProvider/Random.php @@ -98,9 +98,8 @@ class Random extends AbstractChannelProvider */ public function setOptions(array $options) { - $this->channelSize = isset($options['channelSize']) - ? $options['channelSize'] : 20; - $this->mode = isset($options['mode']) ? $options['mode'] : 'retain'; + $this->channelSize = $options['channelSize'] ?? 20; + $this->mode = $options['mode'] ?? 'retain'; } /** diff --git a/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php b/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php index a7625224e9129257510ffd823b3f6afae9b6f56e..24e37e9d734994aec71683c31a9acfdf0d585577 100644 --- a/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php +++ b/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php @@ -109,10 +109,8 @@ class SimilarItems extends AbstractChannelProvider */ public function setOptions(array $options) { - $this->channelSize = isset($options['channelSize']) - ? $options['channelSize'] : 20; - $this->maxRecordsToExamine = isset($options['maxRecordsToExamine']) - ? $options['maxRecordsToExamine'] : 2; + $this->channelSize = $options['channelSize'] ?? 20; + $this->maxRecordsToExamine = $options['maxRecordsToExamine'] ?? 2; } /** diff --git a/module/VuFind/src/VuFind/Config/Writer.php b/module/VuFind/src/VuFind/Config/Writer.php index 15c06a9f59fe93be8da59d0544320504c05d5c89..9661b9fd0e2375be263bd705b86fbdaa78b2108e 100644 --- a/module/VuFind/src/VuFind/Config/Writer.php +++ b/module/VuFind/src/VuFind/Config/Writer.php @@ -103,7 +103,7 @@ class Writer // Separate comments from content: $parts = explode(';', trim($line), 2); $content = trim($parts[0]); - $comment = isset($parts[1]) ? $parts[1] : ''; + $comment = $parts[1] ?? ''; // Is this a section heading? if (preg_match('/^\[(.+)\]$/', trim($content), $matches)) { diff --git a/module/VuFind/src/VuFind/Connection/Wikipedia.php b/module/VuFind/src/VuFind/Connection/Wikipedia.php index 3815afae5714bae2844973688602b357df7b49bc..faecc7ca5641f244083cca92d6fecc88008adea9 100644 --- a/module/VuFind/src/VuFind/Connection/Wikipedia.php +++ b/module/VuFind/src/VuFind/Connection/Wikipedia.php @@ -455,9 +455,7 @@ class Wikipedia implements TranslatorAwareInterface $imageUrl = $this->getWikipediaImageURL($imageName); if ($imageUrl != false) { $info['image'] = $imageUrl; - $info['altimage'] = isset($imageCaption) - ? $imageCaption - : $name; + $info['altimage'] = $imageCaption ?? $name; } } @@ -506,6 +504,6 @@ class Wikipedia implements TranslatorAwareInterface } } - return isset($imageUrl) ? $imageUrl : false; + return $imageUrl ?? false; } } diff --git a/module/VuFind/src/VuFind/Content/Loader.php b/module/VuFind/src/VuFind/Content/Loader.php index aac0eb1f14a53018446efdb329b237b5838f8d05..b52adbfda0da34aef1395ab4a6ba55ec5ae3e4d5 100644 --- a/module/VuFind/src/VuFind/Content/Loader.php +++ b/module/VuFind/src/VuFind/Content/Loader.php @@ -100,7 +100,7 @@ class Loader $parts = explode(':', trim($provider)); $provider = $parts[0]; if (!empty($provider)) { - $key = isset($parts[1]) ? $parts[1] : ''; + $key = $parts[1] ?? ''; try { $plugin = $this->loader->get($provider); $results[$provider] = $plugin->loadByIsbn($key, $isbnObj); diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php index 30e54acd2aaa620d3ad3dded243ec54886f81b72..3e0312d60b44a74b740554f75a9a1cf641972356 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php +++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php @@ -289,7 +289,7 @@ class AbstractRecord extends AbstractBase $post = $this->getRequest()->getPost()->toArray(); $tagParser = $this->serviceLocator->get('VuFind\Tags'); $post['mytags'] - = $tagParser->parse(isset($post['mytags']) ? $post['mytags'] : ''); + = $tagParser->parse($post['mytags'] ?? ''); $favorites = $this->serviceLocator ->get('VuFind\Favorites\FavoritesService'); $results = $favorites->save($post, $user, $driver); diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php index a72205a13b866b524966fa1937b6ff8ab5238481..bdbff75d88285d4d8f60ca7e2fe6e0a5b46009e7 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php +++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php @@ -645,8 +645,8 @@ class AbstractSearch extends AbstractBase protected function processAdvancedCheckboxes($params, $savedSearch = false) { // Set defaults for missing parameters: - $config = isset($params[0]) ? $params[0] : 'facets'; - $section = isset($params[1]) ? $params[1] : 'CheckboxFacets'; + $config = $params[0] ?? 'facets'; + $section = $params[1] ?? 'CheckboxFacets'; // Load config file: $config = $this->serviceLocator->get('VuFind\Config\PluginManager') diff --git a/module/VuFind/src/VuFind/Controller/AjaxController.php b/module/VuFind/src/VuFind/Controller/AjaxController.php index 7347e9c0a919d25e90821fdcaeb6e1f11560c3b5..3f8a1367a78cda71cc1efd11fc5d10f363e54027 100644 --- a/module/VuFind/src/VuFind/Controller/AjaxController.php +++ b/module/VuFind/src/VuFind/Controller/AjaxController.php @@ -488,16 +488,14 @@ class AjaxController extends AbstractBase $locationCallnumbers, $callnumberSetting, 'Multiple Call Numbers' ); $locationInfo = [ - 'availability' => - isset($details['available']) ? $details['available'] : false, + 'availability' => $details['available'] ?? false, 'location' => htmlentities( $this->translate('location_' . $location, [], $location), ENT_COMPAT, 'UTF-8' ), 'callnumbers' => htmlentities($locationCallnumbers, ENT_COMPAT, 'UTF-8'), - 'status_unknown' => isset($details['status_unknown']) - ? $details['status_unknown'] : false, + 'status_unknown' => $details['status_unknown'] ?? false, 'callnumber_handler' => $callnumberHandler ]; $locationList[] = $locationInfo; @@ -555,7 +553,7 @@ class AjaxController extends AbstractBase } $result = $checked = []; foreach ($ids as $i => $id) { - $source = isset($sources[$i]) ? $sources[$i] : DEFAULT_SEARCH_BACKEND; + $source = $sources[$i] ?? DEFAULT_SEARCH_BACKEND; $selector = $source . '|' . $id; // We don't want to bother checking the same ID more than once, so @@ -792,7 +790,7 @@ class AjaxController extends AbstractBase $facets[$field]['removalURL'] = $results->getUrlQuery()->removeFacet( $field, - isset($filters[$field][0]) ? $filters[$field][0] : null + $filters[$field][0] ?? null )->getParams(false); } return $this->output($facets, self::STATUS_OK); @@ -1101,7 +1099,7 @@ class AjaxController extends AbstractBase // Sort the returned links into categories based on service type: $electronic = $print = $services = []; foreach ($result as $link) { - switch (isset($link['service_type']) ? $link['service_type'] : '') { + switch ($link['service_type'] ?? '') { case 'getHolding': $print[] = $link; break; diff --git a/module/VuFind/src/VuFind/Controller/CollectionsController.php b/module/VuFind/src/VuFind/Controller/CollectionsController.php index ae1d9257060050df21885fd1351832492c6b58e9..563ffbf58cba1545899e78b4e2db8097222f9be2 100644 --- a/module/VuFind/src/VuFind/Controller/CollectionsController.php +++ b/module/VuFind/src/VuFind/Controller/CollectionsController.php @@ -183,8 +183,7 @@ class CollectionsController extends AbstractBase $result = $searchObject->getFullFieldFacets( [$browseField], false, 150000, 'index' ); - $result = isset($result[$browseField]['data']['list']) - ? $result[$browseField]['data']['list'] : []; + $result = $result[$browseField]['data']['list'] ?? []; $delimiter = $this->getBrowseDelimiter(); foreach ($result as $rkey => $collection) { @@ -266,7 +265,7 @@ class CollectionsController extends AbstractBase } $result = $sorted; - return isset($key) ? $key : 0; + return $key ?? 0; } /** diff --git a/module/VuFind/src/VuFind/Controller/CombinedController.php b/module/VuFind/src/VuFind/Controller/CombinedController.php index b652b5b4a55191f1fd6fb46641546d8156c346d8..02fb5c01caee808a686c7e07a5d4b8eccce653d6 100644 --- a/module/VuFind/src/VuFind/Controller/CombinedController.php +++ b/module/VuFind/src/VuFind/Controller/CombinedController.php @@ -194,9 +194,8 @@ class CombinedController extends AbstractSearch && intval($config['Layout']['columns']) <= count($combinedResults) ? intval($config['Layout']['columns']) : count($combinedResults); - $placement = isset($config['Layout']['stack_placement']) - ? $config['Layout']['stack_placement'] - : 'distributed'; + $placement = $config['Layout']['stack_placement'] + ?? 'distributed'; if (!in_array($placement, ['distributed', 'left', 'right'])) { $placement = 'distributed'; } @@ -279,7 +278,7 @@ class CombinedController extends AbstractSearch { // Apply limit setting, if any: $query = $this->getRequest()->getQuery(); - $query->limit = isset($settings['limit']) ? $settings['limit'] : null; + $query->limit = $settings['limit'] ?? null; // Apply filters, if any: $query->filter = isset($settings['filter']) diff --git a/module/VuFind/src/VuFind/Controller/HoldsTrait.php b/module/VuFind/src/VuFind/Controller/HoldsTrait.php index 9618848df46fdc61d26058cf12a7e01784f0eb45..d440ba7784b1b3a78f183d5e4c81bb19bdb3c651 100644 --- a/module/VuFind/src/VuFind/Controller/HoldsTrait.php +++ b/module/VuFind/src/VuFind/Controller/HoldsTrait.php @@ -192,8 +192,7 @@ trait HoldsTrait 'requestGroups' => $requestGroups, 'defaultRequestGroup' => $defaultRequestGroup, 'requestGroupNeeded' => $requestGroupNeeded, - 'helpText' => isset($checkHolds['helpText']) - ? $checkHolds['helpText'] : null + 'helpText' => $checkHolds['helpText'] ?? null ] ); $view->setTemplate('record/hold'); diff --git a/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php b/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php index 3fec41b75d57034acf06275da460cec993a78bde..58bc655256b9dc0ef2666f0a06b603bbfb4e347f 100644 --- a/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php +++ b/module/VuFind/src/VuFind/Controller/ILLRequestsTrait.php @@ -153,8 +153,7 @@ trait ILLRequestsTrait 'homeLibrary' => $this->getUser()->home_library, 'extraFields' => $extraFields, 'defaultRequiredDate' => $defaultRequired, - 'helpText' => isset($checkRequests['helpText']) - ? $checkRequests['helpText'] : null + 'helpText' => $checkRequests['helpText'] ?? null ] ); $view->setTemplate('record/illrequest'); diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php index db4988d73c86d2c9fabaefb138c8226e306d4644..ed3953e686170c75576ec93ab03a43c4e2cc8669 100644 --- a/module/VuFind/src/VuFind/Controller/MyResearchController.php +++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php @@ -940,9 +940,8 @@ class MyResearchController extends AbstractBase */ protected function getDriverForILSRecord($current) { - $id = isset($current['id']) ? $current['id'] : null; - $source = isset($current['source']) - ? $current['source'] : DEFAULT_SEARCH_BACKEND; + $id = $current['id'] ?? null; + $source = $current['source'] ?? DEFAULT_SEARCH_BACKEND; $record = $this->serviceLocator->get('VuFind\Record\Loader') ->load($id, $source, true); $record->setExtraDetail('ils_details', $current); @@ -1248,9 +1247,8 @@ class MyResearchController extends AbstractBase $limit = min([$functionConfig['max_results'], $limit]); } elseif (isset($functionConfig['page_size'])) { if (!in_array($limit, $functionConfig['page_size'])) { - $limit = isset($functionConfig['default_page_size']) - ? $functionConfig['default_page_size'] - : $functionConfig['page_size'][0]; + $limit = $functionConfig['default_page_size'] + ?? $functionConfig['page_size'][0]; } } else { $ilsPaging = false; @@ -1364,8 +1362,7 @@ class MyResearchController extends AbstractBase if (!isset($row['id']) || empty($row['id'])) { throw new \Exception(); } - $source = isset($row['source']) - ? $row['source'] : DEFAULT_SEARCH_BACKEND; + $source = $row['source'] ?? DEFAULT_SEARCH_BACKEND; $row['driver'] = $this->serviceLocator ->get('VuFind\Record\Loader')->load($row['id'], $source); if (empty($row['title'])) { diff --git a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php index 6b33db2c9540b0226158464e8119544301194266..3676b38c35a45e2d9cc81811ec6c2efbd17f93c5 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php @@ -721,8 +721,7 @@ class DbUpgrade extends AbstractPlugin $deleteRule = 'RESTRICT'; $updateRule = 'RESTRICT'; $options = 'RESTRICT|CASCADE|SET NULL|NO ACTION|SET DEFAULT'; - $actions = isset($foreignKeyMatches[3][$i]) - ? $foreignKeyMatches[3][$i] : ''; + $actions = $foreignKeyMatches[3][$i] ?? ''; if (preg_match("/ON DELETE ($options)/", $actions, $matches)) { $deleteRule = $matches[1]; } @@ -766,7 +765,7 @@ class DbUpgrade extends AbstractPlugin protected function defaultMatches($currentDefault, $sql) { preg_match("/.* DEFAULT (.*)$/", $sql, $matches); - $expectedDefault = isset($matches[1]) ? $matches[1] : null; + $expectedDefault = $matches[1] ?? null; if (null !== $expectedDefault) { $expectedDefault = trim(rtrim($expectedDefault, ','), "'"); $expectedDefault = (strtoupper($expectedDefault) == 'NULL') diff --git a/module/VuFind/src/VuFind/Controller/Plugin/Favorites.php b/module/VuFind/src/VuFind/Controller/Plugin/Favorites.php index 0e4ceaac7790c6740ab86c8560dd923addd49ec4..5cf5ee695ad14ca16b9a75b72b5bf0d8ae218ae3 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/Favorites.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/Favorites.php @@ -147,7 +147,7 @@ class Favorites extends \Zend\Mvc\Controller\Plugin\AbstractPlugin } // Load helper objects needed for the saving process: - $list = $this->getList(isset($params['list']) ? $params['list'] : '', $user); + $list = $this->getList($params['list'] ?? '', $user); $this->cache->setContext(Cache::CONTEXT_FAVORITE); $cacheRecordIds = []; // list of record IDs to save to cache diff --git a/module/VuFind/src/VuFind/Controller/Plugin/Permission.php b/module/VuFind/src/VuFind/Controller/Plugin/Permission.php index 7f35dbbf91655846a945dfa74dd747fe4543cf10..cf8e43c7c8a0901c98b01d7ec78b39ac3fe2368d 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/Permission.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/Permission.php @@ -116,8 +116,7 @@ class Permission extends AbstractPlugin implements LoggerAwareInterface, if ($dl === false) { return null; } - $exceptionDescription = isset($dl['exceptionMessage']) - ? $dl['exceptionMessage'] : 'Access denied.'; + $exceptionDescription = $dl['exceptionMessage'] ?? 'Access denied.'; switch (strtolower($dl['action'])) { case 'promptlogin': // If the user is already logged in, but we're getting a "prompt diff --git a/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php b/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php index 75ea7ead5cfd482d84afef72308b59177c672106..b21b40616fed49982cabf2f71004ca3e599530b7 100644 --- a/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php +++ b/module/VuFind/src/VuFind/Controller/StorageRetrievalRequestsTrait.php @@ -149,8 +149,7 @@ trait StorageRetrievalRequestsTrait 'homeLibrary' => $this->getUser()->home_library, 'extraFields' => $extraFields, 'defaultRequiredDate' => $defaultRequired, - 'helpText' => isset($checkRequests['helpText']) - ? $checkRequests['helpText'] : null + 'helpText' => $checkRequests['helpText'] ?? null ] ); $view->setTemplate('record/storageretrievalrequest'); diff --git a/module/VuFind/src/VuFind/Crypt/HMAC.php b/module/VuFind/src/VuFind/Crypt/HMAC.php index 13936143f8c606faf2d47078c6392ce05ec03d83..cd8b140c920e07defae15df01aae6d2d08ad3b22 100644 --- a/module/VuFind/src/VuFind/Crypt/HMAC.php +++ b/module/VuFind/src/VuFind/Crypt/HMAC.php @@ -67,7 +67,7 @@ class HMAC { $str = ''; foreach ($keysToHash as $key) { - $value = isset($keyValueArray[$key]) ? $keyValueArray[$key] : ''; + $value = $keyValueArray[$key] ?? ''; $str .= $key . '=' . $value . '|'; } return hash_hmac('md5', $str, $this->hashKey); diff --git a/module/VuFind/src/VuFind/Db/AdapterFactory.php b/module/VuFind/src/VuFind/Db/AdapterFactory.php index e645eed3530b5cb2b978e28f681ceca1b67301a2..da64a9119dd7ca68ba8e6c364d009c51c82cbcb5 100644 --- a/module/VuFind/src/VuFind/Db/AdapterFactory.php +++ b/module/VuFind/src/VuFind/Db/AdapterFactory.php @@ -146,7 +146,7 @@ class AdapterFactory ) { list($type, $details) = explode('://', $connectionString); preg_match('/(.+)@([^@]+)\/(.+)/', $details, $matches); - $credentials = isset($matches[1]) ? $matches[1] : null; + $credentials = $matches[1] ?? null; if (isset($matches[2])) { if (strpos($matches[2], ':') !== false) { list($host, $port) = explode(':', $matches[2]); @@ -154,7 +154,7 @@ class AdapterFactory $host = $matches[2]; } } - $dbName = isset($matches[3]) ? $matches[3] : null; + $dbName = $matches[3] ?? null; if (strstr($credentials, ':')) { list($username, $password) = explode(':', $credentials, 2); } else { @@ -167,7 +167,7 @@ class AdapterFactory // Set up default options: $options = [ 'driver' => $this->getDriverName($type), - 'hostname' => isset($host) ? $host : null, + 'hostname' => $host ?? null, 'username' => $username, 'password' => $password, 'database' => $dbName diff --git a/module/VuFind/src/VuFind/Db/Row/Resource.php b/module/VuFind/src/VuFind/Db/Row/Resource.php index 60e072ab2abf483af544ba5ad7e44c0421850aab..5fe50728d3c872474c41da1c735b1dd718c13c73 100644 --- a/module/VuFind/src/VuFind/Db/Row/Resource.php +++ b/module/VuFind/src/VuFind/Db/Row/Resource.php @@ -190,7 +190,7 @@ class Resource extends RowGateway implements \VuFind\Db\Table\DbTableAwareInterf $year = ''; } } else { - $year = isset($dates[0]) ? $dates[0] : ''; + $year = $dates[0] ?? ''; } if (!empty($year)) { $this->year = intval($year); diff --git a/module/VuFind/src/VuFind/Db/Table/Gateway.php b/module/VuFind/src/VuFind/Db/Table/Gateway.php index 5b54f38f4814a3edccc75c745ebbbb7b67369da8..252aae0970a5d73b6d14147cfe9f6325793bc92d 100644 --- a/module/VuFind/src/VuFind/Db/Table/Gateway.php +++ b/module/VuFind/src/VuFind/Db/Table/Gateway.php @@ -86,8 +86,7 @@ class Gateway extends AbstractTableGateway { // Special case for PostgreSQL sequences: if ($this->adapter->getDriver()->getDatabasePlatformName() == "Postgresql") { - $maps = isset($cfg['vufind']['pgsql_seq_mapping']) - ? $cfg['vufind']['pgsql_seq_mapping'] : null; + $maps = $cfg['vufind']['pgsql_seq_mapping'] ?? null; if (isset($maps[$this->table])) { if (!is_object($this->featureSet)) { $this->featureSet = new Feature\FeatureSet(); diff --git a/module/VuFind/src/VuFind/Favorites/FavoritesService.php b/module/VuFind/src/VuFind/Favorites/FavoritesService.php index 9e86835e3a0d204e1ce7d3a934daaecad20e8bcd..80ef8500205f317e2627fba624b1707507c4f7c8 100644 --- a/module/VuFind/src/VuFind/Favorites/FavoritesService.php +++ b/module/VuFind/src/VuFind/Favorites/FavoritesService.php @@ -152,7 +152,7 @@ class FavoritesService implements \VuFind\I18n\Translator\TranslatorAwareInterfa // Get or create a list object as needed: $list = $this->getListObject( - isset($params['list']) ? $params['list'] : '', + $params['list'] ?? '', $user ); @@ -167,8 +167,8 @@ class FavoritesService implements \VuFind\I18n\Translator\TranslatorAwareInterfa // Add the information to the user's account: $user->saveResource( $resource, $list, - isset($params['mytags']) ? $params['mytags'] : [], - isset($params['notes']) ? $params['notes'] : '' + $params['mytags'] ?? [], + $params['notes'] ?? '' ); return ['listId' => $list->id]; } diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Json.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Json.php index 5f2645b2c0bcc0c312436d11634fc6ac450cb053..4d958d4e542e202887f89ab964003aa177aecba8 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Json.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Json.php @@ -95,7 +95,7 @@ class Json extends AbstractBase // otherwise, we can just collect flat values. if ($this->sort) { $positions = $this->getHierarchyPositionsInParents($current); - $sequence = isset($positions[$parentID]) ? $positions[$parentID] : 0; + $sequence = $positions[$parentID] ?? 0; $json[] = [$sequence, $childNode]; } else { $json[] = $childNode; diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Xml.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Xml.php index 2aecded13bf0b0f6a9d820f9e31788bc7c84a02f..7b345489e7a5e582abf390214fe5a335b1a83486 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Xml.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataFormatter/Xml.php @@ -94,7 +94,7 @@ class Xml extends AbstractBase // otherwise, we can just collect flat values. if ($this->sort) { $positions = $this->getHierarchyPositionsInParents($current); - $sequence = isset($positions[$parentID]) ? $positions[$parentID] : 0; + $sequence = $positions[$parentID] ?? 0; $parts[] = [$sequence, $childNode]; } else { $parts[] = $childNode; diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/XMLFile.php b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/XMLFile.php index f6b40040d570e8bcc0af93c7273955b02dcb0e01..8c641d9d4710e9b25a8e81b64303a54343616fcb 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/XMLFile.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeDataSource/XMLFile.php @@ -56,8 +56,7 @@ class XMLFile extends AbstractBase { if (null === $this->basePath) { $settings = $this->getHierarchyDriver()->getTreeSettings(); - $this->basePath = isset($settings['XMLFileDir']) - ? $settings['XMLFileDir'] : ''; + $this->basePath = $settings['XMLFileDir'] ?? ''; } return $this->basePath; } diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTree.php b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTree.php index a5422165804a2513017bc9218d3f77145813de32..23d150b48ccd3d028ce31d35bf1542fbef58cd82 100644 --- a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTree.php +++ b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTree.php @@ -104,8 +104,7 @@ class JSTree extends AbstractBase $hierarchies = []; foreach ($inHierarchies as $hierarchyTopID) { if ($this->getDataSource()->supports($hierarchyTopID)) { - $hierarchies[$hierarchyTopID] = isset($inHierarchiesTitle[$i]) - ? $inHierarchiesTitle[$i] : ''; + $hierarchies[$hierarchyTopID] = $inHierarchiesTitle[$i] ?? ''; } $i++; } diff --git a/module/VuFind/src/VuFind/ILS/Connection.php b/module/VuFind/src/VuFind/ILS/Connection.php index 3cf0ece8ce44e59db42e7e2d5fa22b408df66b1a..7f3a0b91fad8738f2442356fdffcb546b81c254a 100644 --- a/module/VuFind/src/VuFind/ILS/Connection.php +++ b/module/VuFind/src/VuFind/ILS/Connection.php @@ -338,7 +338,7 @@ class Connection implements TranslatorAwareInterface, LoggerAwareInterface $response['consortium'] = $functionConfig['consortium']; } } else { - $id = isset($params['id']) ? $params['id'] : null; + $id = $params['id'] ?? null; if ($this->checkCapability('getHoldLink', [$id, []])) { $response = ['function' => "getHoldLink"]; } @@ -487,7 +487,7 @@ class Connection implements TranslatorAwareInterface, LoggerAwareInterface } else { $cancelParams = [ $params ?: [], - isset($params['patron']) ? $params['patron'] : null + $params['patron'] ?? null ]; $check2 = $this->checkCapability( 'getCancelStorageRetrievalRequestLink', $cancelParams @@ -573,7 +573,7 @@ class Connection implements TranslatorAwareInterface, LoggerAwareInterface } else { $cancelParams = [ $params ?: [], - isset($params['patron']) ? $params['patron'] : null + $params['patron'] ?? null ]; $check2 = $this->checkCapability( 'getCancelILLRequestLink', $cancelParams @@ -646,7 +646,7 @@ class Connection implements TranslatorAwareInterface, LoggerAwareInterface { if (is_array($helpText)) { $lang = $this->getTranslatorLocale(); - return isset($helpText[$lang]) ? $helpText[$lang] : ''; + return $helpText[$lang] ?? ''; } return $helpText; } diff --git a/module/VuFind/src/VuFind/ILS/Driver/DAIA.php b/module/VuFind/src/VuFind/ILS/Driver/DAIA.php index 06b7d6ee10b9524fb6daf0e8cf694bd6d9015234..f312547053f9c036017a224011be724f225e1470 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/DAIA.php +++ b/module/VuFind/src/VuFind/ILS/Driver/DAIA.php @@ -751,7 +751,7 @@ class DAIA extends AbstractBase implements $result_item['item_id'] = $item['id']; // custom DAIA field used in getHoldLink() $result_item['ilslink'] - = (isset($item['href']) ? $item['href'] : $doc_href); + = ($item['href'] ?? $doc_href); // count items $number++; $result_item['number'] = $this->getItemNumber($item, $number); @@ -1134,8 +1134,7 @@ class DAIA extends AbstractBase implements */ protected function getItemDepartmentLink($item) { - return isset($item['department']['href']) - ? $item['department']['href'] : false; + return $item['department']['href'] ?? false; } /** diff --git a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php index ecfc320ef3fc1244aa8ab16ad47e7d86ede0e0f1..2d7b62a7ed82f5877e31b19dc6816564018da684 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php +++ b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php @@ -668,7 +668,7 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements { $patron = $holdDetails['patron']; $patron_id = $patron['id']; - $request_location = isset($patron['ip']) ? $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']) @@ -1169,7 +1169,7 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements 'balance' => $row['balance'], 'createdate' => $this->displayDate($row['createdat']), 'duedate' => $this->displayDate($row['duedate']), - 'id' => isset($row['id']) ? $row['id'] : -1, + 'id' => $row['id'] ?? -1, ]; } return $transactionLst; diff --git a/module/VuFind/src/VuFind/ILS/Driver/PAIA.php b/module/VuFind/src/VuFind/ILS/Driver/PAIA.php index cde147351427bdfb98b956581aeb5de635ae36f8..8e814a7b6ab2c1e1a7133e5a15c8a4d7bc514e6d 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/PAIA.php +++ b/module/VuFind/src/VuFind/ILS/Driver/PAIA.php @@ -331,10 +331,8 @@ class PAIA extends DAIA 'success' => false, 'status' => $array_response['error'], 'sysMessage' => - isset($array_response['error']) - ? $array_response['error'] : ' ' . - isset($array_response['error_description']) - ? $array_response['error_description'] : ' ' + $array_response['error'] ?? ' ' . + $array_response['error_description'] ?? ' ' ]; } elseif (isset($array_response['patron']) && $array_response['patron'] === $post_data['patron'] @@ -599,7 +597,7 @@ class PAIA extends DAIA 'checkout' => '', // fee.feetype 0..1 string textual description of the type // of service that caused the fee - 'fine' => (isset($fee['feetype']) ? $fee['feetype'] : null), + 'fine' => ($fee['feetype'] ?? null), 'balance' => $feeConverter($fee['amount']), // fee.date 0..1 date date when the fee was claimed 'createdate' => (isset($fee['date']) @@ -640,12 +638,9 @@ class PAIA extends DAIA // fee.item 0..1 URI item that caused the fee // fee.feeid 0..1 URI URI of the type of service that // caused the fee - $additionalData['feeid'] = (isset($fee['feeid']) - ? $fee['feeid'] : null); - $additionalData['about'] = (isset($fee['about']) - ? $fee['about'] : null); - $additionalData['item'] = (isset($fee['item']) - ? $fee['item'] : null); + $additionalData['feeid'] = ($fee['feeid'] ?? null); + $additionalData['about'] = ($fee['about'] ?? null); + $additionalData['item'] = ($fee['item'] ?? null); return $additionalData; } @@ -699,7 +694,7 @@ class PAIA extends DAIA // PAIA specific custom values 'expires' => isset($patron['expires']) ? $this->convertDate($patron['expires']) : null, - 'statuscode' => isset($patron['status']) ? $patron['status'] : null, + 'statuscode' => $patron['status'] ?? null, 'canWrite' => in_array('write_items', $this->getScope()), ]; } @@ -816,7 +811,7 @@ class PAIA extends DAIA */ protected function getCallNumber($doc) { - return isset($doc['label']) ? $doc['label'] : null; + return $doc['label'] ?? null; } /** @@ -1200,8 +1195,7 @@ class PAIA extends DAIA $user['id'] = $patron; $user['firstname'] = $firstname; $user['lastname'] = $lastname; - $user['email'] = (isset($user_response['email']) - ? $user_response['email'] : ''); + $user['email'] = ($user_response['email'] ?? ''); $user['major'] = null; $user['college'] = null; // add other information from PAIA - we don't want anything to get lost @@ -1246,7 +1240,7 @@ class PAIA extends DAIA $result = []; // item (0..1) URI of a particular copy - $result['item_id'] = (isset($doc['item']) ? $doc['item'] : ''); + $result['item_id'] = ($doc['item'] ?? ''); $result['cancel_details'] = (isset($doc['cancancel']) && $doc['cancancel']) @@ -1261,16 +1255,16 @@ class PAIA extends DAIA $result['type'] = $this->paiaStatusString($doc['status']); // storage (0..1) textual description of location of the document - $result['location'] = (isset($doc['storage']) ? $doc['storage'] : null); + $result['location'] = ($doc['storage'] ?? null); // queue (0..1) number of waiting requests for the document or item - $result['position'] = (isset($doc['queue']) ? $doc['queue'] : null); + $result['position'] = ($doc['queue'] ?? null); // only true if status == 4 $result['available'] = false; // about (0..1) textual description of the document - $result['title'] = (isset($doc['about']) ? $doc['about'] : null); + $result['title'] = ($doc['about'] ?? null); // PAIA custom field // label (0..1) call number, shelf mark or similar item label @@ -1379,11 +1373,10 @@ class PAIA extends DAIA foreach ($items as $doc) { $result = []; // canrenew (0..1) whether a document can be renewed (bool) - $result['renewable'] = (isset($doc['canrenew']) - ? $doc['canrenew'] : false); + $result['renewable'] = ($doc['canrenew'] ?? false); // item (0..1) URI of a particular copy - $result['item_id'] = (isset($doc['item']) ? $doc['item'] : ''); + $result['item_id'] = ($doc['item'] ?? ''); $result['renew_details'] = (isset($doc['canrenew']) && $doc['canrenew']) @@ -1398,17 +1391,17 @@ class PAIA extends DAIA // requested (0..1) URI that was originally requested // about (0..1) textual description of the document - $result['title'] = (isset($doc['about']) ? $doc['about'] : null); + $result['title'] = ($doc['about'] ?? null); // queue (0..1) number of waiting requests for the document or item - $result['request'] = (isset($doc['queue']) ? $doc['queue'] : null); + $result['request'] = ($doc['queue'] ?? null); // renewals (0..1) number of times the document has been renewed - $result['renew'] = (isset($doc['renewals']) ? $doc['renewals'] : null); + $result['renew'] = ($doc['renewals'] ?? null); // reminder (0..1) number of times the patron has been reminded $result['reminder'] = ( - isset($doc['reminder']) ? $doc['reminder'] : null + $doc['reminder'] ?? null ); // custom PAIA field @@ -1428,11 +1421,10 @@ class PAIA extends DAIA // canceled // error (0..1) error message, for instance if a request was rejected - $result['message'] = (isset($doc['error']) ? $doc['error'] : ''); + $result['message'] = ($doc['error'] ?? ''); // storage (0..1) textual description of location of the document - $result['borrowingLocation'] = (isset($doc['storage']) - ? $doc['storage'] : ''); + $result['borrowingLocation'] = ($doc['storage'] ?? ''); // storageid (0..1) location URI @@ -1661,11 +1653,9 @@ class PAIA extends DAIA $session = $this->getSession(); $session->patron - = isset($responseArray['patron']) - ? $responseArray['patron'] : null; + = $responseArray['patron'] ?? null; $session->access_token - = isset($responseArray['access_token']) - ? $responseArray['access_token'] : null; + = $responseArray['access_token'] ?? null; $session->scope = isset($responseArray['scope']) ? explode(' ', $responseArray['scope']) : null; diff --git a/module/VuFind/src/VuFind/ILS/Driver/SierraRest.php b/module/VuFind/src/VuFind/ILS/Driver/SierraRest.php index 65e9d87b6c158def1ccafccaca91eb515f8b86d9..2085556a2f83b4a5b2182c2c2b41428c589c6c81 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/SierraRest.php +++ b/module/VuFind/src/VuFind/ILS/Driver/SierraRest.php @@ -633,7 +633,7 @@ class SierraRest extends AbstractBase implements TranslatorAwareInterface, */ public function getMyTransactionHistory($patron, $params) { - $pageSize = isset($params['limit']) ? $params['limit'] : 50; + $pageSize = $params['limit'] ?? 50; $offset = isset($params['page']) ? ($params['page'] - 1) * $pageSize : 0; $sortOrder = isset($params['sort']) && 'checkout asc' === $params['sort'] ? 'asc' : 'desc'; @@ -692,7 +692,7 @@ class SierraRest extends AbstractBase implements TranslatorAwareInterface, } return [ - 'count' => isset($result['total']) ? $result['total'] : 0, + 'count' => $result['total'] ?? 0, 'transactions' => $transactions ]; } @@ -750,9 +750,8 @@ class SierraRest extends AbstractBase implements TranslatorAwareInterface, if (!empty($bibId)) { // Fetch bib information $bib = $this->getBibRecord($bibId, 'title,publishYear', $patron); - $title = isset($bib['title']) ? $bib['title'] : ''; - $publicationYear = isset($bib['publishYear']) ? $bib['publishYear'] - : ''; + $title = $bib['title'] ?? ''; + $publicationYear = $bib['publishYear'] ?? ''; } $available = in_array($entry['status']['code'], ['b', 'j', 'i']); if ($entry['priority'] >= $entry['priorityQueueLength']) { @@ -952,7 +951,7 @@ class SierraRest extends AbstractBase implements TranslatorAwareInterface, if ($this->getPatronBlocks($patron)) { return false; } - $level = isset($data['level']) ? $data['level'] : 'copy'; + $level = $data['level'] ?? 'copy'; if ('title' == $data['level']) { $bib = $this->getBibRecord($id, 'bibLevel', $patron); if (!isset($bib['bibLevel']['code']) @@ -984,8 +983,8 @@ class SierraRest extends AbstractBase implements TranslatorAwareInterface, ? $holdDetails['level'] : 'copy'; $pickUpLocation = !empty($holdDetails['pickUpLocation']) ? $holdDetails['pickUpLocation'] : $this->defaultPickUpLocation; - $itemId = isset($holdDetails['item_id']) ? $holdDetails['item_id'] : false; - $comment = isset($holdDetails['comment']) ? $holdDetails['comment'] : ''; + $itemId = $holdDetails['item_id'] ?? false; + $comment = $holdDetails['comment'] ?? ''; $bibId = $holdDetails['id']; // Convert last interest date from Display Format to Sierra's required format @@ -1112,7 +1111,7 @@ class SierraRest extends AbstractBase implements TranslatorAwareInterface, $bibId = $item['bibIds'][0]; // Fetch bib information $bib = $this->getBibRecord($bibId, 'title,publishYear', $patron); - $title = isset($bib['title']) ? $bib['title'] : ''; + $title = $bib['title'] ?? ''; } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php index 62fcd46b00866b2851de6ac05d9bfe267ddc928a..d3381bb063480253ec8f211cc64a6b14e64adad2 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php @@ -302,9 +302,7 @@ class Symphony extends AbstractBase implements LoggerAwareInterface */ if (isset($options['login'])) { $login = $options['login']; - $password = isset($options['password']) - ? $options['password'] - : null; + $password = $options['password'] ?? null; } elseif (isset($options['WebServices']['login']) && !in_array( $operation, @@ -978,8 +976,7 @@ class Symphony extends AbstractBase implements LoggerAwareInterface $policyID = strtoupper($policyID); $policyList = $this->getPolicyList($policyType); - return isset($policyList[$policyID]) ? - $policyList[$policyID] : $policyID; + return $policyList[$policyID] ?? $policyID; } /** @@ -997,7 +994,7 @@ class Symphony extends AbstractBase implements LoggerAwareInterface public function getStatus($id) { $statuses = $this->getStatuses([$id]); - return isset($statuses[$id]) ? $statuses[$id] : []; + return $statuses[$id] ?? []; } /** diff --git a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php index a75a9c7c27304c5132164b9d127b17214f7b6af9..3435c7ddae6f2211228cf12724bae8bb1090bbcf 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php @@ -986,7 +986,7 @@ class Virtua extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterfa $tag = $subfield['tag']; $sort = explode('.', $subfield['data']); $sort_rule = $sort[0]; - $sort_order = isset($sort[1]) ? $sort[1] : 0; + $sort_order = $sort[1] ?? 0; $sort_order = sprintf("%05d", $sort_order); } else { // Everything else goes in the data bucket diff --git a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php index 8c710f8a1f4bd447937c0ce4eb958f09b2d7ef20..10c9159d2eb71990dd8a90bc15e9f1850ff3e8fa 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php @@ -488,9 +488,7 @@ class Voyager extends AbstractBase 'reserve' => $row['ON_RESERVE'], 'callnumber' => $row['CALLNUMBER'], 'item_sort_seq' => $row['ITEM_SEQUENCE_NUMBER'], - 'sort_seq' => isset($row['SORT_SEQ']) - ? $row['SORT_SEQ'] - : PHP_INT_MAX + 'sort_seq' => $row['SORT_SEQ'] ?? PHP_INT_MAX ]; } else { $statusFound = in_array( @@ -775,8 +773,7 @@ EOT; // Concat wrapped rows (MARC data more than 300 bytes gets split // into multiple rows) - $rowId = isset($row['ITEM_ID']) - ? $row['ITEM_ID'] : 'MFHD' . $row['MFHD_ID']; + $rowId = $row['ITEM_ID'] ?? 'MFHD' . $row['MFHD_ID']; if (isset($data[$rowId][$number])) { // We don't want to concatenate the same MARC information to // itself over and over due to a record with multiple status @@ -1019,9 +1016,7 @@ EOT; 'use_unknown_message' => in_array('No information available', $sqlRow['STATUS_ARRAY']), 'item_sort_seq' => $sqlRow['ITEM_SEQUENCE_NUMBER'], - 'sort_seq' => isset($sqlRow['SORT_SEQ']) - ? $sqlRow['SORT_SEQ'] - : PHP_INT_MAX + 'sort_seq' => $sqlRow['SORT_SEQ'] ?? PHP_INT_MAX ]; } @@ -1076,8 +1071,7 @@ EOT; ); } - $requests_placed = isset($row['HOLDS_PLACED']) - ? $row['HOLDS_PLACED'] : 0; + $requests_placed = $row['HOLDS_PLACED'] ?? 0; if (isset($row['RECALLS_PLACED'])) { $requests_placed += $row['RECALLS_PLACED']; } diff --git a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php index b14a77097e69a83ddb71f98c1af9ba9b2018a534..4185cf830efd75d2951be166b42e4643bbf44c1a 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php +++ b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php @@ -589,11 +589,11 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte */ public function checkRequestIsValid($id, $data, $patron) { - $holdType = isset($data['holdtype']) ? $data['holdtype'] : 'auto'; - $level = isset($data['level']) ? $data['level'] : 'copy'; + $holdType = $data['holdtype'] ?? 'auto'; + $level = $data['level'] ?? 'copy'; $mode = ('title' == $level) ? $this->titleHoldsMode : $this->holdsMode; if ('driver' == $mode && 'auto' == $holdType) { - $itemID = isset($data['item_id']) ? $data['item_id'] : false; + $itemID = $data['item_id'] ?? false; $result = $this->determineHoldType($patron['id'], $id, $itemID); if (!$result) { return false; @@ -629,7 +629,7 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte return false; } - $level = isset($data['level']) ? $data['level'] : 'copy'; + $level = $data['level'] ?? 'copy'; $itemID = ($level != 'title' && isset($data['item_id'])) ? $data['item_id'] : false; @@ -1915,8 +1915,7 @@ EOT; continue 2; } foreach ($copyFields as $field) { - $hold[$field] = isset($apiHold[$field]) - ? $apiHold[$field] : ''; + $hold[$field] = $apiHold[$field] ?? ''; } break; } @@ -1948,8 +1947,8 @@ EOT; ? $holdDetails['level'] : 'copy'; $pickUpLocation = !empty($holdDetails['pickUpLocation']) ? $holdDetails['pickUpLocation'] : $this->defaultPickUpLocation; - $itemId = isset($holdDetails['item_id']) ? $holdDetails['item_id'] : false; - $comment = isset($holdDetails['comment']) ? $holdDetails['comment'] : ''; + $itemId = $holdDetails['item_id'] ?? false; + $comment = $holdDetails['comment'] ?? ''; $bibId = $holdDetails['id']; // Request was initiated before patron was logged in - @@ -2002,8 +2001,7 @@ EOT; if ($this->checkItemsExist) { $exist = $this->itemsExist( $bibId, - isset($holdDetails['requestGroupId']) - ? $holdDetails['requestGroupId'] : null + $holdDetails['requestGroupId'] ?? null ); if (!$exist) { return $this->holdError('hold_no_items'); @@ -2022,8 +2020,7 @@ EOT; ) { $available = $this->itemsAvailable( $bibId, - isset($holdDetails['requestGroupId']) - ? $holdDetails['requestGroupId'] : null + $holdDetails['requestGroupId'] ?? null ); if ($available) { return $this->holdError('hold_items_available'); @@ -2159,9 +2156,7 @@ EOT; */ public function getRenewDetails($checkOutDetails) { - $renewDetails = (isset($checkOutDetails['institution_dbkey']) - ? $checkOutDetails['institution_dbkey'] - : '') + $renewDetails = ($checkOutDetails['institution_dbkey'] ?? '') . '|' . $checkOutDetails['item_id']; return $renewDetails; } @@ -2469,9 +2464,9 @@ EOT; $patron = $details['patron']; $level = isset($details['level']) && !empty($details['level']) ? $details['level'] : 'copy'; - $itemId = isset($details['item_id']) ? $details['item_id'] : false; - $mfhdId = isset($details['holdings_id']) ? $details['holdings_id'] : false; - $comment = isset($details['comment']) ? $details['comment'] : ''; + $itemId = $details['item_id'] ?? false; + $mfhdId = $details['holdings_id'] ?? false; + $comment = $details['comment'] ?? ''; $bibId = $details['id']; // Make Sure Pick Up Location is Valid @@ -2637,10 +2632,7 @@ EOT; public function getCancelStorageRetrievalRequestDetails($details) { $details - = (isset($details['institution_dbkey']) - ? $details['institution_dbkey'] - : '' - ) + = ($details['institution_dbkey'] ?? '') . '|' . $details['item_id'] . '|' . $details['reqnum']; return $details; @@ -2856,7 +2848,7 @@ EOT; return false; } - $level = isset($data['level']) ? $data['level'] : 'copy'; + $level = $data['level'] ?? 'copy'; $itemID = ($level != 'title' && isset($data['item_id'])) ? $data['item_id'] : false; @@ -3025,7 +3017,7 @@ EOT; $pickupLibrary = $this->encodeXML($details['pickUpLibrary']); $itemId = $this->encodeXML($details['item_id'] . '.' . $details['id']); $comment = $this->encodeXML( - isset($details['comment']) ? $details['comment'] : '' + $details['comment'] ?? '' ); $bibId = $this->encodeXML($details['id']); $bibDbName = $this->encodeXML($this->config['Catalog']['database']); @@ -3241,9 +3233,7 @@ EOT; */ public function getCancelILLRequestDetails($details) { - $details = (isset($details['institution_dbkey']) - ? $details['institution_dbkey'] - : '') + $details = ($details['institution_dbkey'] ?? '') . '|' . $details['item_id'] . '|' . $details['type'] . '|' . $details['reqnum']; diff --git a/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php b/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php index 826bb5339d04e265335e783d50e1a15793d3de75..877729cf0e1e95c6e2b3e46a3a151d882e2f0bfd 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php +++ b/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php @@ -896,10 +896,10 @@ class XCNCIP2 extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf return [ 'firstname' => (string)$first[0], 'lastname' => (string)$last[0], - 'address1' => isset($address[0]) ? $address[0] : '', - 'address2' => (isset($address[1]) ? $address[1] : '') . + 'address1' => $address[0] ?? '', + 'address2' => ($address[1] ?? '') . (isset($address[2]) ? ', ' . $address[2] : ''), - 'zip' => isset($address[3]) ? $address[3] : '', + 'zip' => $address[3] ?? '', 'phone' => '', // TODO: phone number support 'group' => '' ]; diff --git a/module/VuFind/src/VuFind/ILS/Logic/Holds.php b/module/VuFind/src/VuFind/ILS/Logic/Holds.php index 8e2c767d0e450e58b8316c6d0de8d8caad5bc82f..06e5bd1ad6fe97184bc1bce29d50b9cce472ce9e 100644 --- a/module/VuFind/src/VuFind/ILS/Logic/Holds.php +++ b/module/VuFind/src/VuFind/ILS/Logic/Holds.php @@ -121,10 +121,8 @@ class Holds foreach ($holdings as $groupKey => $items) { $retVal[$groupKey] = [ 'items' => $items, - 'location' => isset($items[0]['location']) - ? $items[0]['location'] : '', - 'locationhref' => isset($items[0]['locationhref']) - ? $items[0]['locationhref'] : '' + 'location' => $items[0]['location'] ?? '', + 'locationhref' => $items[0]['locationhref'] ?? '' ]; // Copy all text fields from the item to the holdings level foreach ($items as $item) { @@ -523,8 +521,7 @@ class Holds // Build Params return [ 'action' => $action, 'record' => $details['id'], - 'source' => isset($details['source']) - ? $details['source'] : DEFAULT_SEARCH_BACKEND, + 'source' => $details['source'] ?? DEFAULT_SEARCH_BACKEND, 'query' => $queryString, 'anchor' => "#tabnav" ]; } diff --git a/module/VuFind/src/VuFind/Log/LoggerFactory.php b/module/VuFind/src/VuFind/Log/LoggerFactory.php index 56279dd6723a4dcc048e7158521a1ba43f585913..74676182f6152942919e7b5e9dc4a7dae2952a0d 100644 --- a/module/VuFind/src/VuFind/Log/LoggerFactory.php +++ b/module/VuFind/src/VuFind/Log/LoggerFactory.php @@ -59,7 +59,7 @@ class LoggerFactory implements FactoryInterface ) { $parts = explode(':', $config); $table_name = $parts[0]; - $error_types = isset($parts[1]) ? $parts[1] : ''; + $error_types = $parts[1] ?? ''; $columnMapping = [ 'priority' => 'priority', @@ -93,7 +93,7 @@ class LoggerFactory implements FactoryInterface // general mailer: $parts = explode(':', $config->Logging->email); $email = $parts[0]; - $error_types = isset($parts[1]) ? $parts[1] : ''; + $error_types = $parts[1] ?? ''; // use smtp $mailer = $container->get('VuFind\Mailer\Mailer'); @@ -120,7 +120,7 @@ class LoggerFactory implements FactoryInterface { $parts = explode(':', $config); $file = $parts[0]; - $error_types = isset($parts[1]) ? $parts[1] : ''; + $error_types = $parts[1] ?? ''; // Make Writers $filters = explode(',', $error_types); @@ -268,7 +268,7 @@ class LoggerFactory implements FactoryInterface foreach ($filters as $filter) { $parts = explode('-', $filter); $priority = $parts[0]; - $verbosity = isset($parts[1]) ? $parts[1] : false; + $verbosity = $parts[1] ?? false; // VuFind's configuration provides four priority options, each // combining two of the standard Zend levels. diff --git a/module/VuFind/src/VuFind/OAI/Server.php b/module/VuFind/src/VuFind/OAI/Server.php index ca6a692822361bc644aa55cc03aa55cdc94534d0..11962ccb8465694eab512647e00e79149a7df544 100644 --- a/module/VuFind/src/VuFind/OAI/Server.php +++ b/module/VuFind/src/VuFind/OAI/Server.php @@ -600,7 +600,7 @@ class Server // Get non-deleted records from the Solr index: $result = $this->listRecordsGetNonDeleted( $from, $until, $solrOffset, $solrLimit, - isset($params['set']) ? $params['set'] : '' + $params['set'] ?? '' ); $nonDeletedCount = $result->getResultTotal(); $format = $params['metadataPrefix']; diff --git a/module/VuFind/src/VuFind/Recommend/AbstractSummonRecommendDeferred.php b/module/VuFind/src/VuFind/Recommend/AbstractSummonRecommendDeferred.php index b40561eafbfc3beefcfcd9b48acd0cfc5b8d817a..36d28d50934b17e9d64b93943abbf5c0912ad8f0 100644 --- a/module/VuFind/src/VuFind/Recommend/AbstractSummonRecommendDeferred.php +++ b/module/VuFind/src/VuFind/Recommend/AbstractSummonRecommendDeferred.php @@ -113,7 +113,7 @@ class AbstractSummonRecommendDeferred implements RecommendInterface // with a blank string, so we can rebuild the parameters to pass through // AJAX later on! for ($i = 0; $i < $this->paramCount; $i++) { - $settings[$i] = isset($settings[$i]) ? $settings[$i] : ''; + $settings[$i] = $settings[$i] ?? ''; } // Collect the best possible search term(s): diff --git a/module/VuFind/src/VuFind/Recommend/DOI.php b/module/VuFind/src/VuFind/Recommend/DOI.php index f282a25dc5584a14710c368a8d32d901104af85f..3160f8598c2284562f275f91d73a8b4d46b6ca23 100644 --- a/module/VuFind/src/VuFind/Recommend/DOI.php +++ b/module/VuFind/src/VuFind/Recommend/DOI.php @@ -104,7 +104,7 @@ class DOI implements RecommendInterface { $query = $results->getParams()->getDisplayQuery(); preg_match('|10\.[^\s/]{4,}/[^\s]{1,}|', $query, $matches); - $this->match = isset($matches[0]) ? $matches[0] : null; + $this->match = $matches[0] ?? null; $this->exact = (null !== $this->match) && ($this->match === $query); } diff --git a/module/VuFind/src/VuFind/Recommend/EuropeanaResultsDeferred.php b/module/VuFind/src/VuFind/Recommend/EuropeanaResultsDeferred.php index 768335db2a7462775525d4d87a2c9e3629b4a89d..471ddd905004c357bb28e739004b164cbc235c99 100644 --- a/module/VuFind/src/VuFind/Recommend/EuropeanaResultsDeferred.php +++ b/module/VuFind/src/VuFind/Recommend/EuropeanaResultsDeferred.php @@ -96,7 +96,7 @@ class EuropeanaResultsDeferred implements RecommendInterface // with a blank string, so we can rebuild the parameters to pass through // AJAX later on! for ($i = 0; $i < 4; $i++) { - $settings[$i] = isset($settings[$i]) ? $settings[$i] : ''; + $settings[$i] = $settings[$i] ?? ''; } // Collect the best possible search term(s): diff --git a/module/VuFind/src/VuFind/Recommend/ExpandFacets.php b/module/VuFind/src/VuFind/Recommend/ExpandFacets.php index 19c310a24852a2802674ea85bad19d1a044f91eb..bb580aadbf12ceaac163e50ef829e8f3d2ec7388 100644 --- a/module/VuFind/src/VuFind/Recommend/ExpandFacets.php +++ b/module/VuFind/src/VuFind/Recommend/ExpandFacets.php @@ -102,7 +102,7 @@ class ExpandFacets implements RecommendInterface // Parse the additional settings: $settings = explode(':', $settings); $mainSection = empty($settings[0]) ? 'Results' : $settings[0]; - $iniName = isset($settings[1]) ? $settings[1] : 'facets'; + $iniName = $settings[1] ?? 'facets'; // Load the desired facet information... $config = $this->configLoader->get($iniName); diff --git a/module/VuFind/src/VuFind/Recommend/Libraryh3lp.php b/module/VuFind/src/VuFind/Recommend/Libraryh3lp.php index f42319204cadbb5e4235bde2eddefab51687f17f..4322ecc0d3bf3f8aad57af52f30e417265c6788c 100644 --- a/module/VuFind/src/VuFind/Recommend/Libraryh3lp.php +++ b/module/VuFind/src/VuFind/Recommend/Libraryh3lp.php @@ -69,7 +69,7 @@ class Libraryh3lp implements RecommendInterface $this->chatId = $params[0] === 'user' ? $params[1] . '@libraryh3lp.com' // user : $params[1] . '@chat.libraryh3lp.com'; // queue - $this->skin = isset($params[2]) ? $params[2] : 11977; + $this->skin = $params[2] ?? 11977; } /** diff --git a/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjectsDeferred.php b/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjectsDeferred.php index c3a6121f946dabb411756ab82c9813cdbafd08dd..5b29d18225fc6374355394cd154de1a8d425f3bf 100644 --- a/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjectsDeferred.php +++ b/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjectsDeferred.php @@ -91,7 +91,7 @@ class OpenLibrarySubjectsDeferred extends OpenLibrarySubjects // Make sure all elements of the params array are filled in, even if just // with a blank string, so we can rebuild the parameters to pass through // AJAX later on! - $settings[1] = isset($settings[1]) ? $settings[1] : ''; + $settings[1] = $settings[1] ?? ''; // If Publication Date filter is to be applied, get the range and add it to // $settings since the $searchObject will not be available after the AJAX diff --git a/module/VuFind/src/VuFind/Recommend/SideFacets.php b/module/VuFind/src/VuFind/Recommend/SideFacets.php index f3ec9a9bb21d3910e8e1404897f2a7654246b352..1fb1d4248c679e00020af0f1e32a27903c77c9ad 100644 --- a/module/VuFind/src/VuFind/Recommend/SideFacets.php +++ b/module/VuFind/src/VuFind/Recommend/SideFacets.php @@ -154,8 +154,8 @@ class SideFacets extends AbstractFacets // Parse the additional settings: $settings = explode(':', $settings); $mainSection = empty($settings[0]) ? 'Results' : $settings[0]; - $checkboxSection = isset($settings[1]) ? $settings[1] : false; - $iniName = isset($settings[2]) ? $settings[2] : 'facets'; + $checkboxSection = $settings[1] ?? false; + $iniName = $settings[2] ?? 'facets'; // Load the desired facet information... $config = $this->configLoader->get($iniName); diff --git a/module/VuFind/src/VuFind/Recommend/SwitchType.php b/module/VuFind/src/VuFind/Recommend/SwitchType.php index 632fb06d1e15091a8e1a82ab40511f003dabe3f7..4043c3b1e25b88cf84e3f102965a1e30070b6a7b 100644 --- a/module/VuFind/src/VuFind/Recommend/SwitchType.php +++ b/module/VuFind/src/VuFind/Recommend/SwitchType.php @@ -81,7 +81,7 @@ class SwitchType implements RecommendInterface { $params = explode(':', $settings); $this->newHandler = !empty($params[0]) ? $params[0] : 'AllFields'; - $this->newHandlerName = isset($params[1]) ? $params[1] : 'All Fields'; + $this->newHandlerName = $params[1] ?? 'All Fields'; } /** diff --git a/module/VuFind/src/VuFind/Recommend/TopFacets.php b/module/VuFind/src/VuFind/Recommend/TopFacets.php index ba055512c759e9a5f7e2de2be601063c30dc7ddf..c1773817b211a2bb692463c49d03d15dfbf38b80 100644 --- a/module/VuFind/src/VuFind/Recommend/TopFacets.php +++ b/module/VuFind/src/VuFind/Recommend/TopFacets.php @@ -71,7 +71,7 @@ class TopFacets extends AbstractFacets { $settings = explode(':', $settings); $mainSection = empty($settings[0]) ? 'ResultsTop' : $settings[0]; - $iniName = isset($settings[1]) ? $settings[1] : 'facets'; + $iniName = $settings[1] ?? 'facets'; // Load the desired facet information: $config = $this->configLoader->get($iniName); diff --git a/module/VuFind/src/VuFind/Recommend/VisualFacets.php b/module/VuFind/src/VuFind/Recommend/VisualFacets.php index 9e119facc6ffae616f15b599ed59e6b21f937be8..f760ab8bb22bd5eeddd500cc289008d5e1e95445 100644 --- a/module/VuFind/src/VuFind/Recommend/VisualFacets.php +++ b/module/VuFind/src/VuFind/Recommend/VisualFacets.php @@ -66,7 +66,7 @@ class VisualFacets extends AbstractFacets { $settings = explode(':', $settings); $mainSection = empty($settings[0]) ? 'Visual_Settings' : $settings[0]; - $iniName = isset($settings[1]) ? $settings[1] : 'facets'; + $iniName = $settings[1] ?? 'facets'; // Load the desired facet information: $config = $this->configLoader->get($iniName); diff --git a/module/VuFind/src/VuFind/Record/Loader.php b/module/VuFind/src/VuFind/Record/Loader.php index 8343f42dcf666768c6b188f1e39fc469eb66f7b9..46c08aba6e516a6c44226d5ac09d15b3b92f726d 100644 --- a/module/VuFind/src/VuFind/Record/Loader.php +++ b/module/VuFind/src/VuFind/Record/Loader.php @@ -254,8 +254,7 @@ class Loader implements \Zend\Log\LoggerAwareInterface // objects: foreach ($ids as $i => $details) { if (!isset($retVal[$i]) || !is_object($retVal[$i])) { - $fields = isset($details['extra_fields']) - ? $details['extra_fields'] : []; + $fields = $details['extra_fields'] ?? []; $fields['id'] = $details['id']; $retVal[$i] = $this->recordFactory->get('Missing'); $retVal[$i]->setRawData($fields); diff --git a/module/VuFind/src/VuFind/RecordDriver/AbstractBase.php b/module/VuFind/src/VuFind/RecordDriver/AbstractBase.php index 4d3603b41ff967bdbd92a5e8dbedc9c462d6195f..915ef60d9bf10d4c8bb0e2d2d13a481c51a5dedb 100644 --- a/module/VuFind/src/VuFind/RecordDriver/AbstractBase.php +++ b/module/VuFind/src/VuFind/RecordDriver/AbstractBase.php @@ -319,7 +319,7 @@ abstract class AbstractBase implements \VuFind\Db\Table\DbTableAwareInterface, foreach ($types as $current) { $parts = explode(':', $current); $type = $parts[0]; - $params = isset($parts[1]) ? $parts[1] : null; + $params = $parts[1] ?? null; if ($factory->has($type)) { $plugin = $factory->get($type); $plugin->init($params, $this); diff --git a/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php b/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php index 9ecfa99aa666b4aa139bf013f140745019f52b64..7348aacacd876f14e3e2d0d0d9955a940a7d3dc3 100644 --- a/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php +++ b/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php @@ -223,7 +223,7 @@ class DefaultRecord extends AbstractBase public function getCallNumber() { $all = $this->getCallNumbers(); - return isset($all[0]) ? $all[0] : ''; + return $all[0] ?? ''; } /** @@ -483,8 +483,7 @@ class DefaultRecord extends AbstractBase // applicable: $authors = []; foreach ($this->getPrimaryAuthors() as $author) { - $authors[] = isset($highlights[$author]) - ? $highlights[$author] : $author; + $authors[] = $highlights[$author] ?? $author; } return $authors; } @@ -931,7 +930,7 @@ class DefaultRecord extends AbstractBase public function getPrimaryAuthor() { $authors = $this->getPrimaryAuthors(); - return isset($authors[0]) ? $authors[0] : ''; + return $authors[0] ?? ''; } /** @@ -1008,9 +1007,9 @@ class DefaultRecord extends AbstractBase // Build objects to represent each set of data; these will // transform seamlessly into strings in the view layer. $retval[] = new Response\PublicationDetails( - isset($places[$i]) ? $places[$i] : '', - isset($names[$i]) ? $names[$i] : '', - isset($dates[$i]) ? $dates[$i] : '' + $places[$i] ?? '', + $names[$i] ?? '', + $dates[$i] ?? '' ); $i++; } diff --git a/module/VuFind/src/VuFind/RecordDriver/EDS.php b/module/VuFind/src/VuFind/RecordDriver/EDS.php index 428800e2e2fd7bc96882f914806ec214371e4a16..aecf1d05069ea2cafb381f5ff8ec8a2f9ccfa98d 100644 --- a/module/VuFind/src/VuFind/RecordDriver/EDS.php +++ b/module/VuFind/src/VuFind/RecordDriver/EDS.php @@ -199,8 +199,8 @@ class EDS extends DefaultRecord if (isset($this->fields['Items']) && !empty($this->fields['Items'])) { foreach ($this->fields['Items'] as $item) { $items[] = [ - 'Label' => isset($item['Label']) ? $item['Label'] : '', - 'Group' => isset($item['Group']) ? $item['Group'] : '', + 'Label' => $item['Label'] ?? '', + 'Group' => $item['Group'] ?? '', 'Data' => isset($item['Data']) ? $this->toHTML($item['Data'], $item['Group']) : '' ]; diff --git a/module/VuFind/src/VuFind/RecordTab/Map.php b/module/VuFind/src/VuFind/RecordTab/Map.php index 44cd1025efe8835191a26269011c3fb61cb86686..74eaadfba2279e04f9b789de10218d8ca90e7f34 100644 --- a/module/VuFind/src/VuFind/RecordTab/Map.php +++ b/module/VuFind/src/VuFind/RecordTab/Map.php @@ -270,8 +270,7 @@ class Map extends AbstractBase $coordmatch = implode('', explode(' ', $val)); /* See if coordinate string matches lookup table coordinates and if so return label */ - $labelname = isset($label_lookup[$coordmatch]) - ? $label_lookup[$coordmatch] : ''; + $labelname = $label_lookup[$coordmatch] ?? ''; array_push($labels, $labelname); } } diff --git a/module/VuFind/src/VuFind/SMS/Clickatell.php b/module/VuFind/src/VuFind/SMS/Clickatell.php index 318ba8fdd1839b63ea6c74fd45ff7b8d42b06bd9..050f6794c98f8c1fee99941008f198a2ac6952b2 100644 --- a/module/VuFind/src/VuFind/SMS/Clickatell.php +++ b/module/VuFind/src/VuFind/SMS/Clickatell.php @@ -57,8 +57,7 @@ class Clickatell extends AbstractBase public function __construct(\Zend\Config\Config $config, $options = []) { parent::__construct($config, $options); - $this->client = isset($options['client']) - ? $options['client'] : new \Zend\Http\Client(); + $this->client = $options['client'] ?? new \Zend\Http\Client(); } /** diff --git a/module/VuFind/src/VuFind/SMS/Mailer.php b/module/VuFind/src/VuFind/SMS/Mailer.php index de15d438959e5db95d45372aef0794e05908e3d7..48c1928908a03a853f95cc67b88f4e5852f23fc4 100644 --- a/module/VuFind/src/VuFind/SMS/Mailer.php +++ b/module/VuFind/src/VuFind/SMS/Mailer.php @@ -94,7 +94,7 @@ class Mailer extends AbstractBase // Load default "from" address: $this->defaultFrom - = isset($options['defaultFrom']) ? $options['defaultFrom'] : ''; + = $options['defaultFrom'] ?? ''; // Make sure mailer dependency has been injected: if (!isset($options['mailer']) diff --git a/module/VuFind/src/VuFind/Search/EDS/Options.php b/module/VuFind/src/VuFind/Search/EDS/Options.php index 031c09d6059ddb41762707a573910ed0a5e6fba4..bfd866933f2d700b2bee47c490a54c587263b58e 100644 --- a/module/VuFind/src/VuFind/Search/EDS/Options.php +++ b/module/VuFind/src/VuFind/Search/EDS/Options.php @@ -500,8 +500,7 @@ class Options extends \VuFind\Search\Base\Options $limiter['LimiterValues'] ) : [['Value' => $val]], - 'DefaultOn' => isset($limiter['DefaultOn']) - ? $limiter['DefaultOn'] : 'n', + 'DefaultOn' => $limiter['DefaultOn'] ?? 'n', ]; } } diff --git a/module/VuFind/src/VuFind/Search/EDS/Results.php b/module/VuFind/src/VuFind/Search/EDS/Results.php index eb5c8776dc1840963e76203aebfccaf9120e84b2..f7bcec5bd433bdf3c5d3bbb01cbe6be8dcd3e4b2 100644 --- a/module/VuFind/src/VuFind/Search/EDS/Results.php +++ b/module/VuFind/src/VuFind/Search/EDS/Results.php @@ -124,8 +124,7 @@ class Results extends \VuFind\Search\Base\Results // present in the filter list? Second, is the current value // an active filter for the current field? $orField = '~' . $field; - $itemsToCheck = isset($filterList[$field]) - ? $filterList[$field] : []; + $itemsToCheck = $filterList[$field] ?? []; if (isset($filterList[$orField])) { $itemsToCheck += $filterList[$orField]; } @@ -149,8 +148,7 @@ class Results extends \VuFind\Search\Base\Results = $facetDetails['value']; } // The EDS API returns facets in the order they should be displayed - $current['label'] = isset($filter[$field]) - ? $filter[$field] : $field; + $current['label'] = $filter[$field] ?? $field; // Create a reference to counts called list for consistency with // Solr output format -- this allows the facet recommendations diff --git a/module/VuFind/src/VuFind/Search/Favorites/Results.php b/module/VuFind/src/VuFind/Search/Favorites/Results.php index 0b8ae6de3f5cfa6beab1fbd29a74626f6bb70031..d809b4ccfa1346c718d702179b9080f60ee249de 100644 --- a/module/VuFind/src/VuFind/Search/Favorites/Results.php +++ b/module/VuFind/src/VuFind/Search/Favorites/Results.php @@ -223,7 +223,7 @@ class Results extends BaseResults protected function getTagFilters() { $filters = $this->getParams()->getFilters(); - return isset($filters['tags']) ? $filters['tags'] : []; + return $filters['tags'] ?? []; } /** @@ -239,7 +239,7 @@ class Results extends BaseResults // Check the filters for a list ID, and load the corresponding object // if one is found: $filters = $this->getParams()->getFilters(); - $listId = isset($filters['lists'][0]) ? $filters['lists'][0] : null; + $listId = $filters['lists'][0] ?? null; $this->list = (null === $listId) ? null : $this->listTable->getExisting($listId); } diff --git a/module/VuFind/src/VuFind/Search/QueryAdapter.php b/module/VuFind/src/VuFind/Search/QueryAdapter.php index 80b178b75f004c77ce311d3c8a557bf881cb135f..2eb56c27719f3d291537d5c918ea84c2acd848ae 100644 --- a/module/VuFind/src/VuFind/Search/QueryAdapter.php +++ b/module/VuFind/src/VuFind/Search/QueryAdapter.php @@ -58,9 +58,9 @@ abstract class QueryAdapter { // Use array_key_exists since null is also valid if (array_key_exists('l', $search)) { - $handler = isset($search['i']) ? $search['i'] : $search['f']; + $handler = $search['i'] ?? $search['f']; return new Query( - $search['l'], $handler, isset($search['o']) ? $search['o'] : null + $search['l'], $handler, $search['o'] ?? null ); } elseif (isset($search['g'])) { $operator = $search['g'][0]['b']; @@ -193,7 +193,7 @@ abstract class QueryAdapter // Add term to this group $boolArr = $request->get("bool$groupId"); - $lastBool = isset($boolArr[0]) ? $boolArr[0] : 'AND'; + $lastBool = $boolArr[0] ?? 'AND'; $group[] = new Query($value[$i], $handler, $operator); } } diff --git a/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php b/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php index 3ea9d6cb32a8db3888318d1d6937319aaf52957a..bde36ec2cd19e64ae69a0208e12272e7f3796497 100644 --- a/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php +++ b/module/VuFind/src/VuFind/Search/Solr/DeduplicationListener.php @@ -238,7 +238,7 @@ class DeduplicationListener } $dedupData[$source] = [ 'id' => $localId, - 'priority' => isset($localPriority) ? $localPriority : 99999 + 'priority' => $localPriority ?? 99999 ]; } $fields['dedup_id'] = $dedupId; diff --git a/module/VuFind/src/VuFind/Search/Solr/Params.php b/module/VuFind/src/VuFind/Search/Solr/Params.php index c369b0f66054dad8153a5eb58603474eac8b15bf..c95c202cfe7d6549e3a6802ce6520d2f1688498b 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Params.php +++ b/module/VuFind/src/VuFind/Search/Solr/Params.php @@ -167,8 +167,7 @@ class Params extends \VuFind\Search\Base\Params $q = $field . ':"' . addcslashes($value, '"\\') . '"'; } if ($orFacet) { - $orFilters[$field] = isset($orFilters[$field]) - ? $orFilters[$field] : []; + $orFilters[$field] = $orFilters[$field] ?? []; $orFilters[$field][] = $q; } else { $filterQuery[] = $q; @@ -631,9 +630,7 @@ class Params extends \VuFind\Search\Base\Params } } elseif ($this->facetHelper && in_array($field, $hierarchicalFacets)) { // Display hierarchical facet levels nicely - $separator = isset($hierarchicalFacetSeparators[$field]) - ? $hierarchicalFacetSeparators[$field] - : '/'; + $separator = $hierarchicalFacetSeparators[$field] ?? '/'; $filter['displayText'] = $this->facetHelper->formatDisplayText( $filter['displayText'], true, $separator ); diff --git a/module/VuFind/src/VuFind/Search/Solr/Results.php b/module/VuFind/src/VuFind/Search/Solr/Results.php index ad13f42a148b545d9c0c61fe989dd0ea7a0b51ad..bd87df9d60aaa5a07afa476e6104eada7d20cd50 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Results.php +++ b/module/VuFind/src/VuFind/Search/Solr/Results.php @@ -243,7 +243,7 @@ class Results extends \VuFind\Search\Base\Results $fieldFacets = $this->responseFacets->getFieldFacets(); $translatedFacets = $this->getOptions()->getTranslatedFacets(); foreach (array_keys($filter) as $field) { - $data = isset($fieldFacets[$field]) ? $fieldFacets[$field] : []; + $data = $fieldFacets[$field] ?? []; // Skip empty arrays: if (count($data) < 1) { continue; diff --git a/module/VuFind/src/VuFind/Search/Summon/Params.php b/module/VuFind/src/VuFind/Search/Summon/Params.php index 93812bb02db83ba511da96fcbe63e28c7a2d85d7..66327623ab7820a0935a2275e346c030ccd1c55a 100644 --- a/module/VuFind/src/VuFind/Search/Summon/Params.php +++ b/module/VuFind/src/VuFind/Search/Summon/Params.php @@ -225,12 +225,12 @@ class Params extends \VuFind\Search\Base\Params // if not, override them with defaults. $parts = explode(',', $facet); $facetName = $parts[0]; - $bestDefaultFacetLimit = isset($fieldSpecificLimits->$facetName) - ? $fieldSpecificLimits->$facetName : $defaultFacetLimit; + $bestDefaultFacetLimit + = $fieldSpecificLimits->$facetName ?? $defaultFacetLimit; $defaultMode = ($this->getFacetOperator($facet) == 'OR') ? 'or' : 'and'; - $facetMode = isset($parts[1]) ? $parts[1] : $defaultMode; - $facetPage = isset($parts[2]) ? $parts[2] : 1; - $facetLimit = isset($parts[3]) ? $parts[3] : $bestDefaultFacetLimit; + $facetMode = $parts[1] ?? $defaultMode; + $facetPage = $parts[2] ?? 1; + $facetLimit = $parts[3] ?? $bestDefaultFacetLimit; $facetParams = "{$facetMode},{$facetPage},{$facetLimit}"; $finalFacets[] = "{$facetName},{$facetParams}"; } @@ -287,8 +287,7 @@ class Params extends \VuFind\Search\Base\Params ->add('rangeFilters', "{$filt['field']},{$from}:{$to}"); } elseif ($filt['operator'] == 'OR') { // Special case -- OR facets: - $orFacets[$filt['field']] = isset($orFacets[$filt['field']]) - ? $orFacets[$filt['field']] : []; + $orFacets[$filt['field']] = $orFacets[$filt['field']] ?? []; $orFacets[$filt['field']][] = $safeValue; } else { // Standard case: diff --git a/module/VuFind/src/VuFind/Search/Summon/Results.php b/module/VuFind/src/VuFind/Search/Summon/Results.php index 4397b7b3b6abcb47511b9a9ae15dca3ba066973c..2fae00f1e2aa44f381c5e3344de1dac53a531caf 100644 --- a/module/VuFind/src/VuFind/Search/Summon/Results.php +++ b/module/VuFind/src/VuFind/Search/Summon/Results.php @@ -229,8 +229,7 @@ class Results extends \VuFind\Search\Base\Results // present in the filter list? Second, is the current value // an active filter for the current field? $orField = '~' . $field; - $itemsToCheck = isset($filterList[$field]) - ? $filterList[$field] : []; + $itemsToCheck = $filterList[$field] ?? []; if (isset($filterList[$orField])) { $itemsToCheck += $filterList[$orField]; } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Citation.php b/module/VuFind/src/VuFind/View/Helper/Root/Citation.php index e4ff42c650d97e0096442af0f553114471aea465..df6f221af12a722b979d8d98fcbd84df93da8f2c 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Citation.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Citation.php @@ -120,9 +120,9 @@ class Citation extends \Zend\View\Helper\AbstractHelper $this->details = [ 'authors' => $this->prepareAuthors($authors), 'title' => trim($title), 'subtitle' => trim($subtitle), - 'pubPlace' => isset($pubPlaces[0]) ? $pubPlaces[0] : null, - 'pubName' => isset($publishers[0]) ? $publishers[0] : null, - 'pubDate' => isset($pubDates[0]) ? $pubDates[0] : null, + 'pubPlace' => $pubPlaces[0] ?? null, + 'pubName' => $publishers[0] ?? null, + 'pubDate' => $pubDates[0] ?? null, 'edition' => empty($edition) ? [] : [$edition], 'journal' => $driver->tryMethod('getContainerTitle') ]; diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Context.php b/module/VuFind/src/VuFind/View/Helper/Root/Context.php index c32b528caac0d4f00dddaf09b6d6f53cd0ed66ca..fa5da33865cf4a64d07e8b1ec005e1f20eeb4f9e 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Context.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Context.php @@ -59,7 +59,7 @@ class Context extends AbstractHelper $oldVars = []; foreach ($vars as $k => $v) { - $oldVars[$k] = isset($view->$k) ? $view->$k : null; + $oldVars[$k] = $view->$k ?? null; $view->$k = $v; } return $oldVars; diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Flashmessages.php b/module/VuFind/src/VuFind/View/Helper/Root/Flashmessages.php index b74e9bf50e4ae244a161727c8538440103a360d2..60e0c82d10018d16cb2dd03011975e481abdef44 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Flashmessages.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Flashmessages.php @@ -105,8 +105,8 @@ class Flashmessages extends AbstractHelper } $helper = $helper ? $this->getView()->plugin($helper) : false; - $tokens = isset($msg['tokens']) ? $msg['tokens'] : []; - $default = isset($msg['default']) ? $msg['default'] : null; + $tokens = $msg['tokens'] ?? []; + $default = $msg['default'] ?? null; $html .= $helper ? $helper($msg['msg'], $tokens, $default) : $msg['msg']; } else { diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Permission.php b/module/VuFind/src/VuFind/View/Helper/Root/Permission.php index 108f0da0656d61488d9433dc522abfcf4f944781..84a32eae6925dbff2f4c55848a7dce2d8dc8f5e5 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Permission.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Permission.php @@ -115,7 +115,7 @@ class Permission extends AbstractHelper $displayLogic = $this->permissionDeniedManager ->getDeniedTemplateBehavior($context); - switch (isset($displayLogic['action']) ? $displayLogic['action'] : '') { + switch ($displayLogic['action'] ?? '') { case 'showMessage': return $this->view->transEsc($displayLogic['value']); case 'showTemplate': diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php b/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php index 90a348fc898441ea3c00b5d441e29fd0f54cda5a..e91fd79709a378b01f49022323b8a36859ab9cce 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php @@ -122,8 +122,7 @@ class Piwik extends \Zend\View\Helper\AbstractHelper } if (is_array($options)) { $this->siteId = $options['siteId']; - $this->searchPrefix = isset($options['searchPrefix']) - ? $options['searchPrefix'] : ''; + $this->searchPrefix = $options['searchPrefix'] ?? ''; } else { $this->siteId = $options; } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Record.php b/module/VuFind/src/VuFind/View/Helper/Root/Record.php index bb9cb38d76bd053f452083edae96d4292d5c6fb1..ef817bc0f65dec3c04870de733a545fa3c533c0c 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Record.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Record.php @@ -648,8 +648,7 @@ class Record extends AbstractHelper // Build URL from route/query details if missing: if (!isset($link['url'])) { - $routeParams = isset($link['routeParams']) - ? $link['routeParams'] : []; + $routeParams = $link['routeParams'] ?? []; $link['url'] = $serverUrlHelper( $urlHelper($link['route'], $routeParams) diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatter.php b/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatter.php index 8524ee8ad8631c681c8a6b2aee68418925718b99..09734f45278cd17efd0e762b2c8611a8b7e94527 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatter.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatter.php @@ -60,8 +60,8 @@ class RecordDataFormatter extends AbstractHelper */ public function specSortCallback($a, $b) { - $posA = isset($a['pos']) ? $a['pos'] : 0; - $posB = isset($b['pos']) ? $b['pos'] : 0; + $posA = $a['pos'] ?? 0; + $posB = $b['pos'] ?? 0; if ($posA === $posB) { return 0; } @@ -87,7 +87,7 @@ class RecordDataFormatter extends AbstractHelper foreach ($spec as $field => $current) { // Extract the relevant data from the driver. $data = $this->extractData($driver, $current); - $allowZero = isset($current['allowZero']) ? $current['allowZero'] : true; + $allowZero = $current['allowZero'] ?? true; if (!empty($data) || ($allowZero && ($data === 0 || $data === '0'))) { // Determine the rendering method to use with the second element // of the current spec. @@ -106,7 +106,7 @@ class RecordDataFormatter extends AbstractHelper ) { $field = call_user_func($current['labelFunction'], $data); } - $context = isset($current['context']) ? $current['context'] : []; + $context = $current['context'] ?? []; $result[$field] = [ 'value' => $text, 'context' => $context @@ -174,7 +174,7 @@ class RecordDataFormatter extends AbstractHelper // If $method is a bool, return it as-is; this allows us to force the // rendering (or non-rendering) of particular data independent of the // record driver. - $method = isset($options['dataMethod']) ? $options['dataMethod'] : false; + $method = $options['dataMethod'] ?? false; if ($method === true || $method === false) { return $method; } @@ -211,7 +211,7 @@ class RecordDataFormatter extends AbstractHelper protected function renderRecordHelper(RecordDriver $driver, $data, array $options ) { - $method = isset($options['helperMethod']) ? $options['helperMethod'] : null; + $method = $options['helperMethod'] ?? null; $plugin = $this->getView()->plugin('record'); if (empty($method) || !is_callable([$plugin, $method])) { throw new \Exception('Cannot call "' . $method . '" on helper.'); @@ -235,7 +235,7 @@ class RecordDataFormatter extends AbstractHelper throw new \Exception('Template option missing.'); } $helper = $this->getView()->plugin('record'); - $context = isset($options['context']) ? $options['context'] : []; + $context = $options['context'] ?? []; $context['driver'] = $driver; $context['data'] = $data; return trim( @@ -277,10 +277,8 @@ class RecordDataFormatter extends AbstractHelper $view = $this->getView(); $escaper = (isset($options['translate']) && $options['translate']) ? $view->plugin('transEsc') : $view->plugin('escapeHtml'); - $transDomain = isset($options['translationTextDomain']) - ? $options['translationTextDomain'] : ''; - $separator = isset($options['separator']) - ? $options['separator'] : '<br />'; + $transDomain = $options['translationTextDomain'] ?? ''; + $separator = $options['separator'] ?? '<br />'; $retVal = ''; $array = (array)$data; $remaining = count($array); @@ -293,8 +291,8 @@ class RecordDataFormatter extends AbstractHelper $retVal .= $separator; } } - return (isset($options['prefix']) ? $options['prefix'] : '') + return ($options['prefix'] ?? '') . $retVal - . (isset($options['suffix']) ? $options['suffix'] : ''); + . ($options['suffix'] ?? ''); } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RecordLink.php b/module/VuFind/src/VuFind/View/Helper/Root/RecordLink.php index f052b2efc781b18918b3cb4cde18b65f3f89d244..9d394128a287da13a51eec1df01da42b5d9e5d8d 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RecordLink.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RecordLink.php @@ -148,8 +148,7 @@ class RecordLink extends \Zend\View\Helper\AbstractHelper { if (is_array($url)) { // Assemble URL string from array parts: - $source = isset($url['source']) - ? $url['source'] : DEFAULT_SEARCH_BACKEND; + $source = $url['source'] ?? DEFAULT_SEARCH_BACKEND; $finalUrl = $this->getActionUrl("{$source}|" . $url['record'], $url['action']); if (isset($url['query'])) { diff --git a/module/VuFind/src/VuFind/XSLT/Import/VuFind.php b/module/VuFind/src/VuFind/XSLT/Import/VuFind.php index e8af8aaab393b915903f56995415375589085a69..d291a3b00f63c8b085badd43d8bce592479a26e6 100644 --- a/module/VuFind/src/VuFind/XSLT/Import/VuFind.php +++ b/module/VuFind/src/VuFind/XSLT/Import/VuFind.php @@ -355,7 +355,7 @@ class VuFind $map[$key] = trim($parts[1]); } } - return isset($map[$in]) ? $map[$in] : $in; + return $map[$in] ?? $in; } /** diff --git a/module/VuFind/src/VuFind/XSLT/Import/VuFindSitemap.php b/module/VuFind/src/VuFind/XSLT/Import/VuFindSitemap.php index 723ab95c14e855e8494fa891ddd81ac8f1fa71b6..1dc3605edfb0469484f28139a36466a217862b3f 100644 --- a/module/VuFind/src/VuFind/XSLT/Import/VuFindSitemap.php +++ b/module/VuFind/src/VuFind/XSLT/Import/VuFindSitemap.php @@ -174,7 +174,7 @@ class VuFindSitemap extends VuFind preg_match_all( '/<meta name="useCount" content="([^"]*)"/ms', $html, $matches ); - $useCount = isset($matches[1][0]) ? $matches[1][0] : 1; + $useCount = $matches[1][0] ?? 1; return [ 'category' => $categories, diff --git a/module/VuFind/src/VuFind/XSLT/Importer.php b/module/VuFind/src/VuFind/XSLT/Importer.php index 99854e425ff5d85a119111ff3d1d17fb8fca0dbd..bba35bad10610c29d34a293cda699f76cc1d0050 100644 --- a/module/VuFind/src/VuFind/XSLT/Importer.php +++ b/module/VuFind/src/VuFind/XSLT/Importer.php @@ -169,8 +169,7 @@ class Importer $classes = is_array($options['General']['custom_class']) ? $options['General']['custom_class'] : [$options['General']['custom_class']]; - $truncate = isset($options['General']['truncate_custom_class']) - ? $options['General']['truncate_custom_class'] : true; + $truncate = $options['General']['truncate_custom_class'] ?? true; foreach ($classes as $class) { // Add a default namespace if none was provided: if (false === strpos($class, '\\')) { diff --git a/module/VuFind/src/VuFindTest/Unit/UserCreationTrait.php b/module/VuFind/src/VuFindTest/Unit/UserCreationTrait.php index 1c25b85d6c8dfd18de13b3cdb00639291e5a0d36..6cfcd3abaa3ac159fef8ce4ffe9008ccd07f43fd 100644 --- a/module/VuFind/src/VuFindTest/Unit/UserCreationTrait.php +++ b/module/VuFind/src/VuFindTest/Unit/UserCreationTrait.php @@ -105,7 +105,7 @@ trait UserCreationTrait foreach ($defaults as $field => $default) { $this->findCssAndSetValue( $page, '#account_' . $field, - isset($overrides[$field]) ? $overrides[$field] : $default + $overrides[$field] ?? $default ); } } diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/TranslateTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/TranslateTest.php index 8b799cd9f177ac5cbc95b59664189131214e5de6..5da2c26f541e68b42ec8a852de7db29aa361d4e5 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/TranslateTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/TranslateTest.php @@ -250,8 +250,7 @@ class TranslateTest extends \PHPUnit\Framework\TestCase protected function getMockTranslator($translations) { $callback = function ($str, $domain) use ($translations) { - return isset($translations[$domain][$str]) - ? $translations[$domain][$str] : $str; + return $translations[$domain][$str] ?? $str; }; $translator = $this->createMock('Zend\I18n\Translator\TranslatorInterface'); $translator->expects($this->any())->method('translate') diff --git a/module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php b/module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php index e51a2609a855aa6a9bbf6b1819d1d0b4c26c5c1d..2c4b57117096691f18de8509e2e6ef85918f02e5 100644 --- a/module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php +++ b/module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php @@ -261,7 +261,7 @@ class SearchApiController extends \VuFind\Controller\AbstractSearch function ($runner, $params, $searchId) use ( $hierarchicalFacets, $request, $requestedFields ) { - foreach (isset($request['facet']) ? $request['facet'] : [] + foreach ($request['facet'] ?? [] as $facet ) { if (!isset($hierarchicalFacets[$facet])) { @@ -269,7 +269,7 @@ class SearchApiController extends \VuFind\Controller\AbstractSearch } } if ($requestedFields) { - $limit = isset($request['limit']) ? $request['limit'] : 20; + $limit = $request['limit'] ?? 20; $params->setLimit($limit); } else { $params->setLimit(0); @@ -297,7 +297,7 @@ class SearchApiController extends \VuFind\Controller\AbstractSearch $response['records'] = $records; } - $requestedFacets = isset($request['facet']) ? $request['facet'] : []; + $requestedFacets = $request['facet'] ?? []; $hierarchicalFacetData = $this->getHierarchicalFacetData( array_intersect($requestedFacets, $hierarchicalFacets) ); diff --git a/module/VuFindApi/src/VuFindApi/Formatter/RecordFormatter.php b/module/VuFindApi/src/VuFindApi/Formatter/RecordFormatter.php index 4f8453327cb04adb548ee0a9636c18de25742ca4..3b1ddfec5a2bfa6721662eb37a680bdd02a31a14 100644 --- a/module/VuFindApi/src/VuFindApi/Formatter/RecordFormatter.php +++ b/module/VuFindApi/src/VuFindApi/Formatter/RecordFormatter.php @@ -114,7 +114,7 @@ class RecordFormatter extends BaseFormatter return $xml; } $rawData = $record->tryMethod('getRawData'); - return isset($rawData['fullrecord']) ? $rawData['fullrecord'] : null; + return $rawData['fullrecord'] ?? null; } /** diff --git a/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php b/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php index 3380a7fb3405d75daefdcc8e7a9222587bb443d5..80481f67badd2a6ba22b4959de56ac7db1cf949d 100644 --- a/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php +++ b/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php @@ -207,14 +207,11 @@ class UtilController extends AbstractBase 'id' => $id, 'bib_id' => [], 'instructor_id' => $instructor_id, - 'instructor' => isset($instructors[$instructor_id]) - ? $instructors[$instructor_id] : '', + 'instructor' => $instructors[$instructor_id] ?? '', 'course_id' => $course_id, - 'course' => isset($courses[$course_id]) - ? $courses[$course_id] : '', + 'course' => $courses[$course_id] ?? '', 'department_id' => $department_id, - 'department' => isset($departments[$department_id]) - ? $departments[$department_id] : '' + 'department' => $departments[$department_id] ?? '' ]; } $index[$id]['bib_id'][] = $record['BIB_ID']; diff --git a/module/VuFindConsole/src/VuFindConsole/Generator/GeneratorTools.php b/module/VuFindConsole/src/VuFindConsole/Generator/GeneratorTools.php index 946bf9a212560a94fce1b70dee726c63b32bd75a..8f8f108a2af593a4fdf3c3c837b8c6fb324af25f 100644 --- a/module/VuFindConsole/src/VuFindConsole/Generator/GeneratorTools.php +++ b/module/VuFindConsole/src/VuFindConsole/Generator/GeneratorTools.php @@ -147,7 +147,7 @@ class GeneratorTools protected function getFactoryFromContainer(ContainerInterface $container, $class) { $factories = $this->getAllFactoriesFromContainer($container); - return isset($factories[$class]) ? $factories[$class] : null; + return $factories[$class] ?? null; } /** diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php index cd6fc09d72bb3817e7fa17644ba2d075bc02eafc..e82edca5a24b60021674ece3613ed699cb769d70 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php @@ -422,10 +422,8 @@ class Backend extends AbstractBackend } $authTokenData = $this->cache->getItem('edsAuthenticationToken'); if (isset($authTokenData)) { - $currentToken = isset($authTokenData['token']) - ? $authTokenData['token'] : ''; - $expirationTime = isset($authTokenData['expiration']) - ? $authTokenData['expiration'] : 0; + $currentToken = $authTokenData['token'] ?? ''; + $expirationTime = $authTokenData['expiration'] ?? 0; $this->debugPrint( 'Cached Authentication data: ' . "$currentToken, expiration time: $expirationTime" diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Base.php b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Base.php index 6f47edd8fb22256a05aa21d78c512917685de59b..4a181c2462faabb1bba134bd487b82dcbd173958 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Base.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Base.php @@ -226,7 +226,7 @@ abstract class EdsApi_REST_Base "Authenticating: username: $username, password: $password, orgid: $orgid" ); $url = $this->authHost . '/uidauth'; - $org = isset($orgid) ? $orgid : $this->orgId; + $org = $orgid ?? $this->orgId; $authInfo = []; if (isset($username)) { $authInfo['UserId'] = $username; diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Backend.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Backend.php index 1414f60d86ae17cba55df054008635ef84af68d1..bf6fb679869fc2ac9b10d32bc18084f394938a7a 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Backend.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Backend.php @@ -420,8 +420,7 @@ class Backend extends AbstractBackend sprintf('JSON decoding error: %s -- %s', $error, $json) ); } - $qtime = isset($response['responseHeader']['QTime']) - ? $response['responseHeader']['QTime'] : 'n/a'; + $qtime = $response['responseHeader']['QTime'] ?? 'n/a'; $this->log('debug', 'Deserialized SOLR response', ['qtime' => $qtime]); return $response; } diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/RecordCollection.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/RecordCollection.php index 39c9e2a6f590aa14fc60be556b441d733ea235c1..e96152f22a9c343881515a7d7e893a31249a3237 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/RecordCollection.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/RecordCollection.php @@ -169,9 +169,7 @@ class RecordCollection extends AbstractRecordCollection protected function getSpellcheckQuery() { $params = $this->getSolrParameters(); - return isset($params['spellcheck.q']) - ? $params['spellcheck.q'] - : (isset($params['q']) ? $params['q'] : ''); + return $params['spellcheck.q'] ?? ($params['q'] ?? ''); } /** diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/SearchHandler.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/SearchHandler.php index 58732396a6903d3f9d75bf60f8f6ff2e99e58055..5cbfbe54da1eabfbc33ab5f90fed64a427533f2e 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/SearchHandler.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/SearchHandler.php @@ -82,7 +82,7 @@ class SearchHandler public function __construct(array $spec, $defaultDismaxHandler = 'dismax') { foreach (self::$configKeys as $key) { - $this->specs[$key] = isset($spec[$key]) ? $spec[$key] : []; + $this->specs[$key] = $spec[$key] ?? []; } // Set dismax handler to default if not specified: if (empty($this->specs['DismaxHandler'])) { diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Summon/Backend.php b/module/VuFindSearch/src/VuFindSearch/Backend/Summon/Backend.php index 505be9fb6f8a289e640d2c264964db36cfd29715..3e01b4768b0248c6157e70cb65af5d8f33ef609e 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Summon/Backend.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Summon/Backend.php @@ -266,7 +266,7 @@ class Backend extends AbstractBackend implements RetrieveBatchInterface $params = $params->getArrayCopy(); // Extract the query: - $query = isset($params['query'][0]) ? $params['query'][0] : null; + $query = $params['query'][0] ?? null; unset($params['query']); // Convert the options: diff --git a/module/VuFindTheme/src/VuFindTheme/LessCompiler.php b/module/VuFindTheme/src/VuFindTheme/LessCompiler.php index 4302c2ad03005571c356f70bd8d0a0bdad483db0..8e946a66d7bf7859d1f229d15edfdf5b844283b2 100644 --- a/module/VuFindTheme/src/VuFindTheme/LessCompiler.php +++ b/module/VuFindTheme/src/VuFindTheme/LessCompiler.php @@ -161,7 +161,7 @@ class LessCompiler $base = (isset($configArr['extends'])) ? $this->getAllLessFiles($configArr['extends']) : []; - $current = isset($configArr['less']) ? $configArr['less'] : []; + $current = $configArr['less'] ?? []; return array_merge($base, $current); } diff --git a/module/VuFindTheme/src/VuFindTheme/ThemeCompiler.php b/module/VuFindTheme/src/VuFindTheme/ThemeCompiler.php index c30ff24099fd9598c6ba24a05c140daec9d18bab..1e3fd1554cf689b267212df2311a9c3cf8bb7903 100644 --- a/module/VuFindTheme/src/VuFindTheme/ThemeCompiler.php +++ b/module/VuFindTheme/src/VuFindTheme/ThemeCompiler.php @@ -122,7 +122,7 @@ class ThemeCompiler extends AbstractThemeUtility // Call this function recursively to deal with the helpers // sub-array: $dest[$key] = $this - ->mergeConfig($value, isset($dest[$key]) ? $dest[$key] : []); + ->mergeConfig($value, $dest[$key] ?? []); break; case 'mixins': // Omit mixin settings entirely diff --git a/module/VuFindTheme/src/VuFindTheme/ThemeInfo.php b/module/VuFindTheme/src/VuFindTheme/ThemeInfo.php index 5652ebfaeed30aabd14e42d457b9d315b7860169..bc520b86b09892b7184373862fff968851d566b5 100644 --- a/module/VuFindTheme/src/VuFindTheme/ThemeInfo.php +++ b/module/VuFindTheme/src/VuFindTheme/ThemeInfo.php @@ -213,8 +213,7 @@ class ThemeInfo while (!empty($currentTheme)) { $currentThemeSet = array_merge( (array)$currentTheme, - isset($allThemeInfo[$currentTheme]['mixins']) - ? $allThemeInfo[$currentTheme]['mixins'] : [] + $allThemeInfo[$currentTheme]['mixins'] ?? [] ); foreach ($currentThemeSet as $theme) { foreach ($allPaths as $currentPath) { diff --git a/tests/vufind.php_cs b/tests/vufind.php_cs index 6cac4596895d0f69f9aabc9723d2be97a37af3cf..8920407197e1a5c6c3b16265bd796e8fe41ecd89 100644 --- a/tests/vufind.php_cs +++ b/tests/vufind.php_cs @@ -68,6 +68,7 @@ $rules = [ 'switch_case_semicolon_to_colon' => true, 'switch_case_space' => true, 'ternary_operator_spaces' => true, + 'ternary_to_null_coalescing' => true, 'visibility_required' => true, ]; diff --git a/tests/vufind_templates.php_cs b/tests/vufind_templates.php_cs index 6db30f69c9f7837d5f51fef6f3b568e6b9266bdb..df6942b654c9e40c083391e345a34059e8f773d9 100644 --- a/tests/vufind_templates.php_cs +++ b/tests/vufind_templates.php_cs @@ -62,6 +62,7 @@ $rules = [ 'switch_case_semicolon_to_colon' => true, 'switch_case_space' => true, //'ternary_operator_spaces' => true, // disabled due to bug in php-cs-fixer 2.7.1 + 'ternary_to_null_coalescing' => true, 'visibility_required' => true, ]; diff --git a/themes/bootstrap3/templates/Recommend/CatalogResults.phtml b/themes/bootstrap3/templates/Recommend/CatalogResults.phtml index 86d48242bea73d8047aa08fbb497b08605687975..902143a3fa3a4b0dfbe9635d786102218329cbc9 100644 --- a/themes/bootstrap3/templates/Recommend/CatalogResults.phtml +++ b/themes/bootstrap3/templates/Recommend/CatalogResults.phtml @@ -3,7 +3,7 @@ <ul class="list-group"> <?php foreach ($results as $driver): ?> <li class="list-group-item catalog-result"> - <?php $formats = $driver->getFormats(); $format = isset($formats[0]) ? $formats[0] : ''; ?> + <?php $formats = $driver->getFormats(); $format = $formats[0] ?? ''; ?> <a href="<?=$this->recordLink()->getUrl($driver)?>" class="title <?=$this->record($driver)->getFormatClass($format)?>"> <?=$this->record($driver)->getTitleHtml()?> </a> diff --git a/themes/bootstrap3/templates/Recommend/FavoriteFacets.phtml b/themes/bootstrap3/templates/Recommend/FavoriteFacets.phtml index 1a071eb425b7e56a13619b9a68f80520077e4382..7130d5b4d7ca42372ecfbf8065aa5e5aef4695ea 100644 --- a/themes/bootstrap3/templates/Recommend/FavoriteFacets.phtml +++ b/themes/bootstrap3/templates/Recommend/FavoriteFacets.phtml @@ -5,7 +5,7 @@ <h4 class="tag"><?=$this->transEsc($sideFacetSet['tags']['label'])?></h4> <ul class="list-group"> <?php $filterList = $results->getParams()->getFilterList(true); - $tagFilterList = isset($filterList[$sideFacetSet['tags']['label']]) ? $filterList[$sideFacetSet['tags']['label']] : null; ?> + $tagFilterList = $filterList[$sideFacetSet['tags']['label']] ?? null; ?> <?php if (!empty($tagFilterList)): ?> <?php $field = $sideFacetSet['tags']['label']; ?> <?php foreach ($tagFilterList as $filter): ?> diff --git a/themes/bootstrap3/templates/Recommend/RandomRecommend.phtml b/themes/bootstrap3/templates/Recommend/RandomRecommend.phtml index f083a9bd6486fef299bf7002fc826aaa9c9efb89..636796d8eb1047d17316891cd36bcab446add540 100644 --- a/themes/bootstrap3/templates/Recommend/RandomRecommend.phtml +++ b/themes/bootstrap3/templates/Recommend/RandomRecommend.phtml @@ -11,7 +11,7 @@ <?=$this->record($driver)->getCover('RandomRecommend', 'small:medium', $this->recordLink()->getUrl($driver)); ?> <?php endif; ?> - <?php $formats = $driver->getFormats(); $format = isset($formats[0]) ? $formats[0] : ''; ?> + <?php $formats = $driver->getFormats(); $format = $formats[0] ?? ''; ?> <a href="<?=$this->recordLink()->getUrl($driver)?>" class="title <?=$this->record($driver)->getFormatClass($format)?> clearfix"> <?=$this->record($driver)->getTitleHtml()?> <?php $summAuthors = $driver->getPrimaryAuthors(); ?> diff --git a/themes/bootstrap3/templates/Recommend/SideFacets.phtml b/themes/bootstrap3/templates/Recommend/SideFacets.phtml index 56c2dc4d051a22f78fa80b1ca126bf23dea7cbac..b76c3107c1c9b8a9747926c19a338dc40dc523e7 100644 --- a/themes/bootstrap3/templates/Recommend/SideFacets.phtml +++ b/themes/bootstrap3/templates/Recommend/SideFacets.phtml @@ -51,7 +51,7 @@ <?php $contextVars = [ 'allowExclude' => $this->recommend->excludeAllowed($title), 'title' => $title, - 'sortOptions' => isset($hierarchicalFacetSortOptions[$title]) ? $hierarchicalFacetSortOptions[$title] : '', + 'sortOptions' => $hierarchicalFacetSortOptions[$title] ?? '', 'collapsedFacets' => $collapsedFacets ]; ?> <?php if (in_array($title, $hierarchicalFacets)): ?> diff --git a/themes/bootstrap3/templates/Recommend/SummonResults.phtml b/themes/bootstrap3/templates/Recommend/SummonResults.phtml index 4e7ac74d3aa46a9ba867709ddad2cb0ff90636e9..af3c43139c8bedb25d012794d27c750d6098c06d 100644 --- a/themes/bootstrap3/templates/Recommend/SummonResults.phtml +++ b/themes/bootstrap3/templates/Recommend/SummonResults.phtml @@ -4,7 +4,7 @@ <?php foreach ($results as $driver): ?> <div class="list-group-item"> <span> - <?php $formats = $driver->getFormats(); $format = isset($formats[0]) ? $formats[0] : ''; ?> + <?php $formats = $driver->getFormats(); $format = $formats[0] ?? ''; ?> <a href="<?=$this->recordLink()->getUrl($driver)?>" class="title <?=$this->record($driver)->getFormatClass($format)?>"> <?=$this->record($driver)->getTitleHtml()?> </a> diff --git a/themes/bootstrap3/templates/Recommend/VisualFacets.phtml b/themes/bootstrap3/templates/Recommend/VisualFacets.phtml index a72eeadd523f7ac072a835b8a5da58951ccd05ff..67ecbced35c47c73a34d3da9b62ae512fb61e63d 100644 --- a/themes/bootstrap3/templates/Recommend/VisualFacets.phtml +++ b/themes/bootstrap3/templates/Recommend/VisualFacets.phtml @@ -12,7 +12,7 @@ $toplevelinfo['name'] = $toplevelfacet['value']; $toplevelinfo['field'] = $toplevelfacet['field']; $toplevelinfo['size'] = $toplevelfacet['count']; - $pivot = isset($toplevelfacet['pivot']) ? $toplevelfacet['pivot'] : []; + $pivot = $toplevelfacet['pivot'] ?? []; foreach($pivot as $secondlevelfacet) { $secondlevelinfo = []; $secondlevelinfo['name'] = $secondlevelfacet['value']; diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/collection-info.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/collection-info.phtml index 070f62df0b01a65f048ae349ab77ddf37b88d2eb..81e8d3477cea7919401fd53032385ad4addfebaa 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/collection-info.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/collection-info.phtml @@ -27,7 +27,7 @@ <h2><?=$this->escapeHtml($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection())?></h2> - <?php $summary = $this->driver->getSummary(); $summary = isset($summary[0]) ? $summary[0] : false; ?> + <?php $summary = $this->driver->getSummary(); $summary = $summary[0] ?? false; ?> <?php if ($summary): ?> <p><?=$this->escapeHtml($summary)?></p> <?php endif; ?> diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/data-authors.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/data-authors.phtml index a5500a7a3b8589516beef8b80be3d6f734fc4a1e..5a30567231ded60a56bdf1a808663558577be4e8 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/data-authors.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/data-authors.phtml @@ -24,7 +24,7 @@ $formattedAuthors = []; if (!empty($requiredDataFields)) { foreach ($requiredDataFields as $field) { $name = $field['name']; - $prefix = isset($field['prefix']) ? $field['prefix'] : ''; + $prefix = $field['prefix'] ?? ''; if (isset($dataFields[$name])) { echo $formatProperty($dataFields[$name], $name, $prefix); } diff --git a/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml b/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml index 4663171bb3cf2842002a82ff057119d0c006065c..ae075e294b56d7a77a1f2ed383a1584b6e1d032c 100644 --- a/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml +++ b/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml @@ -92,16 +92,17 @@ <?php $customLinks = array_merge($this->driver->getFTCustomLinks(), $this->driver->getCustomLinks()); if (!empty($customLinks)): ?> <?php foreach ($customLinks as $customLink): ?> - <?php $url = isset($customLink['Url']) ? $customLink['Url'] : ''; - $mot = isset($customLink['MouseOverText'])? $customLink['MouseOverText'] : ''; - $icon = isset($customLink['Icon']) ? $customLink['Icon'] : ''; - $name = isset($customLink['Text']) ? $customLink['Text'] : ''; - ?> - <span> - <a href="<?=$this->escapeHtmlAttr($url)?>" target="_blank" title="<?=$this->escapeHtmlAttr($mot)?>" class="custom-link"> - <?php if ($icon): ?><img src="<?=$this->escapeHtmlAttr($icon)?>" /> <?php endif; ?><?=$this->escapeHtml($name)?> - </a> - </span> + <?php + $url = $customLink['Url'] ?? ''; + $mot = $customLink['MouseOverText'] ?? ''; + $icon = $customLink['Icon'] ?? ''; + $name = $customLink['Text'] ?? ''; + ?> + <span> + <a href="<?=$this->escapeHtmlAttr($url)?>" target="_blank" title="<?=$this->escapeHtmlAttr($mot)?>" class="custom-link"> + <?php if ($icon): ?><img src="<?=$this->escapeHtmlAttr($icon)?>" /> <?php endif; ?><?=$this->escapeHtml($name)?> + </a> + </span> <?php endforeach; ?> <?php endif; ?> </div> diff --git a/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml index 741a7bbafb92006120fc1c78dc898eedb5e36478..20a37c714fa0fa3725efe1faeb85137640c0bbf8 100644 --- a/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml +++ b/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml @@ -61,16 +61,17 @@ <?php $customLinks = array_merge($this->driver->getFTCustomLinks(), $this->driver->getCustomLinks()); if (!empty($customLinks)): ?> <?php foreach ($customLinks as $customLink): ?> - <?php $url = isset($customLink['Url']) ? $customLink['Url'] : ''; - $mot = isset($customLink['MouseOverText'])? $customLink['MouseOverText'] : ''; - $icon = isset($customLink['Icon']) ? $customLink['Icon'] : ''; - $name = isset($customLink['Text']) ? $customLink['Text'] : ''; - ?> - <span> - <a href="<?=$this->escapeHtmlAttr($url)?>" target="_blank" title="<?=$this->escapeHtmlAttr($mot)?>" class="custom-link"> - <?php if ($icon): ?><img src="<?=$this->escapeHtmlAttr($icon)?>" /> <?php endif; ?><?=$this->escapeHtml($name)?> - </a> - </span> + <?php + $url = $customLink['Url'] ?? ''; + $mot = $customLink['MouseOverText'] ?? ''; + $icon = $customLink['Icon'] ?? ''; + $name = $customLink['Text'] ?? ''; + ?> + <span> + <a href="<?=$this->escapeHtmlAttr($url)?>" target="_blank" title="<?=$this->escapeHtmlAttr($mot)?>" class="custom-link"> + <?php if ($icon): ?><img src="<?=$this->escapeHtmlAttr($icon)?>" /> <?php endif; ?><?=$this->escapeHtml($name)?> + </a> + </span> <?php endforeach; ?> <?php endif; ?> </div> diff --git a/themes/bootstrap3/templates/RecordTab/excerpt.phtml b/themes/bootstrap3/templates/RecordTab/excerpt.phtml index 6164969b60746e0b4a15b66594c733ae291fce20..46f695587993f5afd5f49466b79837c23b2671dd 100644 --- a/themes/bootstrap3/templates/RecordTab/excerpt.phtml +++ b/themes/bootstrap3/templates/RecordTab/excerpt.phtml @@ -9,7 +9,7 @@ <?php foreach ($excerpts as $provider => $list): ?> <?php foreach ($list as $excerpt): ?> <p class="summary"><?=$excerpt['Content']?></p> - <?=isset($excerpt['Copyright']) ? $excerpt['Copyright'] : ''?> + <?=$excerpt['Copyright'] ?? ''?> <hr/> <?php endforeach; ?> <?php endforeach; ?> diff --git a/themes/bootstrap3/templates/RecordTab/reviews.phtml b/themes/bootstrap3/templates/RecordTab/reviews.phtml index da4f97d1848820e2c1634692328a4b9155ea4f70..d95e06775e8737a016c06b5be94e2a752370845b 100644 --- a/themes/bootstrap3/templates/RecordTab/reviews.phtml +++ b/themes/bootstrap3/templates/RecordTab/reviews.phtml @@ -18,12 +18,12 @@ <?php endif; ?> <?php if (isset($review['Source'])): ?><strong><?=$this->transEsc('Review by')?> <?=$review['Source']?></strong><?php endif; ?> <p class="summary"> - <?=isset($review['Content']) ? $review['Content'] : ''?> + <?=$review['Content'] ?? ''?> <?php if ((!isset($review['Content']) || empty($review['Content'])) && isset($review['ReviewURL'])): ?> <a target="new" href="<?=$this->escapeHtmlAttr($review['ReviewURL'])?>"><?=$this->transEsc('Read the full review online...')?></a> <?php endif; ?> </p> - <?=isset($review['Copyright']) ? $review['Copyright'] : ''?> + <?=$review['Copyright'] ?? ''?> <hr/> <?php endforeach; ?> <?php endforeach; ?> diff --git a/themes/bootstrap3/templates/admin/home.phtml b/themes/bootstrap3/templates/admin/home.phtml index d17ba66c56d3e732717d3f0add61bfeabf489252..36de2e5b41be303461e8efa270caaabb509fa293 100644 --- a/themes/bootstrap3/templates/admin/home.phtml +++ b/themes/bootstrap3/templates/admin/home.phtml @@ -13,7 +13,7 @@ <?php $cores = is_object($this->xml) ? $this->xml->xpath('/response/lst[@name="status"]/lst') : []; ?> <?php foreach ($cores as $core): ?> <?php $coreName = (string)$core['name']; ?> - <?php $coreLabel = isset($coreLabels[$coreName]) ? $coreLabels[$coreName] : ucwords($coreName) . ' Index'; ?> + <?php $coreLabel = $coreLabels[$coreName] ?? ucwords($coreName) . ' Index'; ?> <h3><?=$this->transEsc($coreLabel)?></h3> <table class="table table-striped"> <tr> diff --git a/themes/bootstrap3/templates/channels/channelList.phtml b/themes/bootstrap3/templates/channels/channelList.phtml index 1fa05ba4e28b726f39e7927544d1a0854b56ce0e..ec88a3a8a75c1728635843ad6fdc41e171259461 100644 --- a/themes/bootstrap3/templates/channels/channelList.phtml +++ b/themes/bootstrap3/templates/channels/channelList.phtml @@ -23,11 +23,9 @@ <?php $insideButton = false; ?> <?php foreach ($channels as $channel): ?> <?php - $groupId = isset($channel['groupId']) - ? $channel['groupId'] - : $channel['providerId']; + $groupId = $channel['groupId'] ?? $channel['providerId']; + $channelID = 'channel-' . md5(serialize($channel)); ?> - <?php $channelID = 'channel-' . md5(serialize($channel)); ?> <?php if (isset($channel['contents'])): ?> <?php if ($insideButton): ?> </ul> diff --git a/themes/bootstrap3/templates/collections/home.phtml b/themes/bootstrap3/templates/collections/home.phtml index 3f7c9e52294256ee304302cc255757b1f988d1d6..e5bea94fa2360d837cd7e50bfee38069ac600f7c 100644 --- a/themes/bootstrap3/templates/collections/home.phtml +++ b/themes/bootstrap3/templates/collections/home.phtml @@ -3,7 +3,7 @@ $this->layout()->breadcrumbs = '<a href="' . $this->url('collections-home') . '">' . $this->transEsc('Collections') . '</a>'; $filterList = []; $filterString = ''; - foreach (isset($filters['Other']) ? $filters['Other'] : [] as $filter) { + foreach ($filters['Other'] ?? [] as $filter) { $filter['urlPart'] = $filter['field'] . ':' . $filter['value']; $filterList[] = $filter; $filterString .= '&' . urlencode('filter[]') . '=' . urlencode($filter['urlPart']); diff --git a/themes/bootstrap3/templates/feedback/form.phtml b/themes/bootstrap3/templates/feedback/form.phtml index c2e9cc573e2251da8e40a5922e46ff31a4ca5c13..f8488ec54b648dc2b4fc284931b75c46f098b1eb 100644 --- a/themes/bootstrap3/templates/feedback/form.phtml +++ b/themes/bootstrap3/templates/feedback/form.phtml @@ -3,15 +3,15 @@ <form class="form-feedback" name="feedback" method="post" action="<?=$this->url('feedback-email')?>"> <div class="form-group"> <label class="control-label" for="name"><?=$this->transEsc("feedback_name")?></label> - <input type="text" id="name" name="name" value="<?=$this->escapeHtmlAttr(isset($name) ? $name : '')?>" class="form-control"/> + <input type="text" id="name" name="name" value="<?=$this->escapeHtmlAttr($name ?? '')?>" class="form-control"/> </div> <div class="form-group"> <label class="control-label" for="email"><?=$this->transEsc("Email")?></label> - <input type="email" id="email" name="email" value="<?=$this->escapeHtmlAttr(isset($email) ? $email : '')?>" class="form-control" required/> + <input type="email" id="email" name="email" value="<?=$this->escapeHtmlAttr($email ?? '')?>" class="form-control" required/> </div> <div class="form-group"> <label class="control-label" for="comments"><?=$this->transEsc("Comments")?></label> - <textarea id="comments" name="comments" class="form-control" required><?=$this->escapeHtml(isset($comments) ? $comments : '')?></textarea> + <textarea id="comments" name="comments" class="form-control" required><?=$this->escapeHtml($comments ?? '')?></textarea> </div> <?=$this->recaptcha()->html($this->useRecaptcha) ?> <div class="form-group"> diff --git a/themes/bootstrap3/templates/myresearch/checkedout.phtml b/themes/bootstrap3/templates/myresearch/checkedout.phtml index 96d1e30a62fe2e2f02c86a6a57f91394e9f70612..1aa5feb1e0560d45c14478d20450c24f6c6958ab 100644 --- a/themes/bootstrap3/templates/myresearch/checkedout.phtml +++ b/themes/bootstrap3/templates/myresearch/checkedout.phtml @@ -45,7 +45,7 @@ <?php foreach ($hiddenTransactions as $ilsDetails): ?> <?php if (isset($this->renewResult[$ilsDetails['item_id']])): ?> <?php $renewDetails = $this->renewResult[$ilsDetails['item_id']]; ?> - <?php $prefix = isset($ilsDetails['title']) ? $ilsDetails['title'] : $ilsDetails['item_id']; ?> + <?php $prefix = $ilsDetails['title'] ?? $ilsDetails['item_id']; ?> <?php if (isset($renewDetails['success']) && $renewDetails['success']): ?> <div class="alert alert-success"><?=$this->escapeHtml($prefix . ': ') . $this->transEsc('renew_success')?></div> <?php else: ?> diff --git a/themes/bootstrap3/templates/myresearch/mylist.phtml b/themes/bootstrap3/templates/myresearch/mylist.phtml index 33202c46afe3efd7427fdef518c126b6de199ae3..f0f6b56e28cb8ca6ae807884a21031d492c5b7ee 100644 --- a/themes/bootstrap3/templates/myresearch/mylist.phtml +++ b/themes/bootstrap3/templates/myresearch/mylist.phtml @@ -68,7 +68,7 @@ <?php endif; ?> <?php if ($recordTotal > 0): ?> <form class="form-inline" method="post" name="bulkActionForm" action="<?=$this->url('cart-myresearchbulk')?>" data-lightbox data-lightbox-onsubmit="bulkFormHandler"> - <?=$this->context($this)->renderInContext('myresearch/bulk-action-buttons.phtml', ['idPrefix' => '', 'list' => isset($list) ? $list : null, 'account' => $this->account])?> + <?=$this->context($this)->renderInContext('myresearch/bulk-action-buttons.phtml', ['idPrefix' => '', 'list' => $list ?? null, 'account' => $this->account])?> <?php foreach ($this->results->getResults() as $i => $current): ?> <?=$this->record($current)->getListEntry($list, $user)?> <?php endforeach; ?> diff --git a/themes/bootstrap3/templates/primo/advanced.phtml b/themes/bootstrap3/templates/primo/advanced.phtml index 3dc51bcc5200c9fdae6fcb78d51d23b2d0ccf963..4aa47b36d197d314190bb3d6665cc3b613b3fcbf 100644 --- a/themes/bootstrap3/templates/primo/advanced.phtml +++ b/themes/bootstrap3/templates/primo/advanced.phtml @@ -52,7 +52,7 @@ } ?> <?php for ($j = 0; $j < $numRows; $j++): ?> - <?php $currRow = isset($currentGroup[$j]) ? $currentGroup[$j] : false; ?> + <?php $currRow = $currentGroup[$j] ?? false; ?> <div class="search"> <select id="search_type<?=$i?>_<?=$j?>" name="type<?=$i?>[]" class="form-control"> <?php foreach ($this->options->getAdvancedHandlers() as $searchVal => $searchDesc): ?> diff --git a/themes/bootstrap3/templates/record/sms.phtml b/themes/bootstrap3/templates/record/sms.phtml index 243308f070c6d35a666dceaba0a43a847b9e7f07..4bb8f8a3dca797423a8840a3fa4816ac1f260a03 100644 --- a/themes/bootstrap3/templates/record/sms.phtml +++ b/themes/bootstrap3/templates/record/sms.phtml @@ -37,7 +37,7 @@ JS; </div> <?php else: ?> <?php $keys = is_array($this->carriers) ? array_keys($this->carriers) : []; ?> - <input type="hidden" name="provider" value="<?=isset($keys[0]) ? $keys[0] : ''?>" /> + <input type="hidden" name="provider" value="<?=$keys[0] ?? ''?>" /> <?php endif; ?> <?=$this->recaptcha()->html($this->useRecaptcha) ?> <div class="form-group"> diff --git a/themes/bootstrap3/templates/search/searchbox.phtml b/themes/bootstrap3/templates/search/searchbox.phtml index ceb3c534a67c3f2b586146dfc9cb20b653e22122..4d4d4ca1fed76b88afa334efb3a814f533f6a70f 100644 --- a/themes/bootstrap3/templates/search/searchbox.phtml +++ b/themes/bootstrap3/templates/search/searchbox.phtml @@ -43,7 +43,7 @@ <?php else: ?> <form id="searchForm" class="searchForm navbar-form navbar-left flip" method="get" action="<?=$this->url($basicSearch)?>" name="searchForm" autocomplete="off"> <?= $this->context($this)->renderInContext('search/searchTabs', ['searchTabs' => $tabConfig['tabs']]); ?> - <?php $placeholder = $this->searchbox()->getPlaceholderText(isset($tabConfig['selected']['id']) ? $tabConfig['selected']['id'] : null); ?> + <?php $placeholder = $this->searchbox()->getPlaceholderText($tabConfig['selected']['id'] ?? null); ?> <input id="searchForm_lookfor" class="searchForm_lookfor form-control search-query<?php if($this->searchbox()->autocompleteEnabled($this->searchClassId)):?> autocomplete searcher:<?=$this->escapeHtmlAttr($this->searchClassId) ?><?php endif ?>" type="text" name="lookfor" value="<?=$this->escapeHtmlAttr($this->lookfor)?>"<?php if ($placeholder): ?> placeholder="<?=$this->transEsc($placeholder) ?>"<?php endif ?> /> <?php if ($handlerCount > 1): ?> <select id="searchForm_type" class="searchForm_type form-control" name="type" data-native-menu="false"> diff --git a/themes/root/templates/Email/record-sms.phtml b/themes/root/templates/Email/record-sms.phtml index 1f37dc6964a1388c4e4370484d5cb9c3d49e0266..268c4a5cd5e0ad8539c336c54bbc863759b26f79 100644 --- a/themes/root/templates/Email/record-sms.phtml +++ b/themes/root/templates/Email/record-sms.phtml @@ -18,7 +18,7 @@ foreach ($holdings['holdings'] as $details) { $location = $details['location']; foreach ($details['items'] as $item) { - $callno = isset($item['callnumber']) ? $item['callnumber'] : false; + $callno = $item['callnumber'] ?? false; if ($item['availability']) { if ($callno) { // Best case scenario -- available item with call number!