Skip to content

Instantly share code, notes, and snippets.

@bakura10
Created August 31, 2013 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bakura10/6399288 to your computer and use it in GitHub Desktop.
Save bakura10/6399288 to your computer and use it in GitHub Desktop.
<?php
class PluginManagerFactory implements FactoryInterface
{
public function createService(ServiceLocator $locator, $requestedName)
{
// $requestedName is "SlmQueue\Job\JobPluginManager"
$pluginManager = new $requestedName();
$configPath = $pluginManager->getConfigPath();
$configParts = explode('/', $configPath);
$config = $locator->get('Config');
foreach ($configParts as $configPart) {
$config = $config[$configPart];
}
$pluginManager->setConfig($config);
return $pluginManager;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment