Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| ApiController | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| index | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Controller; |
| 4 | |
| 5 | use Olz\Api\OlzApi; |
| 6 | use Olz\Utils\HttpUtils; |
| 7 | use Psr\Log\LoggerInterface; |
| 8 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
| 9 | use Symfony\Component\HttpFoundation\Request; |
| 10 | use Symfony\Component\HttpFoundation\Response; |
| 11 | use Symfony\Component\Routing\Annotation\Route; |
| 12 | |
| 13 | class ApiController extends AbstractController { |
| 14 | #[Route('/api/{endpoint_name}')] |
| 15 | public function index( |
| 16 | Request $request, |
| 17 | LoggerInterface $log, |
| 18 | HttpUtils $httpUtils, |
| 19 | OlzApi $olz_api, |
| 20 | string $endpoint_name |
| 21 | ): Response { |
| 22 | $httpUtils->countRequest($request); |
| 23 | |
| 24 | $olz_api->setLogger($log); |
| 25 | |
| 26 | $request->server->set('PATH_INFO', "/{$endpoint_name}"); |
| 27 | return $olz_api->getResponse($request); |
| 28 | } |
| 29 | } |