Skip to content
Snippets Groups Projects
Commit a615ba3c authored by Tobias Zimmermann's avatar Tobias Zimmermann
Browse files

by tstoeckler: Clean-up some namespaces et al

parent 52e91afc
No related branches found
No related tags found
No related merge requests found
......@@ -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;
/**
*
......
......@@ -6,7 +6,8 @@
*/
namespace Drupal\libraries\ExternalLibrary\Exception;
use Drupal\libraries\ExternalLibrary\LibraryIdAccessorTrait;
use Drupal\libraries\ExternalLibrary\Utility\LibraryIdAccessorTrait;
use Exception;
/**
......
......@@ -6,7 +6,8 @@
*/
namespace Drupal\libraries\ExternalLibrary\Exception;
use Drupal\libraries\ExternalLibrary\LibraryIdAccessorTrait;
use Drupal\libraries\ExternalLibrary\Utility\LibraryIdAccessorTrait;
use Exception;
/**
......
......@@ -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'];
......
......@@ -39,6 +39,7 @@ class PhpLibraryFilesStream extends LocalStream {
* {@inheritdoc}
*/
public function getDirectoryPath() {
// @todo Provide support for site-specific directories, etc.
return 'sites/all/libraries';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment