Skip to content

Commit

Permalink
Added seed mutator
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateu Aguiló Bosch committed Jun 14, 2015
1 parent 14bd674 commit cf4bf1a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ class Loader implements LoaderInterface {
*/
protected static $classMap;

/**
* Seed.
*
* This is the path of the composer.json file that triggered the bootstrap.
*
* @var
*/
protected static $seed;

/**
* {@inheritdoc}
*/
Expand All @@ -32,7 +41,7 @@ public static function autoload($class) {
$finder = $resolver->resolve();
// Have the path finder require the file and return TRUE or FALSE if it
// found the file or not.
$finder->requireFile();
$finder->requireFile(static::$seed);
return TRUE;
}
catch (ClassLoaderException $e) {
Expand All @@ -47,4 +56,11 @@ public static function setClassMap(array $class_map) {
static::$classMap = $class_map;
}

/**
* {@inheritdoc}
*/
public static function setSeed($seed) {
static::$seed = $seed;
}

}
7 changes: 7 additions & 0 deletions src/LoaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ public static function autoload($class);
*/
public static function setClassMap(array $class_map);

/**
* Sets the seed path.
*
* @param string $seed.
*/
public static function setSeed($seed);

}

0 comments on commit cf4bf1a

Please sign in to comment.