public static function loadService($service, $config)
{
PubwichLog::log(1, sprintf(Pubwich::_('Loading %s service'), $service));
$file_included = self::requireServiceFile($service);
if (!$file_included) {
throw new PubwichError(sprintf(Pubwich::_('You told Pubwich to use the %s service, but the file <code>%s</code> couldn’t be found.'), $service, $service . '.php'));
}
$classname = $config['method'] ? $config['method'] : $service;
if (!class_exists($classname)) {
throw new PubwichError(sprintf(Pubwich::_('The class %s doesn\'t exist. Check your configuration file for inexistent services or methods.'), $classname));
}
return new $classname($config);
}