<?php namespace App\Controller; use App\Action\Functions; use App\Validation\ArrayValidation; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Attribute\Route; class HomeController extends AbstractController { private Functions $functions; public function __construct(Functions $functions) { $this->functions = $functions; } #[Route('/func1', name: 'home', methods: ['POST'])] public function func1(Request $request): Response { $array = $request->get('arr'); if (!ArrayValidation::validateFunc1($array)) { return new Response("Invalid array"); } $array = $this->functions->sortPrice($array); return $this->json($array); } }