From ae49a72ba9b1ac9f912c368d768c9f7b22bde22a Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 30 Jan 2019 10:34:24 -0500
Subject: [PATCH] Use static class property when checking for services.

---
 module/VuFind/src/VuFind/Bootstrapper.php                     | 2 +-
 .../src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php      | 2 +-
 module/VuFind/src/VuFind/RecordDriver/PluginManager.php       | 2 +-
 .../src/VuFind/Search/Factory/AbstractSolrBackendFactory.php  | 4 ++--
 .../src/VuFind/Search/Factory/BrowZineBackendFactory.php      | 2 +-
 module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php | 2 +-
 module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php | 2 +-
 .../src/VuFind/Search/Factory/LibGuidesBackendFactory.php     | 2 +-
 .../src/VuFind/Search/Factory/Pazpar2BackendFactory.php       | 2 +-
 .../VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php  | 2 +-
 .../VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php | 2 +-
 .../src/VuFind/Search/Factory/WorldCatBackendFactory.php      | 2 +-
 module/VuFind/src/VuFind/View/Helper/Root/HelpTextFactory.php | 2 +-
 module/VuFind/src/VuFindTest/Unit/DbTestCase.php              | 2 +-
 module/VuFind/src/VuFindTest/Unit/TestCase.php                | 2 +-
 15 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/module/VuFind/src/VuFind/Bootstrapper.php b/module/VuFind/src/VuFind/Bootstrapper.php
index af24bdf96c3..09f9bf203fd 100644
--- a/module/VuFind/src/VuFind/Bootstrapper.php
+++ b/module/VuFind/src/VuFind/Bootstrapper.php
@@ -444,7 +444,7 @@ class Bootstrapper
     {
         $callback = function ($event) {
             $sm = $event->getApplication()->getServiceManager();
-            if ($sm->has('VuFind\Log\Logger')) {
+            if ($sm->has(\VuFind\Log\Logger::class)) {
                 $log = $sm->get(\VuFind\Log\Logger::class);
                 if (is_callable([$log, 'logException'])) {
                     $exception = $event->getParam('exception');
diff --git a/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php b/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php
index 6e5d2660f47..32e92d25aba 100644
--- a/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php
+++ b/module/VuFind/src/VuFind/RecordDriver/IlsAwareDelegatorFactory.php
@@ -60,7 +60,7 @@ class IlsAwareDelegatorFactory implements DelegatorFactoryInterface
 
         // Attach the ILS if at least one backend supports it:
         $ilsBackends = $this->getIlsBackends($container);
-        if (!empty($ilsBackends) && $container->has('VuFind\ILS\Connection')) {
+        if (!empty($ilsBackends) && $container->has(\VuFind\ILS\Connection::class)) {
             $driver->attachILS(
                 $container->get(\VuFind\ILS\Connection::class),
                 $container->get(\VuFind\ILS\Logic\Holds::class),
diff --git a/module/VuFind/src/VuFind/RecordDriver/PluginManager.php b/module/VuFind/src/VuFind/RecordDriver/PluginManager.php
index ce4dda26805..8e4dec28f94 100644
--- a/module/VuFind/src/VuFind/RecordDriver/PluginManager.php
+++ b/module/VuFind/src/VuFind/RecordDriver/PluginManager.php
@@ -134,7 +134,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager
             if ($hasHierarchyType
                 && is_callable([$instance, 'setHierarchyDriverManager'])
             ) {
-                if ($sm && $sm->has('VuFind\Hierarchy\Driver\PluginManager')) {
+                if ($sm && $sm->has(\VuFind\Hierarchy\Driver\PluginManager::class)) {
                     $instance->setHierarchyDriverManager(
                         $sm->get(\VuFind\Hierarchy\Driver\PluginManager::class)
                     );
diff --git a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php
index fd90e3e284d..8e085df575c 100644
--- a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php
@@ -150,7 +150,7 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface
         $this->serviceLocator = $sm;
         $this->config = $this->serviceLocator
             ->get(\VuFind\Config\PluginManager::class);
-        if ($this->serviceLocator->has('VuFind\Log\Logger')) {
+        if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) {
             $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class);
         }
         $connector = $this->createConnector();
@@ -351,7 +351,7 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface
         if ($this->logger) {
             $connector->setLogger($this->logger);
         }
-        if ($this->serviceLocator->has('VuFindHttp\HttpService')) {
+        if ($this->serviceLocator->has(\VuFindHttp\HttpService::class)) {
             $connector->setProxy(
                 $this->serviceLocator->get(\VuFindHttp\HttpService::class)
             );
diff --git a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php
index b2edaaeec18..6e44b8aff1d 100644
--- a/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/BrowZineBackendFactory.php
@@ -86,7 +86,7 @@ class BrowZineBackendFactory implements FactoryInterface
         $configReader = $this->serviceLocator
             ->get(\VuFind\Config\PluginManager::class);
         $this->browzineConfig = $configReader->get('BrowZine');
-        if ($this->serviceLocator->has('VuFind\Log\Logger')) {
+        if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) {
             $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class);
         }
 
diff --git a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php
index 492205e4399..92e04b11744 100644
--- a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php
@@ -87,7 +87,7 @@ class EITBackendFactory implements FactoryInterface
         $this->config = $this->serviceLocator
             ->get(\VuFind\Config\PluginManager::class)
             ->get('EIT');
-        if ($this->serviceLocator->has('VuFind\Log\Logger')) {
+        if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) {
             $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class);
         }
         $connector = $this->createConnector();
diff --git a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php
index 7213ca6c6fd..bad7ffb6eaa 100644
--- a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php
@@ -93,7 +93,7 @@ class EdsBackendFactory implements FactoryInterface
         $this->edsConfig = $this->serviceLocator
             ->get(\VuFind\Config\PluginManager::class)
             ->get('EDS');
-        if ($this->serviceLocator->has('VuFind\Log\Logger')) {
+        if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) {
             $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class);
         }
         $connector = $this->createConnector();
diff --git a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php
index 1bdc9f51d2c..8dc08eb7f78 100644
--- a/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/LibGuidesBackendFactory.php
@@ -86,7 +86,7 @@ class LibGuidesBackendFactory implements FactoryInterface
         $configReader = $this->serviceLocator
             ->get(\VuFind\Config\PluginManager::class);
         $this->libGuidesConfig = $configReader->get('LibGuides');
-        if ($this->serviceLocator->has('VuFind\Log\Logger')) {
+        if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) {
             $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class);
         }
         $connector = $this->createConnector();
diff --git a/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php
index 9adbdb3fe2d..c73e00691ec 100644
--- a/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/Pazpar2BackendFactory.php
@@ -88,7 +88,7 @@ class Pazpar2BackendFactory implements FactoryInterface
         $this->config = $this->serviceLocator
             ->get(\VuFind\Config\PluginManager::class)
             ->get('Pazpar2');
-        if ($this->serviceLocator->has('VuFind\Log\Logger')) {
+        if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) {
             $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class);
         }
         $connector = $this->createConnector();
diff --git a/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php
index 521965c021f..387e9a1fa26 100644
--- a/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/PrimoBackendFactory.php
@@ -91,7 +91,7 @@ class PrimoBackendFactory implements FactoryInterface
         $configReader = $this->serviceLocator
             ->get(\VuFind\Config\PluginManager::class);
         $this->primoConfig = $configReader->get('Primo');
-        if ($this->serviceLocator->has('VuFind\Log\Logger')) {
+        if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) {
             $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class);
         }
 
diff --git a/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php
index 73cd064b5d0..74115c411a5 100644
--- a/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/SummonBackendFactory.php
@@ -95,7 +95,7 @@ class SummonBackendFactory implements FactoryInterface
             ->get(\VuFind\Config\PluginManager::class);
         $this->config = $configReader->get('config');
         $this->summonConfig = $configReader->get('Summon');
-        if ($this->serviceLocator->has('VuFind\Log\Logger')) {
+        if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) {
             $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class);
         }
         $connector = $this->createConnector();
diff --git a/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php
index 4cfa0e7bd05..4874a7fc33b 100644
--- a/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/WorldCatBackendFactory.php
@@ -95,7 +95,7 @@ class WorldCatBackendFactory implements FactoryInterface
             ->get('config');
         $this->wcConfig = $this->serviceLocator
             ->get(\VuFind\Config\PluginManager::class)->get('WorldCat');
-        if ($this->serviceLocator->has('VuFind\Log\Logger')) {
+        if ($this->serviceLocator->has(\VuFind\Log\Logger::class)) {
             $this->logger = $this->serviceLocator->get(\VuFind\Log\Logger::class);
         }
         $connector = $this->createConnector();
diff --git a/module/VuFind/src/VuFind/View/Helper/Root/HelpTextFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/HelpTextFactory.php
index ded2534fc12..f9fb0b4c587 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/HelpTextFactory.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/HelpTextFactory.php
@@ -61,7 +61,7 @@ class HelpTextFactory implements FactoryInterface
         if (!empty($options)) {
             throw new \Exception('Unexpected options sent to factory.');
         }
-        $lang = $container->has('Zend\Mvc\I18n\Translator')
+        $lang = $container->has(\Zend\Mvc\I18n\Translator::class)
             ? $container->get(\Zend\Mvc\I18n\Translator::class)->getLocale()
             : 'en';
         $helpers = $container->get('ViewHelperManager');
diff --git a/module/VuFind/src/VuFindTest/Unit/DbTestCase.php b/module/VuFind/src/VuFindTest/Unit/DbTestCase.php
index c9669be1f7e..5f288fd53ae 100644
--- a/module/VuFind/src/VuFindTest/Unit/DbTestCase.php
+++ b/module/VuFind/src/VuFindTest/Unit/DbTestCase.php
@@ -105,7 +105,7 @@ abstract class DbTestCase extends TestCase
         $sm = parent::getServiceManager();
 
         // Add database service:
-        if (!$sm->has('VuFind\Db\Table\PluginManager')) {
+        if (!$sm->has(\VuFind\Db\Table\PluginManager::class)) {
             $dbFactory = new \VuFind\Db\AdapterFactory(
                 $sm->get(\VuFind\Config\PluginManager::class)->get('config')
             );
diff --git a/module/VuFind/src/VuFindTest/Unit/TestCase.php b/module/VuFind/src/VuFindTest/Unit/TestCase.php
index 2a06288c2cf..3dd9ff53eef 100644
--- a/module/VuFind/src/VuFindTest/Unit/TestCase.php
+++ b/module/VuFind/src/VuFindTest/Unit/TestCase.php
@@ -226,7 +226,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
     public function getAuthManager()
     {
         $sm = $this->getServiceManager();
-        if (!$sm->has('VuFind\Auth\PluginManager')) {
+        if (!$sm->has(\VuFind\Auth\PluginManager::class)) {
             $authManager = new \VuFind\Auth\PluginManager($sm);
             $sm->setService('VuFind\Auth\PluginManager', $authManager);
         }
-- 
GitLab