<?php

namespace Modules\Additional\Specifique\Client132\Modules\ProjetAchat\MenuContextuel;

use Helpers\Trad\ITrad;
use Skeleton\Router;
use Modules\Additional\Specifique\Client132\Modules\Repository\ProjetAchat;
use Helpers\ChargeDocument\ChargeDocument;

class GestionProjetMenuContextuelSpecifique
{
    /**
     *
     * @param \PDO $pdo
     * @param Itrad $trad
     * @param array<mixed> $array
     * @return array<mixed>|null
     */
    public static function gestionMenuContextuelSpecifique($pdo, Router $router, $trad, $array)
    {
        $diliEntity = new ProjetAchat($pdo);
        
        $dili = $diliEntity->getUrlGed();
        
        if (count($dili) >= 1) {
            if ($dili[0]['LIBELLE'] == '' && $dili[0]['ALPHA1']  == '') {
                return null;
            }
        } else {
            return null;
        }
        
        return [
            'libelle' => $dili[0]['LIBELLE'],
            'lien' => $dili[0]['ALPHA1'],
        ];
    }
}
