public function yieldServices(array $serviceNames, array $classNames, bool $includeSubclasses = true, bool $forceClassDetection = true) {

        $matchClass = function($className) use ($includeSubclasses, $classNames) {
            if(in_array($className, $classNames))
                return true;
            if($includeSubclasses) {
                foreach($classNames as $cn) {
                    if(is_subclass_of($className, $cn))
                        return true;
                }
            }
            return false;
        };

        /**
         * @var string $serviceName
         * @var ContainerInterface $container
         */
        foreach($this->serviceData as $serviceName => $container) {
            if(in_array($serviceName, $serviceNames) || $matchClass($this->getServiceClass($serviceName, $forceClassDetection))) {
                yield $serviceName => new ServicePromise(function() use($container) {return $container->getInstance();});
            }
        }
    }
public function yieldServices(array $serviceNames, array $classNames, bool $includeSubclasses = true, bool $forceClassDetection = true) {

        $matchClass = function($className) use ($includeSubclasses, $classNames) {
            if(in_array($className, $classNames))
                return true;
            if($includeSubclasses) {
                foreach($classNames as $cn) {
                    if(is_subclass_of($className, $cn))
                        return true;
                }
            }
            return false;
        };

        /**
         * @var string $serviceName
         * @var ContainerInterface $container
         */
        foreach($this->serviceData as $serviceName => $container) {
            if(in_array($serviceName, $serviceNames) || $matchClass($this->getServiceClass($serviceName, $forceClassDetection))) {
                yield $serviceName => new ServicePromise(function() use($container) {return $container->getInstance();});
            }
        }
    }
public function yieldServices ( array $ serviceNames , array $ classNames , bool $ includeSubclasses = true , bool $ forceClassDetection = true ) { $ matchClass = function ( $ className ) use ( $ includeSubclasses , $ classNames ) { if ( in_array ( $ className , $ classNames ) ) return true ; if ( $ includeSubclasses ) { foreach ( $ classNames as $ cn ) { if ( is_subclass_of ( $ className , $ cn ) ) return true ; } } return false ; } ; /**
         * @var string $serviceName
         * @var ContainerInterface $container
         */ foreach ( $ this -> serviceData as $ serviceName => $ container ) { if ( in_array ( $ serviceName , $ serviceNames ) || $ matchClass ( $ this -> getServiceClass ( $ serviceName , $ forceClassDetection ) ) ) { yield $ serviceName => new ServicePromise ( function ( ) use ( $ container ) { return $ container -> getInstance ( ) ; } ) ; } } }
Yields all services that match required service names or required class names.

@param array $serviceNames
@param array $classNames
@param bool $includeSubclasses
@param bool $forceClassDetection
@return \Generator
Yields all services that match required service names or required class names .