sms-store/src/App/Service/SZEPManagerServiceFactory.php

34 lines
965 B
PHP
Raw Normal View History

<?php
namespace App\Service;
use Doctrine\ORM\EntityManager;
use GuzzleHttp\Client;
use Interop\Container\ContainerInterface;
class SZEPManagerServiceFactory
{
/**
* @param ContainerInterface $container
* @return SZEPManagerService
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container)
{
$httpClient = new Client([
'cookies' => true,
'headers' => [
'Content-Type' => 'text/xml; charset=UTF-8',
]
]);
$config = $container->get('config');
/** @var EntityManager $em */
$em = $container->get('doctrine.entity_manager.orm_default');
/** @var KoinService $koinService */
$koinService = $container->get(KoinService::class);
return new SZEPManagerService($httpClient, $config, $em, $koinService);
}
}