feat : restructuration des dossiers pour implementer plus facilement la suite des WS
This commit is contained in:
14
src/Shared/Dto/AnomalyDto.php
Normal file
14
src/Shared/Dto/AnomalyDto.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Malio\EdnotifBundle\Shared\Dto;
|
||||
|
||||
final readonly class AnomalyDto
|
||||
{
|
||||
public function __construct(
|
||||
public ?string $code,
|
||||
public ?int $severity,
|
||||
public ?string $message,
|
||||
) {}
|
||||
}
|
||||
13
src/Shared/Dto/StandardResponseDto.php
Normal file
13
src/Shared/Dto/StandardResponseDto.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Malio\EdnotifBundle\Shared\Dto;
|
||||
|
||||
final readonly class StandardResponseDto
|
||||
{
|
||||
public function __construct(
|
||||
public bool $result,
|
||||
public ?AnomalyDto $anomaly,
|
||||
) {}
|
||||
}
|
||||
18
src/Shared/Exception/EdnotifException.php
Normal file
18
src/Shared/Exception/EdnotifException.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Malio\EdnotifBundle\Shared\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
final class EdnotifException extends RuntimeException
|
||||
{
|
||||
public function __construct(
|
||||
public readonly string $codeAnomalie,
|
||||
public readonly int $severite,
|
||||
string $message
|
||||
) {
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
||||
26
src/Shared/Soap/SoapClientFactory.php
Normal file
26
src/Shared/Soap/SoapClientFactory.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Malio\EdnotifBundle\Shared\Soap;
|
||||
|
||||
use SoapClient;
|
||||
|
||||
final class SoapClientFactory
|
||||
{
|
||||
/**
|
||||
* @param array<string,mixed> $soapOptions
|
||||
*/
|
||||
public function __construct(private array $soapOptions = []) {}
|
||||
|
||||
public function create(string $wsdl): SoapClient
|
||||
{
|
||||
$options = $this->soapOptions;
|
||||
|
||||
// Petites valeurs sûres par défaut
|
||||
$options['encoding'] ??= 'UTF-8';
|
||||
$options['exceptions'] ??= true;
|
||||
|
||||
return new SoapClient($wsdl, $options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user