Skip to content
HomeController.php 655 B
Newer Older
Адлан Шамавов's avatar
Адлан Шамавов committed
<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

class HomeController extends AbstractController
{
    private function uniqElements(array $array): array {
        return array_unique($array, SORT_REGULAR);
Адлан Шамавов's avatar
Адлан Шамавов committed
    }

    #[Route('/', name: 'home')]
    public function home(): Response
    {
        $arr = [
            ['laravel', 'php'],
            ['codeigniter', 'php'],
            ['laravel', 'php'],
            ['c++', 'java'],
        ];
        return $this->json($this->uniqElements($arr));
Адлан Шамавов's avatar
Адлан Шамавов committed
    }
}