3 namespace Drupal\libraries\ExternalLibrary\Definition;
5 use Drupal\Component\Serialization\SerializationInterface;
6 use Drupal\libraries\ExternalLibrary\Exception\LibraryDefinitionNotFoundException;
9 * Provides a libraries definition discovery using PHP's native file functions.
11 * It supports either a URI with a stream wrapper, an absolute file path or a
12 * file path relative to the Drupal root as a base URI.
14 * By default YAML files are used.
16 * @see \Drupal\libraries\StreamWrapper\LibraryDefinitionsStream
20 class FileDefinitionDiscovery extends FileDefinitionDiscoveryBase implements DefinitionDiscoveryInterface {
25 public function hasDefinition($id) {
26 return file_exists($this->getFileUri($id));
32 protected function getSerializedDefinition($id) {
33 return file_get_contents($this->getFileUri($id));