Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| ContainerServiceProvider | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||
| __invoke | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2021-2022 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * @author Gabriel Felipe Soares <gabriel.felipe.soares@taotesting.com> |
| 21 | */ |
| 22 | |
| 23 | declare(strict_types=1); |
| 24 | |
| 25 | namespace oat\generis\model\DependencyInjection; |
| 26 | |
| 27 | use GuzzleHttp\Psr7\Response; |
| 28 | use GuzzleHttp\Psr7\ServerRequest; |
| 29 | use oat\generis\model\Middleware\MiddlewareExtensionsMapper; |
| 30 | use oat\generis\model\Middleware\MiddlewareRequestHandler; |
| 31 | use oat\oatbox\service\ServiceManager; |
| 32 | use Psr\Http\Message\ResponseInterface; |
| 33 | use Psr\Http\Message\ServerRequestInterface; |
| 34 | use Relay\RelayBuilder; |
| 35 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
| 36 | |
| 37 | use function Symfony\Component\DependencyInjection\Loader\Configurator\param; |
| 38 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
| 39 | |
| 40 | /** |
| 41 | * @codeCoverageIgnore |
| 42 | */ |
| 43 | class ContainerServiceProvider implements ContainerServiceProviderInterface |
| 44 | { |
| 45 | public function __invoke(ContainerConfigurator $configurator): void |
| 46 | { |
| 47 | $services = $configurator->services(); |
| 48 | |
| 49 | $services->set(ServerRequestInterface::class, ServerRequestInterface::class) |
| 50 | ->public() |
| 51 | ->factory(ServerRequest::class . '::fromGlobals'); |
| 52 | |
| 53 | $services |
| 54 | ->set(ServiceManager::class, ServiceManager::class) |
| 55 | ->public() |
| 56 | ->factory(ServiceManager::class . '::getServiceManager'); |
| 57 | |
| 58 | $services->set(ResponseInterface::class, Response::class) |
| 59 | ->public(); |
| 60 | |
| 61 | $services->set(RelayBuilder::class, RelayBuilder::class); |
| 62 | |
| 63 | $services->set(LegacyServiceGateway::class, LegacyServiceGateway::class); |
| 64 | |
| 65 | $services->set(MiddlewareRequestHandler::class, MiddlewareRequestHandler::class) |
| 66 | ->public() |
| 67 | ->args( |
| 68 | [ |
| 69 | service(ContainerServiceProviderInterface::CONTAINER_SERVICE_ID), |
| 70 | service(RelayBuilder::class), |
| 71 | param(MiddlewareExtensionsMapper::MAP_KEY), |
| 72 | ] |
| 73 | ); |
| 74 | } |
| 75 | } |