get("type"); if (!class_exists($classname)) { throw new Exception\ServiceNotFound(sprintf('Service %s not found', $classname)); } try { $options = $configuration->get("options"); } catch (\Exception $e) { $options = array(); } $mandatory = $classname::getMandatoryOptions(); if ($mandatory !== array_intersect($mandatory, array_keys($options))) { throw new Exception\MissingParameters( sprintf( 'Missing parameters %s' , implode(', ', array_diff($mandatory, array_keys($options))) ) ); } return new $classname($core, $name, $options); } }