Your project controllers should only contains actions as public methods 2
- Read doc
- Productivity
- Major
More information: https://insight.symfony.com/what-we-analyse/symfony.controller.non_action_public_method_in_controller_class
- protected int $criticalExitCode,
- protected ?string $authToken = null
- ) {
- }
- public function __invoke(Request $request, MonitoringManager $monitoringManager, SerializerInterface $serializer): Response
- {
- if ($this->authToken !== null
- && $request->headers->get('X-Auth-Token', '') !== $this->authToken) {
- return new Response('Unauthorized', 401);
- }
- use Symfony\Component\HttpFoundation\Response;
- use whatwedo\MonitorBundle\Manager\MonitoringManager;
- class DashboardController extends AbstractController
- {
- public function __invoke(MonitoringManager $monitoringManager): Response
- {
- return $this->render('@whatwedoMonitor/dashboard.html.twig', [
- 'result' => $monitoringManager->getResult(),
- ]);
- }
The code of your project must follow PSR-1 basic coding standard 2
- Read doc
- Productivity
- Minor
More information: https://insight.symfony.com/what-we-analyse/php.psr1
- /**
- * This is the class that loads and manages your bundle configuration.
- *
- * @see http://symfony.com/doc/current/cookbook/bundles/extension.html
- */
- class whatwedoMonitorExtension extends Extension implements PrependExtensionInterface
- {
- public function load(array $configs, ContainerBuilder $container): void
- {
- $configuration = new Configuration();
- $config = $this->processConfiguration($configuration, $configs);
- use Symfony\Component\DependencyInjection\ContainerBuilder;
- use Symfony\Component\HttpKernel\Bundle\Bundle;
- use whatwedo\MonitorBundle\DependencyInjection\CompilerPass\AttributeCompilerPass;
- class whatwedoMonitorBundle extends Bundle
- {
- public function build(ContainerBuilder $container): void
- {
- parent::build($container);
whatwedo