Add a custom service class.

@param string $serviceClass
@throws InvalidArgumentException
2678
public function addServiceClass($serviceClass)
    {
        if (!is_subclass_of($serviceClass, ManagerInterface::class)) {
            throw new InvalidArgumentException(sprintf('The service class "%s" should implement "ManagerInterface"', $serviceClass));
        }
        $this->serviceClass[] = $serviceClass;
        $this->container->register($serviceClass::getServiceName(), $serviceClass);
    }
906438
public function addClass(ResponsiveImageClass $class)
    {
        $this->classes_added = true;
        if (array_key_exists($class->getName(), $this->classes)) {
            throw new \Exception(sprintf('A responsive image class with name "%s" is already registered', $class->getName()));
        }
        if ($this->default_filters instanceof FilterInterface) {
            $class->addFilter($this->default_filters);
        }
        if ($this->default_post_filters instanceof FilterInterface) {
            $class->addPostFilter($this->default_post_filters);
        }
        if ($this->default_scaling_algorithm != '') {
            $class->setScaleAlgorithm($this->default_scaling_algorithm);
        }
        if ($this->default_output_type_map instanceof OutputTypeMap) {
            $class->setOutputTypeMap($this->default_output_type_map);
        }
        $this->classes[$class->getName()] = $class;
    }
885259
public <T> void serviceClass(Class<T> serviceClass)
  {
    if (Vault.class.isAssignableFrom(serviceClass)) {
      _validatorVault.vaultClass(serviceClass);
    }
    else {
      validateServiceClass(serviceClass);
    }
    
    if (Modifier.isAbstract(serviceClass.getModifiers())
        && ! abstractMethods(serviceClass)) {
      throw error(L.l("abstract service class '{0}' is invalid because the abstract methods can't be generated.",
                      serviceClass.getName()));
    }
    
    serviceMethods(serviceClass);
  }
495227
public static function addRelationClass($name, $class)
    {
        $interface = 'Slick\Orm\RelationInterface';
        if (!class_exists($class)) {
            throw new InvalidArgumentException(
                "{$class} class does not exists"
            );
        }

        $rflClass = new ReflectionClass($class);
        if (!$rflClass->implementsInterface($interface)) {
            throw new InvalidArgumentException(
                "{$class} class does not implement '{$interface}' interface"
            );
        }

        static::$_annotations[$name] = $class;
    }
951787
public function setDateClass(string $dateClass)
    {
        if (!is_a($dateClass, CarbonInterface::class, true)) {
            throw new InvalidArgumentException(sprintf(
                'Given class does not implement %s: %s', CarbonInterface::class, $dateClass
            ));
        }

        $this->dateClass = $dateClass;

        if (is_a($dateClass, Carbon::class, true)) {
            $this->toggleOptions(static::IMMUTABLE, false);
        } elseif (is_a($dateClass, CarbonImmutable::class, true)) {
            $this->toggleOptions(static::IMMUTABLE, true);
        }

        return $this;
    }
1256303
public function setRuntimeServices($runtimeServices)
    {
        if (!in_array(gettype($runtimeServices), ['array', 'object'])) {
            throw new \InvalidArgumentException("The service provider list must be an array or an object, given " . gettype($runtimeServices));
        }

        $this->runtimeServices = array_merge($this->runtimeServices, (new Model($runtimeServices))->toArray());
    }
251496
private function ensureServiceProvider(string $providerClass)
    {
        if (!is_subclass_of($providerClass, AbstractServiceProvider::class)) {
            throw new InvalidArgumentException(
                sprintf('Class "%s" must be a subclass of "%s".', $providerClass, AbstractServiceProvider::class)
            );
        }
    }
1043607
public function addService(Service $service) {
    if (!in_array($service, $this->services, TRUE)) {
      $this->services[] = $service;
      
      if ($service instanceof \Psc\System\LoggerObject && $service->getLogger() instanceof \Psc\System\DispatchingLogger) {
        $this->getLogger()->listenTo($service->getLogger());
      }
    }
    return $this;
  }
1032739
public function addCustomField($name, $class)
    {
        if (!$this->hasCustomField($name)) {
            return $this->customTypes[$name] = $class;
        }

        throw new \InvalidArgumentException('Custom field ['.$name.'] already exists on this form object.');
    }
142636
public function addRepository($repositoryClass, $serviceId, $entityClass)
    {
        $repositoryDefinition = $this->definitionFactory->build($repositoryClass, $serviceId, $entityClass);

        // this array is not ordered by slug
        $this->definitions[] = $repositoryDefinition;
    }
308319
public function addInstance(string $class, $service, bool $share = true)
    {
        $this->services[$class] = $service;
        $this->instantiated[$class] = $service;
        $this->shared[$class] = $share;
    }
289145
public function setContainerClass(string $containerClass)
    {
        if (!\class_exists($containerClass)
            || (
                $containerClass !== DIContainer::class
                && !\is_subclass_of($containerClass, DIContainer::class)
            )
        ) {
            throw new \InvalidArgumentException(
                \sprintf('class "%s" must extend %s', $containerClass, DIContainer::class)
            );
        }

        $this->containerClass = $containerClass;

        return $this;
    }
308861
protected function loadInstanceFromContainer($containerClass) {
        $this->containerInstance = $this->loadIntermediateContainerInstance($containerClass);

        try {
            $this->instance = $this->containerInstance->getInstance();
        } catch (BadConfigurationException $e) {
            $e = new ServiceException($e->getMessage(), $e->getCode(), $e);
            $e->setServiceName($this->serviceName);
            throw $e;
        }
    }
169924
public function setSpectralClass($spectralClass)
    {
        $allowedValues = $this->getSpectralClassAllowableValues();
        if (!in_array($spectralClass, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'spectralClass', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['spectralClass'] = $spectralClass;

        return $this;
    }
914223
public function setMetadataClass(string $metadataClass): void
    {
        if (! class_exists($metadataClass) || ! (new \ReflectionClass($metadataClass))->implementsInterface(ClassMetadataInterface::class)) {
            throw InvalidArgumentException::create(InvalidArgumentException::INVALID_METADATA_CLASS, $metadataClass);
        }

        $this->metadataClass = $metadataClass;
    }
1329091
public function add($mappingClass)
    {
        try {
            if ($mappingClass instanceof MappingInterface) {
                $mappingClassInstance = $mappingClass;
            } else {
                $reflectionClass = new \ReflectionClass($mappingClass);
                $mappingClassInstance = $reflectionClass->newInstance();
                if (!$mappingClassInstance instanceof MappingInterface) {
                    throw new InvalidMappingClassException('Mapping class must be an instance of MappingInterface');
                }
            }
            self::$container[$mappingClassInstance->getName()] = $mappingClassInstance;
        } catch (\Exception $ex) {
            throw new InvalidMappingClassException($ex->getMessage());
        }
        return $this;
    }
220237
public function addCustomNodeClass(string $name, string $class): self{
        if(!is_subclass_of($class, NodeInterface::class)){
            throw new \InvalidArgumentException();
        }

        $this->customNodes[$name]   = $class;

        return $this;
    }