$providerArray) { $providersCollection->addItem( self::create($providerArray), $providerKey ); if ($providersServices && array_key_exists($providerKey, $providersServices)) { foreach ((array)$providersServices[$providerKey] as $serviceKey => $providerService) { if (array_key_exists($serviceKey, $services)) { $providersCollection->getItem($providerKey)->getServiceList()->addItem( ServiceFactory::create(array_merge( $services[$serviceKey], $providerService )), $serviceKey ); } } } } return $providersCollection; } }