<?php

namespace Modules\Additional\Specifique\Client37\Modules\Panier\Service;

use Entity\Model\OxaUserPanierImputation;
use Helpers\Outil\Sql;
use Modules\Additional\Specifique\Client28\Modules\Panier\Service\SpecPanierLigneService as ServiceSpecPanierLigneService;

class SpecPanierService
{
    /**
     * @param \PDO $pdo
     * @return boolean
     */
    public static function eclatementActive($pdo) : bool
    {
        return false;
    }

    /**
     * Summary of workflowSpecifique
     * @param mixed $cde
     * @param array<mixed> $post
     * @param string $critereVue
     * @return void
     */
    public static function workflowSpecifique($cde, $post, $critereVue):void
    {
        $algoSpecif = (string)$cde->ListSignataire->AlgoSpecif;
        unset($cde->ListSignataire);
        
        $cde->addChild('ListSignataire');
        self::addNode($cde, 'AlgoSpecif', $algoSpecif);
        $cde->ListSignataire->addChild('Signataire');
        self::addNode($cde->ListSignataire->Signataire, 'Utilisateur', $post['sign_spec_'.$critereVue]);
    }

    private static function addNode(\SimpleXMLElement $xml, string $tag, string $value):void
    {
        $xml->addChild($tag);
        $xml->{$tag} = $value;
    }
}
