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 @@ ...@@ -6,9 +6,9 @@
*/ */
namespace Drupal\libraries\ExternalLibrary\Exception; 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\ExternalLibraryInterface;
use Drupal\libraries\ExternalLibrary\LibraryAccessorTrait; use Drupal\libraries\ExternalLibrary\Utility\LibraryAccessorTrait;
/** /**
* *
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
*/ */
namespace Drupal\libraries\ExternalLibrary\Exception; namespace Drupal\libraries\ExternalLibrary\Exception;
use Drupal\libraries\ExternalLibrary\LibraryIdAccessorTrait;
use Drupal\libraries\ExternalLibrary\Utility\LibraryIdAccessorTrait;
use Exception; use Exception;
/** /**
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
*/ */
namespace Drupal\libraries\ExternalLibrary\Exception; namespace Drupal\libraries\ExternalLibrary\Exception;
use Drupal\libraries\ExternalLibrary\LibraryIdAccessorTrait;
use Drupal\libraries\ExternalLibrary\Utility\LibraryIdAccessorTrait;
use Exception; use Exception;
/** /**
......
...@@ -44,7 +44,7 @@ class ExternalLibraryRegistry implements ExternalLibraryRegistryInterface { ...@@ -44,7 +44,7 @@ class ExternalLibraryRegistry implements ExternalLibraryRegistryInterface {
throw new LibraryDefinitionNotFoundException($id); throw new LibraryDefinitionNotFoundException($id);
} }
$definition = $this->getDefinition($id); $definition = $this->getDefinition($id);
$class = $this->getClass($definition); $class = $this->getClass($id, $definition);
return $class::create($id, $definition); return $class::create($id, $definition);
} }
...@@ -91,6 +91,8 @@ class ExternalLibraryRegistry implements ExternalLibraryRegistryInterface { ...@@ -91,6 +91,8 @@ class ExternalLibraryRegistry implements ExternalLibraryRegistryInterface {
/** /**
* Returns the library class for a library definition. * Returns the library class for a library definition.
* *
* @param string $id
* The ID of the external library.
* @param array $definition * @param array $definition
* The library definition array parsed from the definition JSON file. * The library definition array parsed from the definition JSON file.
* *
...@@ -99,11 +101,10 @@ class ExternalLibraryRegistry implements ExternalLibraryRegistryInterface { ...@@ -99,11 +101,10 @@ class ExternalLibraryRegistry implements ExternalLibraryRegistryInterface {
* *
* @throws \Drupal\libraries\ExternalLibrary\Exception\LibraryClassNotFoundException * @throws \Drupal\libraries\ExternalLibrary\Exception\LibraryClassNotFoundException
*/ */
protected function getClass(array $definition) { protected function getClass($id, array $definition) {
// @todo Reconsider // @todo Reconsider
if (!isset($definition['class'])) { if (!isset($definition['class'])) {
// @todo What if $definition['id'] is not set? throw new LibraryClassNotFoundException($id);
throw new LibraryClassNotFoundException($definition['id']);
} }
// @todo Make sure the class exists. // @todo Make sure the class exists.
return $definition['class']; return $definition['class'];
......
...@@ -39,6 +39,7 @@ class PhpLibraryFilesStream extends LocalStream { ...@@ -39,6 +39,7 @@ class PhpLibraryFilesStream extends LocalStream {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getDirectoryPath() { public function getDirectoryPath() {
// @todo Provide support for site-specific directories, etc.
return 'sites/all/libraries'; return 'sites/all/libraries';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment