You are here

function LocalDirectoryAdapter::composerJson in X Autoload 7.5

Same name and namespace in other branches
  1. 7.4 lib/Adapter/LocalDirectoryAdapter.php \Drupal\xautoload\Adapter\LocalDirectoryAdapter::composerJson()

Scans a composer.json file provided by a Composer package.

Parameters

string $file:

bool $relative: If TRUE, the paths will be relative to $this->localDirectory.

Throws

\Exception

Overrides ClassFinderAdapterInterface::composerJson

File

src/Adapter/LocalDirectoryAdapter.php, line 78

Class

LocalDirectoryAdapter
An instance of this class is passed around to implementations of hook_xautoload(). It acts as a wrapper around the ClassFinder, to register stuff.

Namespace

Drupal\xautoload\Adapter

Code

function composerJson($file, $relative = TRUE) {
  $relative && ($file = $this->localDirectory . $file);
  $json = ComposerJson::createFromFile($file);
  $json
    ->writeToAdapter($this->master);
}