diff --git a/module/VuDL/src/VuDL/Connection/AbstractBase.php b/module/VuDL/src/VuDL/Connection/AbstractBase.php index 2afe045900a98769e401bafa6174078b78b8ef7e..32372148bcb2de1a681ff1c184fb3387d1d7ea83 100644 --- a/module/VuDL/src/VuDL/Connection/AbstractBase.php +++ b/module/VuDL/src/VuDL/Connection/AbstractBase.php @@ -40,6 +40,8 @@ use VuFindHttp\HttpServiceInterface, */ class AbstractBase implements \VuFindHttp\HttpServiceAwareInterface { + use \VuFindHttp\HttpServiceAwareTrait; + /** * VuDL config * @@ -54,13 +56,6 @@ class AbstractBase implements \VuFindHttp\HttpServiceAwareInterface */ protected $parentLists = array(); - /** - * HTTP service - * - * @var HttpServiceInterface - */ - protected $httpService = false; - /** * Constructor * @@ -71,18 +66,6 @@ class AbstractBase implements \VuFindHttp\HttpServiceAwareInterface $this->config = $config; } - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Get root id from config * diff --git a/module/VuFind/src/VuFind/Auth/Facebook.php b/module/VuFind/src/VuFind/Auth/Facebook.php index 14aeb89145ee6efabb3747f4a19b13647f059996..b14e3748152402e2c61550d85194ef7f125adf17 100644 --- a/module/VuFind/src/VuFind/Auth/Facebook.php +++ b/module/VuFind/src/VuFind/Auth/Facebook.php @@ -42,12 +42,7 @@ use VuFind\Exception\Auth as AuthException; class Facebook extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface { - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; + use \VuFindHttp\HttpServiceAwareTrait; /** * Session container @@ -64,18 +59,6 @@ class Facebook extends AbstractBase implements $this->session = new \Zend\Session\Container('Facebook'); } - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Validate configuration parameters. This is a support method for getConfig(), * so the configuration MUST be accessed using $this->config; do not call diff --git a/module/VuFind/src/VuFind/Content/AbstractBase.php b/module/VuFind/src/VuFind/Content/AbstractBase.php index b4354d8a18b417fba0f7b11cf166d84b75ff19dc..ac621ecd00b982c992c83eecd19b78eae51957d2 100644 --- a/module/VuFind/src/VuFind/Content/AbstractBase.php +++ b/module/VuFind/src/VuFind/Content/AbstractBase.php @@ -40,12 +40,7 @@ use VuFindCode\ISBN; abstract class AbstractBase implements \VuFindHttp\HttpServiceAwareInterface, \Zend\Log\LoggerAwareInterface { - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; + use \VuFindHttp\HttpServiceAwareTrait; /** * Logger @@ -96,18 +91,6 @@ abstract class AbstractBase implements \VuFindHttp\HttpServiceAwareInterface, return $this->httpService->createClient($url); } - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Load results for a particular API key and ISBN. * diff --git a/module/VuFind/src/VuFind/Content/Covers/Amazon.php b/module/VuFind/src/VuFind/Content/Covers/Amazon.php index 11510824ad16711ec84d6b69b418010afe0e0b82..1a000682c207e2b6bee578d6463f1638158a4af4 100644 --- a/module/VuFind/src/VuFind/Content/Covers/Amazon.php +++ b/module/VuFind/src/VuFind/Content/Covers/Amazon.php @@ -40,6 +40,8 @@ use ZendService\Amazon\Amazon as AmazonService; class Amazon extends \VuFind\Content\AbstractCover implements \VuFindHttp\HttpServiceAwareInterface { + use \VuFindHttp\HttpServiceAwareTrait; + /** * Associate ID * @@ -54,13 +56,6 @@ class Amazon extends \VuFind\Content\AbstractCover */ protected $secret; - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - /** * Constructor * @@ -89,18 +84,6 @@ class Amazon extends \VuFind\Content\AbstractCover return $this->httpService->createClient($url); } - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Get image URL for a particular API key and set of IDs (or false if invalid). * diff --git a/module/VuFind/src/VuFind/Content/Covers/Google.php b/module/VuFind/src/VuFind/Content/Covers/Google.php index 782f380b45b9f55a4c80cca0a2a5f01260c24e79..47c77110eb8ac5a8a32acefcb4323b8c2063fdbd 100644 --- a/module/VuFind/src/VuFind/Content/Covers/Google.php +++ b/module/VuFind/src/VuFind/Content/Covers/Google.php @@ -39,12 +39,7 @@ namespace VuFind\Content\Covers; class Google extends \VuFind\Content\AbstractCover implements \VuFindHttp\HttpServiceAwareInterface { - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; + use \VuFindHttp\HttpServiceAwareTrait; /** * Constructor @@ -69,18 +64,6 @@ class Google extends \VuFind\Content\AbstractCover return $this->httpService->createClient($url); } - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Get image URL for a particular API key and set of IDs (or false if invalid). * diff --git a/module/VuFind/src/VuFind/ILS/Driver/Aleph.php b/module/VuFind/src/VuFind/ILS/Driver/Aleph.php index 1d57fbb815d3ab2568ced5338d24c63e6c6f767c..b209bfe39c472227accf1d3377beee7b55fd8699 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Aleph.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Aleph.php @@ -304,6 +304,8 @@ class AlephRestfulException extends ILSException class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, \VuFindHttp\HttpServiceAwareInterface { + use \VuFindHttp\HttpServiceAwareTrait; + /** * Duedate configuration * @@ -332,13 +334,6 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, */ protected $logger = false; - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - /** * Date converter object * @@ -371,18 +366,6 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, $this->logger = $logger; } - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Initialize the driver. * diff --git a/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php b/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php index 59957990b9b40340ceba9b06c224993c31d44c9e..a568765c0f1d7a7817c37b158c829d12670c25c2 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php +++ b/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php @@ -41,24 +41,7 @@ use VuFind\Exception\ILS as ILSException; */ class HorizonXMLAPI extends Horizon implements \VuFindHttp\HttpServiceAwareInterface { - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } + use \VuFindHttp\HttpServiceAwareTrait; /** * Initialize the driver. diff --git a/module/VuFind/src/VuFind/ILS/Driver/Innovative.php b/module/VuFind/src/VuFind/ILS/Driver/Innovative.php index 3434549a1a71bf567f142e881f3eb554520b49ff..a7132da4ce2c9ea9f2f1b300a930752bc6c688da 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Innovative.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Innovative.php @@ -43,24 +43,7 @@ use VuFind\Exception\ILS as ILSException; class Innovative extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface { - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } + use \VuFindHttp\HttpServiceAwareTrait; /** * Initialize the driver. diff --git a/module/VuFind/src/VuFind/ILS/Driver/Polaris.php b/module/VuFind/src/VuFind/ILS/Driver/Polaris.php index 783949651d2e01af0dedbb54f7ae18d7101fdf4e..32bce071e595a2e9c44974b628058bd4b33aa10a 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Polaris.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Polaris.php @@ -41,6 +41,8 @@ use VuFind\Config\Reader as ConfigReader, */ class Polaris extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface { + use \VuFindHttp\HttpServiceAwareTrait; + /** * Web services host * @@ -76,25 +78,6 @@ class Polaris extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf */ protected $ws_requestingorgid; - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Initialize the driver. * diff --git a/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php b/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php index e5afc0559c1826a6fab7145141c52af53547049c..302f1f216878f4e43d0807c5a07f3546c534fc71 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php @@ -44,6 +44,8 @@ use File_MARC, VuFind\Exception\ILS as ILSException; **/ class Unicorn extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface { + use \VuFindHttp\HttpServiceAwareTrait; + /** * Host * @@ -72,13 +74,6 @@ class Unicorn extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf */ protected $url; - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - /** * Date converter object * @@ -96,18 +91,6 @@ class Unicorn extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf $this->dateConverter = $dateConverter; } - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Initialize the driver. * diff --git a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php index 4818b19316b00aebae7765c9655082938e53ce43..b3e1094ce23b70d06290f2d6ec62ab6476ce32f2 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php @@ -39,6 +39,8 @@ use VuFind\Exception\ILS as ILSException; */ class Virtua extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface { + use \VuFindHttp\HttpServiceAwareTrait; + /** * Oracle connection * @@ -46,25 +48,6 @@ class Virtua extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterfa */ protected $db; - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Initialize the driver. * diff --git a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php index 9b2076799e623cdd142bd5799b5af6a51d17ec99..42f8cb20c4fe3524b5cfb12a1fd5b9694e5383fc 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php +++ b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php @@ -48,6 +48,8 @@ use PDO, PDOException, VuFind\Exception\Date as DateException, */ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInterface { + use \VuFindHttp\HttpServiceAwareTrait; + /** * Web services host * @@ -111,13 +113,6 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte */ protected $callSlipCheckLimit; - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - /** * Holds mode * @@ -227,18 +222,6 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte $this->titleHoldsMode = $titleHoldsMode; } - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Initialize the driver. * diff --git a/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php b/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php index cd3ecf4757aeb5522c2dc3930c6eb86d0278e818..9261cb23f6e4cb9ec13432058d428d2024eda1cd 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php +++ b/module/VuFind/src/VuFind/ILS/Driver/XCNCIP2.php @@ -40,12 +40,7 @@ use VuFind\Exception\ILS as ILSException, */ class XCNCIP2 extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface { - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; + use \VuFindHttp\HttpServiceAwareTrait; /** * Is this a consortium? Default: false @@ -75,18 +70,6 @@ class XCNCIP2 extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf */ protected $pickupLocations = array(); - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Initialize the driver. * @@ -160,8 +143,7 @@ class XCNCIP2 extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf { // Make the NCIP request: try { - $client = $this->httpService - ->createClient($this->url); + $client = $this->httpService->createClient($this->url); // Set timeout value $timeout = isset($this->config['Catalog']['http_timeout']) ? $this->config['Catalog']['http_timeout'] : 30; diff --git a/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php b/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php index bbe8d472256c1d091339b60ff699d024ed2b155c..471213aba60b3cd51557ec07fdb9bc5a08f30881 100644 --- a/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php +++ b/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php @@ -44,6 +44,8 @@ use Zend\Feed\Reader\Reader as FeedReader, Zend\Log\LoggerInterface; class EuropeanaResults implements RecommendInterface, \VuFindHttp\HttpServiceAwareInterface, \Zend\Log\LoggerAwareInterface { + use \VuFindHttp\HttpServiceAwareTrait; + /** * Request parameter for searching * @@ -121,13 +123,6 @@ class EuropeanaResults implements RecommendInterface, */ protected $logger = false; - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - /** * Constructor * @@ -138,18 +133,6 @@ class EuropeanaResults implements RecommendInterface, $this->key = $key; } - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * Set the logger * diff --git a/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjects.php b/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjects.php index c325ae7b62e729b6feb021a567e207f69c9b4c2b..86397a726986972e1fc3efe4d702a4d7dfb702c1 100644 --- a/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjects.php +++ b/module/VuFind/src/VuFind/Recommend/OpenLibrarySubjects.php @@ -45,6 +45,8 @@ use VuFind\Connection\OpenLibrary, VuFind\Solr\Utils as SolrUtils; class OpenLibrarySubjects implements RecommendInterface, \VuFindHttp\HttpServiceAwareInterface { + use \VuFindHttp\HttpServiceAwareTrait; + /** * Parameter to use for search terms * @@ -94,25 +96,6 @@ class OpenLibrarySubjects implements RecommendInterface, */ protected $result = false; - /** - * HTTP service - * - * @var \VuFindHttp\HttpServiceInterface - */ - protected $httpService = null; - - /** - * Set the HTTP service to be used for HTTP requests. - * - * @param HttpServiceInterface $service HTTP service - * - * @return void - */ - public function setHttpService(\VuFindHttp\HttpServiceInterface $service) - { - $this->httpService = $service; - } - /** * setConfig *