Issues (587)

src/Controller/DiscoveryMainConfigsAction.php (4 issues)

Labels
Severity
1
<?php
2
3
namespace ControleOnline\Controller;
4
5
use ControleOnline\Entity\Config;
6
use ControleOnline\Entity\People;
0 ignored issues
show
The type ControleOnline\Entity\People was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use ControleOnline\Service\ConfigService;
8
use ControleOnline\Service\HydratorService;
9
use Symfony\Component\HttpFoundation\Request;
0 ignored issues
show
The type Symfony\Component\HttpFoundation\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Doctrine\ORM\EntityManagerInterface;
0 ignored issues
show
The type Doctrine\ORM\EntityManagerInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Exception;
12
use Symfony\Component\HttpFoundation\JsonResponse;
0 ignored issues
show
The type Symfony\Component\HttpFoundation\JsonResponse was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
class DiscoveryMainConfigsAction
15
{
16
  public function __construct(
17
    private EntityManagerInterface $manager,
18
    private HydratorService $hydratorService,
19
    private ConfigService $configService
20
  ) {}
21
22
  public function __invoke(Request $request): JsonResponse
23
  {
24
    try {
25
      $json = json_decode($request->getContent(), true);
26
      $device = $this->manager->getRepository(People::class)->findOneBy(['device' => $request->headers->get('device')]);
27
      $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
28
      $configs = $this->configService->discoveryMainConfigs($people, $device);
29
      return new JsonResponse($this->hydratorService->collectionData($configs, Config::class, 'config:read'));
30
    } catch (Exception $e) {
31
      return new JsonResponse($this->hydratorService->error($e));
32
    }
33
  }
34
}
35