Batch register services

@param array|\Traversable $services
@throws \InvalidArgumentException
@return \ValuSo\Broker\ServiceLoader
771333
public function registerServices($services)
	{
	    
	    if (!is_array($services) && !($services instanceof Traversable)) {
	        throw new Exception\InvalidArgumentException(sprintf(
                'Expected an array or Traversable; received "%s"',
                (is_object($services) ? get_class($services) : gettype($services))
	        ));
	    }
	    
		foreach($services as $key => $impl){
		    
		    if (is_string($impl)) {
		        $impl = ['name' => $impl];
		    }
		    
			$id 		= isset($impl['id']) ? $impl['id'] : $key;
			$name 	    = isset($impl['name']) ? $impl['name'] : null;
			$service 	= isset($impl['service']) ? $impl['service'] : null;
			$factory 	= isset($impl['factory']) ? $impl['factory'] : null;
			$options 	= isset($impl['options']) ? $impl['options'] : null;
			$priority 	= isset($impl['priority']) ? $impl['priority'] : 1;
			
			if (!$service && isset($impl['class'])) {
			    $service = $impl['class'];
			}

			if(is_null($options) && isset($impl['config'])){
			    $options = $impl['config'];
			}
			
			if(!$name){
				throw new Exception\InvalidArgumentException('Service name is not defined for service: '.$id);
			}
			
			$this->registerService($id, $name, $service, $options, $priority);
			
			if (array_key_exists('enabled', $impl) && !$impl['enabled']) {
			    $this->disableService($id);
			}
			
			if($factory){
			    $this->getServicePluginManager()->setFactory(
		            $id, $factory);
			}
		}
		
		return $this;
	}
1266084
public function register($class, $transforms)
    {
        if (!is_array($transforms)) {
            $transforms = array($transforms);
        }
        foreach ($transforms as $t) {
            if (!($t instanceof TransformationInterface)) {
                throw new \InvalidArgumentException("Only instances of TransformationInterface can be registered");
            }
        }

        if (!isset($this->transforms[$class])) {
            $this->classes[] = $class;
            $this->transforms[$class] = array();
        }

        foreach ($transforms as $t) {
            $this->transforms[$class][] = $t;
        }
    }
428284
public function register()
    {
        $loader = AliasLoader::getInstance();

        // Register aliases
        foreach ($this->getAliases() as $alias => $class) {
            $loader->alias($alias, $class);
        }

        // Register service containers
        foreach ($this->getServiceContainers() as $abstract => $concrete) {
            $this->app->singleton($abstract, $concrete);
        }
    }
859476
public function add($service, $alias = '', $args = [])
    {
        // Register the service as a prototype
        if (!empty($args)) {
            if (empty($alias)) {
                $this->container->add($service)->withArgument($args);
            } else {
                $this->container->add($alias, $service)->withArgument($args);
            }
        } else {
            if (empty($alias)) {
                $this->container->add($service);
            } else {
                $this->container->add($alias, $service);
            }
        }
    }
566081
public function register($name, $service, $args = [], $params = false)
    {
        return $this->factory->register($name, $service, $args, $params);
    }
581601
public function registerService(Service\Serviceable $service, Service\Configurable $config)
    {
        $service->register($this->container, $config);
    }
662403
public function registerRawRouting(array $routes, PackageResolver $resolver)
    {
        foreach ($routes as $key => &$route) {
            // Package
            if (isset($route['package'])) {
                if (!isset($route['pattern'])) {
                    throw new \InvalidArgumentException(sprintf('Route need pattern: %s', print_r($route, true)));
                }

                if (!$resolver->exists($route['package'])) {
                    throw new \InvalidArgumentException(sprintf(
                        'Package %s not exists when register routing: %s.',
                        $route['package'],
                        $key
                    ));
                }

                $package = $resolver->getPackage($route['package']);

                $package->loadRouting($this, $route['pattern']);

                continue;
            }

            // Simple route
            $this->addRouteByConfig($key, $route);
        }

        return $this;
    }
534604
public function register(array $serviceMapping)
    {
        foreach ($serviceMapping as $interfaceName => $versions) {
            foreach ($versions as $version => $methods) {
                $this->registerRoute($interfaceName, $version, $methods);
            }
        }
    }
1326388
protected function registerService()
	{
	    $this->app->singleton($this->getProviderKey(), function($app)
	    {
	    	return new Service($this->getProviderKey(), new Processor($this->getAggregateService()), $this->getAggregateService());
	    });
	}
476323
public function addByArray(array $services = [])
  {
    if (!empty($services)) {
      foreach ($services as $name => $methods) {
        if (!$this->has($name)) {
          $service = new Service();

          foreach ($methods as $method => $value) {
            if (method_exists($service, $method)) {
              $service->{$method}($value);
            } else {
                throw new ServiceMethodNotExists(sprintf(
                  "Method '%s' does not exists on the %s service.",
                  $method,
                  $name
                ));
              }
          }

          $this->services[$name] = $service;

          continue;
        }

        throw new ServiceAlreadyExists(sprintf(
          "Service '%s' already exists.",
          $name
        ));
      }
    }

    return $this;
  }
586758
protected function registerBaseServiceProviders()
    {
        $this->register(new \Illuminate\Events\EventServiceProvider($this));
        $this->register(new \Illuminate\Log\LogServiceProvider($this));
        $this->register(new \LaraPress\Actions\ActionServiceProvider($this));
        $this->register(new \LaraPress\Filters\FilterServiceProvider($this));
        $this->register(new \LaraPress\Routing\RoutingServiceProvider($this));
    }
330797
public static function register(ContainerBuilder $container, array $refMap, $callerId = null)
    {
        foreach ($refMap as $id => $ref) {
            if (!$ref instanceof Reference) {
                throw new InvalidArgumentException(sprintf('Invalid service locator definition: only services can be referenced, "%s" found for key "%s". Inject parameter values using constructors instead.', is_object($ref) ? get_class($ref) : gettype($ref), $id));
            }
            $refMap[$id] = new ServiceClosureArgument($ref);
        }
        ksort($refMap);

        $locator = (new Definition(ServiceLocator::class))
            ->addArgument($refMap)
            ->setPublic(false)
            ->addTag('container.service_locator');

        if (!$container->has($id = 'service_locator.'.ContainerBuilder::hash($locator))) {
            $container->setDefinition($id, $locator);
        }

        if (null !== $callerId) {
            $locatorId = $id;
            // Locators are shared when they hold the exact same list of factories;
            // to have them specialized per consumer service, we use a cloning factory
            // to derivate customized instances from the prototype one.
            $container->register($id .= '.'.$callerId, ServiceLocator::class)
                ->setPublic(false)
                ->setFactory(array(new Reference($locatorId), 'withContext'))
                ->addArgument($callerId)
                ->addArgument(new Reference('service_container'));
        }

        return new Reference($id);
    }
1302263
public function addRepositories($repositories)
    {
        if (!is_array($repositories) && (!is_object($repositories) || !$repositories instanceof \Traversable)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid argument provided for $repositories, expecting either an array or Traversable object, but' .
                ' "%s" given',
                is_object($repositories) ? get_class($repositories) : gettype($repositories)
            ));
        }
        foreach ($repositories as $repo) {
            $this->addRepository($repo);
        }
    }
426712
private function registerLaravelSocialiteService()
    {
        $this->app->bind(\Acacha\LaravelSocial\Services\LaravelSocialiteService::class, function ($app) {
            return new LaravelSocialiteService(
                new \Acacha\Filesystem\Compiler\StubFileCompiler(),
                new \Acacha\Filesystem\Filesystem()
            );
        });
    }
867999
private function registerServiceProviders()
    {
        foreach ($this->serviceProviders as $key => $serviceClass) {
            $this->container[$key] = $this->share(function () use ($serviceClass) {
                return $this->make($serviceClass);
            });
        }
    }
698040
public static function registerTasks(array $tasks)
    {
        // Register Tasks
        foreach ($tasks as $key => $task) {
            $roles = array_key_exists('roles', $task) ? $task['roles'] : null;
            self::registerTask($key, $task['desc'], $task['callback'], $roles);
        }
    }
1199824
function withScoped(array $services) {
        foreach ($services as $method => $type) {
            $this->bind($method, $type, self::SCOPED);
        }
        return $this;
    }