/** * {@inherits} */ public static function factory($config = null, array $globalParameters = array()) { $loader = new ServiceBuilderLoader(); $loader->addAlias('_hmb', self::getDefaultServiceDefinition()); if (is_array($config)) { $config = $config + $globalParameters; } return $loader->load(self::getDefaultServiceDefinition(), $config); }
/** * Create a new service locator for the AWS SDK * * You can configure the service locator is four different ways: * * 1. Use the default configuration file shipped with the SDK that wires class names with service short names and * specify global parameters to add to every definition (e.g. key, secret, credentials, etc) * * 2. Use a custom configuration file that extends the default config and supplies credentials for each service. * * 3. Use a custom config file that wires services to custom short names for services. * * 4. If you are on Amazon EC2, you can use the default configuration file and not provide any credentials so that * you are using InstanceProfile credentials. * * @param array|string $config The full path to a .php or .js|.json file, or an associative array of data * to use as global parameters to pass to each service. * @param array $globalParameters Global parameters to pass to every service as it is instantiated. * * @return Aws */ public static function factory($config = null, array $globalParameters = array()) { if (!$config) { // If nothing is passed in, then use the default configuration file with credentials from the environment $config = self::getDefaultServiceDefinition(); } elseif (is_array($config)) { // If an array was passed, then use the default configuration file with parameter overrides $globalParameters = $config; $config = self::getDefaultServiceDefinition(); } $loader = new ServiceBuilderLoader(); $loader->addAlias('_aws', self::getDefaultServiceDefinition())->addAlias('_sdk1', __DIR__ . '/Resources/sdk1-config.php'); return $loader->load($config, $globalParameters); }
/** * fix a php notice for mission services in $b * * @param array $a * @param array $b * * @return array */ protected function mergeData(array $a, array $b) { if (isset($b['services']) === false) { return $b + $a; } return parent::mergeData($a, $b); }
public function tstDoesNotErrorOnCircularReferences() { $arrayFactory = new ServiceBuilderLoader(); $arrayFactory->load(array('services' => array('too' => array('extends' => 'ball'), 'ball' => array('extends' => 'too')))); }