Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Extension / ModuleHandler.php
index 7d69c3cb82ba82b64a8f6bb757fcd9fbeec87595..8d43a857dd4c7a678ad190456b2ed14dcfe0b74e 100644 (file)
@@ -5,6 +5,7 @@ namespace Drupal\Core\Extension;
 use Drupal\Component\Graph\Graph;
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Extension\Exception\UnknownExtensionException;
 
 /**
  * Class that manages modules in a Drupal installation.
@@ -172,7 +173,7 @@ class ModuleHandler implements ModuleHandlerInterface {
     if (isset($this->moduleList[$name])) {
       return $this->moduleList[$name];
     }
-    throw new \InvalidArgumentException(sprintf('The module %s does not exist.', $name));
+    throw new UnknownExtensionException(sprintf('The module %s does not exist.', $name));
   }
 
   /**
@@ -429,7 +430,6 @@ class ModuleHandler implements ModuleHandlerInterface {
     return $result;
   }
 
-
   /**
    * Triggers an E_USER_DEPRECATED error if any module implements the hook.
    *
@@ -777,8 +777,7 @@ class ModuleHandler implements ModuleHandlerInterface {
    * {@inheritdoc}
    */
   public function getName($module) {
-    $info = system_get_info('module', $module);
-    return isset($info['name']) ? $info['name'] : $module;
+    return \Drupal::service('extension.list.module')->getName($module);
   }
 
 }