diff --git a/src/ExternalLibrary/Exception/InvalidLibraryDependencyException.php b/src/ExternalLibrary/Exception/InvalidLibraryDependencyException.php index a3c33530f68a050c08a64a7519dfb02a996b3cf5..004691eac47c9602268b4475f37924512e22f427 100644 --- a/src/ExternalLibrary/Exception/InvalidLibraryDependencyException.php +++ b/src/ExternalLibrary/Exception/InvalidLibraryDependencyException.php @@ -6,9 +6,9 @@ */ namespace Drupal\libraries\ExternalLibrary\Exception; -use Drupal\libraries\ExternalLibrary\DependencyAccessorTrait; +use Drupal\libraries\ExternalLibrary\Utility\DependencyAccessorTrait; use Drupal\libraries\ExternalLibrary\ExternalLibraryInterface; -use Drupal\libraries\ExternalLibrary\LibraryAccessorTrait; +use Drupal\libraries\ExternalLibrary\Utility\LibraryAccessorTrait; /** * diff --git a/src/ExternalLibrary/Exception/LibraryClassNotFoundException.php b/src/ExternalLibrary/Exception/LibraryClassNotFoundException.php index aadfaef04389c4dd877e18248a6c82023cb72dd5..000fa5de8d7707bfe030da81274f42adf378d142 100644 --- a/src/ExternalLibrary/Exception/LibraryClassNotFoundException.php +++ b/src/ExternalLibrary/Exception/LibraryClassNotFoundException.php @@ -6,7 +6,8 @@ */ namespace Drupal\libraries\ExternalLibrary\Exception; -use Drupal\libraries\ExternalLibrary\LibraryIdAccessorTrait; + +use Drupal\libraries\ExternalLibrary\Utility\LibraryIdAccessorTrait; use Exception; /** diff --git a/src/ExternalLibrary/Exception/LibraryDefinitionNotFoundException.php b/src/ExternalLibrary/Exception/LibraryDefinitionNotFoundException.php index 53ebfe0b756b497309bbbccb1d09f64e1d3a6958..80621f9e3eb333643a9c94c4df5bfd08ab54fc41 100644 --- a/src/ExternalLibrary/Exception/LibraryDefinitionNotFoundException.php +++ b/src/ExternalLibrary/Exception/LibraryDefinitionNotFoundException.php @@ -6,7 +6,8 @@ */ namespace Drupal\libraries\ExternalLibrary\Exception; -use Drupal\libraries\ExternalLibrary\LibraryIdAccessorTrait; + +use Drupal\libraries\ExternalLibrary\Utility\LibraryIdAccessorTrait; use Exception; /** diff --git a/src/ExternalLibrary/Registry/ExternalLibraryRegistry.php b/src/ExternalLibrary/Registry/ExternalLibraryRegistry.php index 0c59a641b64cedd013fda5ba4cdbadf3f04dc92c..b31cea867a5ed8517b516ecb4d2a95a66f923ae4 100644 --- a/src/ExternalLibrary/Registry/ExternalLibraryRegistry.php +++ b/src/ExternalLibrary/Registry/ExternalLibraryRegistry.php @@ -44,7 +44,7 @@ class ExternalLibraryRegistry implements ExternalLibraryRegistryInterface { throw new LibraryDefinitionNotFoundException($id); } $definition = $this->getDefinition($id); - $class = $this->getClass($definition); + $class = $this->getClass($id, $definition); return $class::create($id, $definition); } @@ -91,6 +91,8 @@ class ExternalLibraryRegistry implements ExternalLibraryRegistryInterface { /** * Returns the library class for a library definition. * + * @param string $id + * The ID of the external library. * @param array $definition * The library definition array parsed from the definition JSON file. * @@ -99,11 +101,10 @@ class ExternalLibraryRegistry implements ExternalLibraryRegistryInterface { * * @throws \Drupal\libraries\ExternalLibrary\Exception\LibraryClassNotFoundException */ - protected function getClass(array $definition) { + protected function getClass($id, array $definition) { // @todo Reconsider if (!isset($definition['class'])) { - // @todo What if $definition['id'] is not set? - throw new LibraryClassNotFoundException($definition['id']); + throw new LibraryClassNotFoundException($id); } // @todo Make sure the class exists. return $definition['class']; diff --git a/src/StreamWrapper/PhpLibraryFilesStream.php b/src/StreamWrapper/PhpLibraryFilesStream.php index abfcbb752b60afa75b124927e1296b2c4297c578..a05a37289a5064263c0bfb228dda6987b1a1b67c 100644 --- a/src/StreamWrapper/PhpLibraryFilesStream.php +++ b/src/StreamWrapper/PhpLibraryFilesStream.php @@ -39,6 +39,7 @@ class PhpLibraryFilesStream extends LocalStream { * {@inheritdoc} */ public function getDirectoryPath() { + // @todo Provide support for site-specific directories, etc. return 'sites/all/libraries'; }