public function makeServiceInstance(string $className, $arguments = NULL, $configuration = NULL) {
        $instance = NULL;

        $implInterfaces = class_implements($className);
        if(in_array(ConstructorAwareServiceInterface::class, $implInterfaces)) {
            /** @var ConstructorAwareServiceInterface $className */
            if($args = $className::getConstructorArguments()) {
                $newArguments = [];

                foreach($args as $argName => $argValue) {
                    $newArguments[] = is_null($argValue) ? ($arguments[$argName] ?? NULL) : $argValue;
                }

                $arguments = $newArguments;
            }
        }

        if($arguments)
            $arguments = $this->mapArray( AbstractCollection::makeArray($arguments), true);

        if(in_array(StaticConstructorServiceInterface::class, $implInterfaces)) {
            $instance = new $className($arguments, $this);
        } elseif (in_array(DynamicConstructorServiceInterface::class, $implInterfaces)) {
            $sig = SignatureService::getSignatureService()->getMethodSignature($className, "__construct");
            $args = [];
            foreach($sig as $name => $type) {

            }
            $instance = new $className(...$args);
        } else {
            $instance = $arguments ? new $className(...array_values($arguments)) : new $className();
        }

        if($configuration && method_exists($instance, 'setConfiguration')) {
            $configuration = $this->mapArray( $configuration );
            $instance->setConfiguration($configuration);
        }

        return $instance;
    }
public function makeServiceInstance(string $className, $arguments = NULL, $configuration = NULL) {
        $instance = NULL;

        $implInterfaces = class_implements($className);
        if(in_array(ConstructorAwareServiceInterface::class, $implInterfaces)) {
            /** @var ConstructorAwareServiceInterface $className */
            if($args = $className::getConstructorArguments()) {
                $newArguments = [];

                foreach($args as $argName => $argValue) {
                    $newArguments[] = is_null($argValue) ? ($arguments[$argName] ?? NULL) : $argValue;
                }

                $arguments = $newArguments;
            }
        }

        if($arguments)
            $arguments = $this->mapArray( AbstractCollection::makeArray($arguments), true);

        if(in_array(StaticConstructorServiceInterface::class, $implInterfaces)) {
            $instance = new $className($arguments, $this);
        } elseif (in_array(DynamicConstructorServiceInterface::class, $implInterfaces)) {
            $sig = SignatureService::getSignatureService()->getMethodSignature($className, "__construct");
            $args = [];
            foreach($sig as $name => $type) {

            }
            $instance = new $className(...$args);
        } else {
            $instance = $arguments ? new $className(...array_values($arguments)) : new $className();
        }

        if($configuration && method_exists($instance, 'setConfiguration')) {
            $configuration = $this->mapArray( $configuration );
            $instance->setConfiguration($configuration);
        }

        return $instance;
    }
public function makeServiceInstance ( string $ className , $ arguments = NULL , $ configuration = NULL ) { $ instance = NULL ; $ implInterfaces = class_implements ( $ className ) ; if ( in_array ( ConstructorAwareServiceInterface :: class , $ implInterfaces ) ) { /** @var ConstructorAwareServiceInterface $className */ if ( $ args = $ className :: getConstructorArguments ( ) ) { $ newArguments = [ ] ; foreach ( $ args as $ argName => $ argValue ) { $ newArguments [ ] = is_null ( $ argValue ) ? ( $ arguments [ $ argName ] ?? NULL ) : $ argValue ; } $ arguments = $ newArguments ; } } if ( $ arguments ) $ arguments = $ this -> mapArray ( AbstractCollection :: makeArray ( $ arguments ) , true ) ; if ( in_array ( StaticConstructorServiceInterface :: class , $ implInterfaces ) ) { $ instance = new $ className ( $ arguments , $ this ) ; } elseif ( in_array ( DynamicConstructorServiceInterface :: class , $ implInterfaces ) ) { $ sig = SignatureService :: getSignatureService ( ) -> getMethodSignature ( $ className , "__construct" ) ; $ args = [ ] ; foreach ( $ sig as $ name => $ type ) { } $ instance = new $ className ( ... $ args ) ; } else { $ instance = $ arguments ? new $ className ( ... array_values ( $ arguments ) ) : new $ className ( ) ; } if ( $ configuration && method_exists ( $ instance , 'setConfiguration' ) ) { $ configuration = $ this -> mapArray ( $ configuration ) ; $ instance -> setConfiguration ( $ configuration ) ; } return $ instance ; }
This method should be used to create service instances. It will check implementations and create it the requested manner.

@param string $className
@param array|iterable|null $arguments
@param array|iterable|null $configuration
@return object|null
This method should be used to create service instances . It will check implementations and create it the requested manner .