thephpleague/factory-muffin — pull request #116 by GrahamCampbell (2014-07-28 16:33:47+00:00)
Title: Refactored file loading

There are now two functions, and they both have docblocks.

The `loadFactories` function supports being passed an array of path, or just a single path.

The resultant code looks like this:

```php
/**
* Load the specified factories.
*
* @param string|string[] $paths
*
* @return void
*/
public function loadFactories($paths)
{
foreach ((array) $paths as $path) {
if (!is_dir($path)) {
throw new DirectoryNotFound();
}

$this->loadDirectory($path);
}
}

/**
* Load all the files in a directory.
*
* @param string $path
*
* @return void
*/
private function loadDirectory($path)
{
$directory = new RecursiveDirectoryIterator($path);
$iterator = new RecursiveIteratorIterator($directory);
$files = new RegexIterator($iterator, '/^.+\.php$/i');

foreach ($files as $file) {
include_once $file->getPathName();
}
}
```