Registers a service.

@param string      $id
@param string|null $class

@return ServiceConfigurator
163799
final public function set($id, $class = null)
    {
        $defaults = $this->defaults;
        $allowParent = !$defaults->getChanges() && empty($this->instanceof);

        $definition = new Definition();
        $definition->setPublic($defaults->isPublic());
        $definition->setAutowired($defaults->isAutowired());
        $definition->setAutoconfigured($defaults->isAutoconfigured());
        $definition->setBindings($defaults->getBindings());
        $definition->setChanges(array());

        $configurator = new ServiceConfigurator($this->container, $this->instanceof, $allowParent, $this, $definition, $id, $defaults->getTags());

        return null !== $class ? $configurator->class($class) : $configurator;
    }
751926
protected function registerCommand($alias, $class)
    {
        $this
            ->define($alias, function($channel, $receiver) use($class) {
                return new $class($channel, $receiver);
            })
            ->define($class, function($channel, $receiver) use($class) {
                return new $class($channel, $receiver);
            })
        ;
    }
1116941
public function register($class, $resolver, array $parameters = [], Closure $after = null)
    {
        return $this->bindings[$class] = $this->createBinding($resolver, $parameters, $after);
    }
1152677
private function registerCommand($class, $command)
    {
        $this->app->singleton($this->commandPath . $command, function ($app) use ($class) {
            return $app[$class];
        });

        $this->commands($this->commandPath . $command);
    }
1292650
public function addRolesAction($id, $class, Request $request)
    {
        $object = $this->find($class, $id);
        $roles = $this->decodeIdsString($request, 'Claroline\CoreBundle\Entity\Role');
        $this->crud->patch($object, 'role', Crud::COLLECTION_ADD, $roles);

        return new JsonResponse(
            $this->serializer->serialize($object)
        );
    }
555060
public function getOrCreate($id, $class)
    {
        /** @var LockableEntity $lockable */
        $lockable = $this->findOneBy(['entityId' => $id, 'entityClass' => $class]);

        if ($lockable === null) {
            $lockable = new LockableEntity();
            $lockable->setEntityClass($class);
            $lockable->setEntityId($id);
        }

        return $lockable;
    }
351224
public function find(string $modelClass, string $id = null)
    {
        if (null === $id) {
            return null;
        }

        return $this->getRepositoryByClass($modelClass)->find($id);
    }
937851
public function bind($id, callable $serviceGenerator)
    {
        $this->callables[(string)$id] = function ($zit) use ($serviceGenerator) {
            static $object;

            if (null === $object) {
                $object = $serviceGenerator($zit);
            }

            return $object;
        };
    }
820078
@Override
    public void registerService(Class<?> clazz, Object service) {
        this.services.put(clazz, service);
    }
1122935
private function registerNotifyService()
    {
        $this->singleton(Contracts\Notify::class, function ($app) {
            /**  @var \Illuminate\Config\Repository  $config  */
            $config = $app['config'];

            return new Notify(
                $app[Contracts\SessionStore::class],
                $config->get('notify.session.prefix', 'notifier')
            );
        });
    }
918022
public function registerCommand($commandClass)
    {
        $command = $this->container->make($commandClass);

        $command->setContainer($this->container);

        return $this->symfony->add($command);
    }
1367761
protected function registerService()
	{
	    $this->app->singleton($this->getProviderKey(), function($app)
	    {
	    	return new Service($this->getProviderKey(), null, $this->getAggregateService());
	    });
	}
8085
public function registerAlias($class, $alias)
    {
        $alias = trim($alias);
        $class = trim($class);

        $this->__registry->alias($class, $alias);
    }
1170207
public static function registerLookup($class, $name = null)
    {
        /* @var $class BaseLookup */
        if (is_null($name)) {
            $name = strtolower($class::$lookupName);
        }
        self::$lookups[$name] = $class;
    }
81955
public function add($class = null)
        {
            $class = $this->getClass($class);

            if (!Arrays::exists($class, $this->reflections)) {
                $this->reflections[$class] = new ReflectionClass($class);
            }

            return $this;
        }
502770
public function setClass($identifier, $class)
    {
        $class      = trim($class);
        $identifier = (string) $identifier;

        $this->_classes[$identifier] = $class;

        return $this;
    }
983884
private function registerClass()
    {
        try {
            if (!$this->cacheInstance->isCacheValid($this->api, $this->class) || $this->isDevelopment()) {
                $this->parseClass();
            }
        } catch (\Exception $e) {
            $exception = new RestException('Unable to register class "' . $this->class . '". ' . $e->getMessage());
            $exception->setRequestedClass($this->class);
            throw $exception;
        }
    }