diff --git a/Controller/CallbackController.php b/Controller/CallbackController.php index 0458d44..d004dd7 100644 --- a/Controller/CallbackController.php +++ b/Controller/CallbackController.php @@ -12,15 +12,9 @@ class CallbackController extends AbstractController { - /** - * @var LoggerInterface - */ - private $logger; + private LoggerInterface $logger; - /** - * @var EventDispatcherInterface - */ - private $dispatcher; + private EventDispatcherInterface $dispatcher; public function __construct(LoggerInterface $logger, EventDispatcherInterface $dispatcher) { @@ -31,7 +25,7 @@ public function __construct(LoggerInterface $logger, EventDispatcherInterface $d /** * @Route("/universign/callback", name="mpp_universign_callback", methods="GET") */ - public function process(Request $request) + public function process(Request $request): Response { $status = $request->query->get('status'); $transactionId = $request->query->get('id'); diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 782c1f0..bf0a2c5 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -9,9 +9,9 @@ class Configuration implements ConfigurationInterface { - const CONFIGURATION_ROOT = 'mpp_universign'; + public const CONFIGURATION_ROOT = 'mpp_universign'; - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder(self::CONFIGURATION_ROOT); diff --git a/DependencyInjection/MppUniversignExtension.php b/DependencyInjection/MppUniversignExtension.php index 8866c3a..4aeccd3 100644 --- a/DependencyInjection/MppUniversignExtension.php +++ b/DependencyInjection/MppUniversignExtension.php @@ -11,15 +11,11 @@ class MppUniversignExtension extends Extension { - /** - * @param array $configs - * @param ContainerBuilder $container - */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration($container->getParameter('kernel.debug')); $config = $this->processConfiguration($configuration, $configs); - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.yaml'); $container->setParameter( diff --git a/Event/UniversignCallbackEvent.php b/Event/UniversignCallbackEvent.php index fe26fda..385dbc4 100644 --- a/Event/UniversignCallbackEvent.php +++ b/Event/UniversignCallbackEvent.php @@ -4,36 +4,22 @@ class UniversignCallbackEvent { - const STATUS_READY = 0; - const STATUS_EXPIRED = 1; - const STATUS_COMPLETED = 2; - const STATUS_CANCELED = 3; - const STATUS_ERROR = 4; + public const STATUS_READY = 0; + public const STATUS_EXPIRED = 1; + public const STATUS_COMPLETED = 2; + public const STATUS_CANCELED = 3; + public const STATUS_ERROR = 4; /** * All signatories have signed BUT waiting for Universign registration authority validation. */ - const STATUS_SIGNED = 5; + public const STATUS_SIGNED = 5; - /** - * @var string - */ - private $transactionId; + private string $transactionId; - /** - * @var int|null - */ - private $indexSigner; + private ?int $indexSigner; - /** - * @var int - */ - private $status; + private int $status; - /** - * @param string $transactionId - * @param int|null $indexSigner - * @param int $status - */ public function __construct(string $transactionId, ?int $indexSigner, int $status) { $this->transactionId = $transactionId; @@ -41,25 +27,16 @@ public function __construct(string $transactionId, ?int $indexSigner, int $statu $this->status = $status; } - /** - * @retrun string - */ - public function getTransactionId() + public function getTransactionId(): string { return $this->transactionId; } - /** - * @return int - */ public function getIndexSigner(): ?int { return $this->indexSigner; } - /** - * @return int - */ public function getStatus(): int { return $this->status; diff --git a/Model/CertificateInfo.php b/Model/CertificateInfo.php index 6f6e390..34a4af4 100644 --- a/Model/CertificateInfo.php +++ b/Model/CertificateInfo.php @@ -8,30 +8,24 @@ use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class CertificateInfo { - /** - * @var string - */ - protected $subject; + protected ?string $subject; - /** - * @var string - */ - protected $issuer; + protected ?string $issuer; - /** - * @var string - */ - protected $serial; + protected ?string $serial; - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public function __construct() + { + $this->subject = null; + $this->issuer = null; + $this->serial = null; + } + + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('subject', null)->setAllowedTypes('subject', ['null', 'string']) @@ -41,10 +35,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -65,11 +55,6 @@ public static function createFromArray(array $options): self ; } - /** - * @param string|null $subject - * - * @return self - */ public function setSubject(?string $subject): self { $this->subject = $subject; @@ -77,19 +62,11 @@ public function setSubject(?string $subject): self return $this; } - /** - * @return string|null - */ public function getSubject(): ?string { return $this->subject; } - /** - * @param string|null $issuer - * - * @return self - */ public function setIssuer(?string $issuer): self { $this->issuer = $issuer; @@ -97,19 +74,11 @@ public function setIssuer(?string $issuer): self return $this; } - /** - * @return string|null - */ public function getIssuer(): ?string { return $this->issuer; } - /** - * @param string|null $serial - * - * @return self - */ public function setSerial(?string $serial): self { $this->serial = $serial; @@ -117,9 +86,6 @@ public function setSerial(?string $serial): self return $this; } - /** - * @return string|null - */ public function getSerial(): ?string { return $this->serial; diff --git a/Model/CertificateType.php b/Model/CertificateType.php index 1ffa426..84d4357 100644 --- a/Model/CertificateType.php +++ b/Model/CertificateType.php @@ -4,7 +4,7 @@ class CertificateType { - const SIMPLE = 'simple'; - const CERTIFIED = 'certified'; - const ADVANCED = 'advanced'; + public const SIMPLE = 'simple'; + public const CERTIFIED = 'certified'; + public const ADVANCED = 'advanced'; } diff --git a/Model/DocSignatureField.php b/Model/DocSignatureField.php index d662197..8a69b67 100644 --- a/Model/DocSignatureField.php +++ b/Model/DocSignatureField.php @@ -2,51 +2,42 @@ namespace Mpp\UniversignBundle\Model; +use Mpp\UniversignBundle\Model\XmlRpc\Base64; use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class DocSignatureField extends SignatureField { - /** - * @var string - */ - protected $patternName; + protected ?string $patternName; - /** - * @var string - */ - protected $label; + protected ?string $label; - /** - * @var \Laminas\XmlRpc\Value\Base64 - */ - protected $image; + protected ?Base64 $image; - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public function __construct() + { + $this->patternName = null; + $this->label = null; + $this->image = null; + } + + public static function configureData(OptionsResolver $resolver): void { parent::configureData($resolver); $resolver ->setDefault('patternName', null)->setAllowedTypes('patternName', ['string', 'null']) ->setDefault('label', null)->setAllowedTypes('label', ['string', 'null']) - ->setDefault('image', null)->setAllowedTypes('image', ['string', 'null']) + ->setDefault('image', null)->setAllowedTypes('image', [Base64::class, 'null']) ; } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -61,22 +52,17 @@ public static function createFromArray(array $options): self $resolvedOptions = $resolver->resolve($options); return (new self()) + ->setPatternName($resolvedOptions['patternName']) + ->setLabel($resolvedOptions['label']) + ->setImage($resolvedOptions['image']) ->setName($resolvedOptions['name']) ->setPage($resolvedOptions['page']) ->setX($resolvedOptions['x']) ->setY($resolvedOptions['y']) ->setSignerIndex($resolvedOptions['signerIndex']) - ->setPatternName($resolvedOptions['patternName']) - ->setLabel($resolvedOptions['label']) - ->setImage($resolvedOptions['image']) ; } - /** - * @param string $patternName - * - * @return self - */ public function setPatternName(?string $patternName): self { $this->patternName = $patternName; @@ -84,19 +70,11 @@ public function setPatternName(?string $patternName): self return $this; } - /** - * @return string - */ public function getPatternName(): string { return $this->patternName; } - /** - * @param string $label - * - * @return self - */ public function setLabel(?string $label): self { $this->label = $label; @@ -104,30 +82,19 @@ public function setLabel(?string $label): self return $this; } - /** - * @return string - */ public function getLabel(): string { return $this->label; } - /** - * @param array $image - * - * @return self - */ - public function setImage(?array $image): self + public function setImage(?Base64 $image): self { $this->image = $image; return $this; } - /** - * @return \Laminas\XmlRpc\Value\Base64 - */ - public function getImage(): \Laminas\XmlRpc\Value\Base64 + public function getImage(): Base64 { return $this->image; } diff --git a/Model/Document.php b/Model/Document.php index 59fb981..62fc279 100644 --- a/Model/Document.php +++ b/Model/Document.php @@ -2,6 +2,7 @@ namespace Mpp\UniversignBundle\Model; +use Mpp\UniversignBundle\Model\XmlRpc\Base64; use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; @@ -13,77 +14,54 @@ class Document { - /** - * @var int - */ - protected $id; + protected ?int $id; - /** - * @var string - */ - protected $documentType; + protected string $documentType; - /** - * @var \Laminas\XmlRpc\Value\Base64 - */ - protected $content; + protected ?Base64 $content; - /** - * @var string - */ - protected $url; + protected ?string $url; - /** - * @var string - */ - protected $fileName; + protected ?string $fileName; /** * @var array */ - protected $signatureFields; + protected array $signatureFields; - /** - * @var array - */ - protected $checkBoxTexts; + protected ?array $checkBoxTexts; - /** - * @var array - */ - protected $metaData; + protected ?array $metaData; - /** - * @var string - */ - protected $title; + protected ?string $title; - /** - * @var SepaData - */ - protected $sepaData; + protected ?SepaData $sepaData; - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public function __construct() + { + $this->id = null; + $this->documentType = 'pdf'; + $this->content = null; + $this->url = null; + $this->fileName = null; + $this->signatureFields = null; + $this->checkBoxTexts = null; + $this->metaData = null; + $this->title = null; + $this->sepaData = null; + } + + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('id', null)->setAllowedTypes('id', ['null', 'string']) ->setDefault('documentType', 'pdf')->setAllowedValues('documentType', ['pdf', 'pdf-for-presentation', 'pdf-optional', 'sepa']) - ->setDefault('content', null)->setAllowedTypes('content', ['null', 'string', \Laminas\XmlRpc\Value\Base64::class])->setNormalizer('content', function (Options $options, $value): ?\Laminas\XmlRpc\Value\Base64 { - if ($value instanceof \Laminas\XmlRpc\Value\Base64) { + ->setDefault('content', null)->setAllowedTypes('content', ['null', 'string', Base64::class])->setNormalizer('content', function (Options $options, $value): ?Base64 { + if (null === $value || $value instanceof Base64) { return $value; } - if (null === $value || !file_exists($value)) { - return null; - } - - $file = file_get_contents($value); - $b64 = new \Laminas\XmlRpc\Value\Base64($file); - - return $b64; + return new Base64($value); }) ->setDefault('url', null)->setAllowedTypes('url', ['null', 'string']) ->setDefault('fileName', null)->setAllowedTypes('fileName', ['null', 'string']) @@ -99,7 +77,7 @@ public static function configureData(OptionsResolver $resolver) return $signatureFields; }) - ->setDefault('checkBoxTexts', null)->setAllowedTypes('checkBoxTexts', ['null', 'array'])->setNormalizer('checkBoxTexts', function (Options $options, $value) { + ->setDefault('checkBoxTexts', null)->setAllowedTypes('checkBoxTexts', ['null', 'array'])->setNormalizer('checkBoxTexts', function (Options $options, $value) { if ('pdf-for-presentation' === $options['documentType']) { return null; } @@ -123,10 +101,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -154,11 +128,6 @@ public static function createFromArray(array $options): Document ; } - /** - * @param int|null $id - * - * @return self - */ public function setId(?int $id): self { $this->id = $id; @@ -166,59 +135,35 @@ public function setId(?int $id): self return $this; } - /** - * @return int|null - */ public function getId(): ?int { return $this->id; } - /** - * @param string|null $documentType - * - * @return self - */ - public function setDocumentType(?string $documentType): self + public function setDocumentType(string $documentType): self { $this->documentType = $documentType; return $this; } - /** - * @return string|null - */ - public function getDocumentType(): ?string + public function getDocumentType(): string { return $this->documentType; } - /** - * @param \Laminas\XmlRpc\Value\Base64|null $content - * - * @return self - */ - public function setContent(?\Laminas\XmlRpc\Value\Base64 $content): self + public function setContent(?Base64 $content): self { $this->content = $content; return $this; } - /** - * @return \Laminas\XmlRpc\Value\Base64|null - */ - public function getContent(): ?\Laminas\XmlRpc\Value\Base64 + public function getContent(): ?Base64 { return $this->content; } - /** - * @param string|null $url - * - * @return self - */ public function setUrl(?string $url): self { $this->url = $url; @@ -226,19 +171,11 @@ public function setUrl(?string $url): self return $this; } - /** - * @return string|null - */ public function getUrl(): ?string { return $this->url; } - /** - * @param string|null $fileName - * - * @return self - */ public function setFileName(?string $fileName): self { $this->fileName = $fileName; @@ -246,19 +183,11 @@ public function setFileName(?string $fileName): self return $this; } - /** - * @return string|null - */ public function getFileName(): ?string { return $this->fileName; } - /** - * @param SignatureField $signatureField - * - * @return self - */ public function addSignatureField(SignatureField $signatureField): self { $this->signatureFields[] = $signatureField; @@ -266,31 +195,18 @@ public function addSignatureField(SignatureField $signatureField): self return $this; } - /** - * @param array|null $signatureFields - * - * @return self - */ - public function setSignatureFields(?array $signatureFields): self + public function setSignatureFields(array $signatureFields): self { $this->signatureFields = $signatureFields; return $this; } - /** - * @return array|null - */ - public function getSignatureFields(): ?array + public function getSignatureFields(): array { return $this->signatureFields; } - /** - * @param array|null $checkBoxTexts - * - * @return self - */ public function setCheckBoxTexts(?array $checkBoxTexts): self { $this->checkBoxTexts = $checkBoxTexts; @@ -298,19 +214,11 @@ public function setCheckBoxTexts(?array $checkBoxTexts): self return $this; } - /** - * @return array|null - */ public function getCheckBoxTexts(): ?array { return $this->checkBoxTexts; } - /** - * @param array|null $metaData - * - * @return self - */ public function setMetaData(?array $metaData): self { $this->metaData = $metaData; @@ -318,19 +226,11 @@ public function setMetaData(?array $metaData): self return $this; } - /** - * @return array|null - */ public function getMetaData(): ?array { return $this->metaData; } - /** - * @param string|null $title - * - * @return self - */ public function setTitle(?string $title): self { $this->title = $title; @@ -338,19 +238,11 @@ public function setTitle(?string $title): self return $this; } - /** - * @return string|null - */ public function getTitle(): ?string { return $this->title; } - /** - * @param SepaData|null $sepaData - * - * @return self - */ public function setSepaData(?SepaData $sepaData): self { $this->sepaData = $sepaData; @@ -358,9 +250,6 @@ public function setSepaData(?SepaData $sepaData): self return $this; } - /** - * @return SepaData|null - */ public function getSepaData(): ?SepaData { return $this->sepaData; diff --git a/Model/IdDocument.php b/Model/IdDocument.php index 805eaab..3e57543 100644 --- a/Model/IdDocument.php +++ b/Model/IdDocument.php @@ -2,7 +2,7 @@ namespace Mpp\UniversignBundle\Model; -use Laminas\XmlRpc\Value\Base64; +use Mpp\UniversignBundle\Model\XmlRpc\Base64; use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; @@ -14,42 +14,53 @@ class IdDocument { - const TYPE_IDENTITY_CARD = 0; - const TYPE_PASSPORT = 1; - const TYPE_RESIDENCE_PERMIT = 2; - const TYPE_EUROPEAN_DRIVER_LICENSE = 3; + public const TYPE_IDENTITY_CARD = 0; + public const TYPE_PASSPORT = 1; + public const TYPE_RESIDENCE_PERMIT = 2; + public const TYPE_EUROPEAN_DRIVER_LICENSE = 3; /** * @var Base64[] */ - protected $photos; + protected array $photos; + + protected int $type; /** - * @var int + * @param Base64[] $photos */ - protected $type; + public function __construct(array $photos, int $type) + { + $this->photos = $photos; + $this->type = $type; + } /** - * @param OptionsResolver $resolver + * @throws \UnexpectedValueException */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setRequired('type')->setAllowedValues('type', [self::TYPE_EUROPEAN_DRIVER_LICENSE, self::TYPE_RESIDENCE_PERMIT, self::TYPE_PASSPORT, self::TYPE_IDENTITY_CARD]) ->setRequired('photos')->setAllowedTypes('photos', ['array'])->setNormalizer('photos', function (Options $options, $array): ?array { $list = []; foreach ($array as $value) { + if (null === $value) { + continue; + } + if ($value instanceof Base64) { $list[] = $value; continue; } - if (null === $value || !file_exists($value)) { - continue; + if (!is_string($value)) { + throw new \UnexpectedValueException( + 'Type ' . gettype($value) . ' is not allowed in photo array' + ); } - $file = file_get_contents($value); - $list[] = new \Laminas\XmlRpc\Value\Base64($file); + $list[] = new Base64($value); } return $list; @@ -58,10 +69,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -75,10 +82,10 @@ public static function createFromArray(array $options): IdDocument self::configureData($resolver); $resolvedOptions = $resolver->resolve($options); - return (new self()) - ->setPhotos($resolvedOptions['photos']) - ->setType($resolvedOptions['type']) - ; + return (new self( + $resolvedOptions['photos'], + $resolvedOptions['type'] + )); } /** @@ -90,9 +97,7 @@ public function getPhotos(): array } /** - * @param array $photos - * - * @return self + * @param Base64[] $photos */ public function setPhotos(array $photos): self { @@ -101,19 +106,11 @@ public function setPhotos(array $photos): self return $this; } - /** - * @return int - */ public function getType(): int { return $this->type; } - /** - * @param int $type - * - * @return self - */ public function setType(int $type): self { $this->type = $type; diff --git a/Model/InitiatorInfo.php b/Model/InitiatorInfo.php index 3f33eb2..4d76f23 100644 --- a/Model/InitiatorInfo.php +++ b/Model/InitiatorInfo.php @@ -8,30 +8,24 @@ use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class InitiatorInfo { - /** - * @var string - */ - protected $email; + protected ?string $email; - /** - * @var string - */ - protected $firstName; + protected ?string $firstName; - /** - * @var string - */ - protected $lastName; + protected ?string $lastName; - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public function __construct() + { + $this->email = null; + $this->firstName = null; + $this->lastName = null; + } + + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('email', null)->setAllowedTypes('email', ['null', 'string']) @@ -41,10 +35,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array|null $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -52,7 +42,7 @@ public static function configureData(OptionsResolver $resolver) * @throws NoSuchOptionException If a lazy option reads an unavailable option * @throws AccessException If called from a lazy option or normalizer */ - public static function createFromArray(?array $options): self + public static function createFromArray(array $options): ?self { if (null === $options) { return null; @@ -69,11 +59,6 @@ public static function createFromArray(?array $options): self ; } - /** - * @param string|null $email - * - * @return self - */ public function setEmail(?string $email): self { $this->email = $email; @@ -81,19 +66,11 @@ public function setEmail(?string $email): self return $this; } - /** - * @return string|null - */ public function getEmail(): ?string { return $this->email; } - /** - * @param string|null $firstName - * - * @return self - */ public function setFirstName(?string $firstName): self { $this->firstName = $firstName; @@ -101,19 +78,11 @@ public function setFirstName(?string $firstName): self return $this; } - /** - * @return string|null - */ public function getFirstName(): ?string { return $this->firstName; } - /** - * @param string|null $lastName - * - * @return self - */ public function setLastName(?string $lastName): self { $this->lastName = $lastName; @@ -121,9 +90,6 @@ public function setLastName(?string $lastName): self return $this; } - /** - * @return string|null - */ public function getLastName(): ?string { return $this->lastName; diff --git a/Model/Language.php b/Model/Language.php index bcbed26..4eb8c26 100644 --- a/Model/Language.php +++ b/Model/Language.php @@ -4,15 +4,15 @@ class Language { - const BULGARIAN = 'bg'; - const CATALAN = 'ca'; - const GERMAN = 'de'; - const ENGLISH = 'en'; - const SPANISH = 'es'; - const FRENCH = 'fr'; - const ITALIAN = 'it'; - const DUTCH = 'nl'; - const POLISH = 'pl'; - const PORTUGUESE = 'pt'; - const ROMANIAN = 'ro'; -} \ No newline at end of file + public const BULGARIAN = 'bg'; + public const CATALAN = 'ca'; + public const GERMAN = 'de'; + public const ENGLISH = 'en'; + public const SPANISH = 'es'; + public const FRENCH = 'fr'; + public const ITALIAN = 'it'; + public const DUTCH = 'nl'; + public const POLISH = 'pl'; + public const PORTUGUESE = 'pt'; + public const ROMANIAN = 'ro'; +} diff --git a/Model/MatchingFilter.php b/Model/MatchingFilter.php index dbb9e52..8af160d 100644 --- a/Model/MatchingFilter.php +++ b/Model/MatchingFilter.php @@ -8,35 +8,27 @@ use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class MatchingFilter { - /** - * @var string - */ - protected $firstname; + protected string $firstname; - /** - * @var string - */ - protected $lastname; + protected string $lastname; - /** - * @var string|null - */ - protected $mobile; + protected ?string $mobile; - /** - * @var string|null - */ - protected $email; + protected ?string $email; - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public function __construct(string $firstname, string $lastname) + { + $this->firstname = $firstname; + $this->lastname = $lastname; + $this->mobile = null; + $this->email = null; + } + + public static function configureData(OptionsResolver $resolver): void { $resolver ->setRequired('firstname')->setAllowedTypes('firstname', ['string']) @@ -47,10 +39,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -64,27 +52,20 @@ public static function createFromArray(array $options): self self::configureData($resolver); $resolvedOptions = $resolver->resolve($options); - return (new self()) - ->setFirstname($resolvedOptions['firstname']) - ->setLastname($resolvedOptions['lastname']) + return (new self( + $resolvedOptions['firstname'], + $resolvedOptions['lastname'], + )) ->setMobile($resolvedOptions['mobile']) ->setEmail($resolvedOptions['email']) ; } - /** - * @return string - */ public function getFirstname(): string { return $this->firstname; } - /** - * @param string $firstname - * - * @return self - */ public function setFirstname(string $firstname): self { $this->firstname = $firstname; @@ -92,19 +73,11 @@ public function setFirstname(string $firstname): self return $this; } - /** - * @return string - */ public function getLastname(): string { return $this->lastname; } - /** - * @param string $lastname - * - * @return self - */ public function setLastname(string $lastname): self { $this->lastname = $lastname; @@ -112,19 +85,11 @@ public function setLastname(string $lastname): self return $this; } - /** - * @return string|null - */ public function getMobile(): ?string { return $this->mobile; } - /** - * @param string|null $mobile - * - * @return self - */ public function setMobile(?string $mobile): self { $this->mobile = $mobile; @@ -132,19 +97,11 @@ public function setMobile(?string $mobile): self return $this; } - /** - * @return string|null - */ public function getEmail(): ?string { return $this->email; } - /** - * @param string|null $email - * - * @return self - */ public function setEmail(?string $email): self { $this->email = $email; diff --git a/Model/MatchingResult.php b/Model/MatchingResult.php index e004b77..72bda49 100644 --- a/Model/MatchingResult.php +++ b/Model/MatchingResult.php @@ -13,54 +13,43 @@ class MatchingResult { - const CERTIFICATE_LEVEL_NONE = 'none'; - const CERTIFICATE_LEVEL_ADVANCED = 'advanced'; - const CERTIFICATE_LEVEL_CERTIFIED = 'certified'; + public const CERTIFICATE_LEVEL_NONE = 'none'; + public const CERTIFICATE_LEVEL_ADVANCED = 'advanced'; + public const CERTIFICATE_LEVEL_CERTIFIED = 'certified'; - const CERTIFICATE_STATUS_VALID = 'valid'; - const CERTIFICATE_STATUS_REVOKED = 'revoked'; - const CERTIFICATE_STATUS_AWAITING_VALIDATION = 'awaiting-validation'; - /** - * @var string|null - */ - protected $firstname; + public const CERTIFICATE_STATUS_VALID = 'valid'; + public const CERTIFICATE_STATUS_REVOKED = 'revoked'; + public const CERTIFICATE_STATUS_AWAITING_VALIDATION = 'awaiting-validation'; - /** - * @var string|null - */ - protected $lastname; + protected ?string $firstname; - /** - * @var string|null - */ - protected $mobile; + protected ?string $lastname; - /** - * @var string|null - */ - protected $email; + protected ?string $mobile; - /** - * @var string|null - */ - protected $certificateLevel; + protected ?string $email; - /** - * @var string|null - */ - protected $certificateStatus; + protected ?string $certificateLevel; - /** - * @var RaCertificateInfo|null - */ - protected $certificateInfo; + protected ?string $certificateStatus; - /** - * @var \DateTime|null - */ - protected $expirationDate; + protected ?RaCertificateInfo $certificateInfo; + + protected ?\DateTime $expirationDate; + + public function __construct() + { + $this->firstname = null; + $this->lastname = null; + $this->mobile = null; + $this->email = null; + $this->certificateLevel = null; + $this->certificateStatus = null; + $this->certificateInfo = null; + $this->expirationDate = null; + } - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('firstname', null)->setAllowedTypes('firstname', ['null', 'string']) @@ -69,14 +58,14 @@ public static function configureData(OptionsResolver $resolver) ->setDefault('email', null)->setAllowedTypes('email', ['string', 'null']) ->setDefault('certificateLevel', null)->setAllowedTypes('certificateLevel', ['string', 'null']) ->setDefault('certificateStatus', null)->setAllowedTypes('certificateStatus', ['string', 'null']) - ->setDefault('expirationDate', null)->setAllowedTypes('expirationDate', ['string', 'null', \DateTime::class])->setNormalizer('expirationDate', function(Options $options, $value) { + ->setDefault('expirationDate', null)->setAllowedTypes('expirationDate', ['string', 'null', \DateTime::class])->setNormalizer('expirationDate', function (Options $options, $value) { if (!is_string($value)) { return $value; } return \DateTime::createFromFormat('Ymd\TH:i:s', $value, new \DateTimeZone('UTC')); }) - ->setDefault('certificateInfo', null)->setAllowedTypes('certificateInfo', ['array', 'null', RaCertificateInfo::class])->setNormalizer('certificateInfo', function(Options $options, $value) { + ->setDefault('certificateInfo', null)->setAllowedTypes('certificateInfo', ['array', 'null', RaCertificateInfo::class])->setNormalizer('certificateInfo', function (Options $options, $value) { if (null === $value || $value instanceof RaCertificateInfo) { return $value; } @@ -87,10 +76,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -116,19 +101,11 @@ public static function createFromArray(array $options): self ; } - /** - * @return string|null - */ public function getFirstname(): ?string { return $this->firstname; } - /** - * @param string|null $firstname - * - * @return self - */ public function setFirstname(?string $firstname): self { $this->firstname = $firstname; @@ -136,19 +113,11 @@ public function setFirstname(?string $firstname): self return $this; } - /** - * @return string|null - */ public function getLastname(): ?string { return $this->lastname; } - /** - * @param string|null $lastname - * - * @return self - */ public function setLastname(?string $lastname): self { $this->lastname = $lastname; @@ -156,19 +125,11 @@ public function setLastname(?string $lastname): self return $this; } - /** - * @return string|null - */ public function getMobile(): ?string { return $this->mobile; } - /** - * @param string|null $mobile - * - * @return self - */ public function setMobile(?string $mobile): self { $this->mobile = $mobile; @@ -176,19 +137,11 @@ public function setMobile(?string $mobile): self return $this; } - /** - * @return string|null - */ public function getEmail(): ?string { return $this->email; } - /** - * @param string|null $email - * - * @return self - */ public function setEmail(?string $email): self { $this->email = $email; @@ -196,19 +149,11 @@ public function setEmail(?string $email): self return $this; } - /** - * @return string|null - */ public function getCertificateLevel(): ?string { return $this->certificateLevel; } - /** - * @param string|null $certificateLevel - * - * @return self - */ public function setCertificateLevel(?string $certificateLevel): self { $this->certificateLevel = $certificateLevel; @@ -216,19 +161,11 @@ public function setCertificateLevel(?string $certificateLevel): self return $this; } - /** - * @return string|null - */ public function getCertificateStatus(): ?string { return $this->certificateStatus; } - /** - * @param string|null $certificateStatus - * - * @return self - */ public function setCertificateStatus(?string $certificateStatus): self { $this->certificateStatus = $certificateStatus; @@ -236,19 +173,11 @@ public function setCertificateStatus(?string $certificateStatus): self return $this; } - /** - * @return RaCertificateInfo|null - */ public function getCertificateInfo(): ?RaCertificateInfo { return $this->certificateInfo; } - /** - * @param RaCertificateInfo|null $certificateInfo - * - * @return self - */ public function setCertificateInfo(?RaCertificateInfo $certificateInfo): self { $this->certificateInfo = $certificateInfo; @@ -256,19 +185,11 @@ public function setCertificateInfo(?RaCertificateInfo $certificateInfo): self return $this; } - /** - * @return \DateTime|null - */ public function getExpirationDate(): ?\DateTime { return $this->expirationDate; } - /** - * @param \DateTime|null $expirationDate - * - * @return MatchingResult - */ public function setExpirationDate(?\DateTime $expirationDate): self { $this->expirationDate = $expirationDate; diff --git a/Model/PersonalInfo.php b/Model/PersonalInfo.php index 7c508e8..f8dfa37 100644 --- a/Model/PersonalInfo.php +++ b/Model/PersonalInfo.php @@ -2,56 +2,39 @@ namespace Mpp\UniversignBundle\Model; -use Laminas\XmlRpc\Value\DateTime; use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class PersonalInfo { - /** - * @var string - */ - protected $firstname; + protected string $firstname; - /** - * @var string - */ - protected $lastname; + protected string $lastname; - /** - * @var DateTime - */ - protected $birthDate; + protected \DateTimeInterface $birthDate; - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public function __construct(string $firstname, string $lastname, \DateTimeInterface $birthDate) + { + $this->firstname = $firstname; + $this->lastname = $lastname; + $this->birthDate = $birthDate; + } + + public static function configureData(OptionsResolver $resolver): void { $resolver ->setRequired('firstname')->setAllowedTypes('firstname', ['string']) ->setRequired('lastname')->setAllowedTypes('lastname', ['string']) - ->setRequired('birthDate')->setAllowedTypes('birthDate', [\DateTimeInterface::class])->setNormalizer('birthDate', function(Options $options, $value) { - if (null === $value || $value instanceof DateTime) { - return $value; - } - - return new DateTime($value); - }) + ->setRequired('birthDate')->setAllowedTypes('birthDate', [\DateTimeInterface::class]) ; } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -65,26 +48,18 @@ public static function createFromArray(array $options): self self::configureData($resolver); $resolvedOptions = $resolver->resolve($options); - return (new self()) - ->setFirstname($resolvedOptions['firstname']) - ->setLastname($resolvedOptions['lastname']) - ->setBirthDate($resolvedOptions['birthDate']) - ; + return (new self( + $resolvedOptions['firstname'], + $resolvedOptions['lastname'], + $resolvedOptions['birthDate'], + )); } - /** - * @return string - */ public function getFirstname(): string { return $this->firstname; } - /** - * @param string $firstname - * - * @return self - */ public function setFirstname(string $firstname): self { $this->firstname = $firstname; @@ -92,19 +67,11 @@ public function setFirstname(string $firstname): self return $this; } - /** - * @return string - */ public function getLastname(): string { return $this->lastname; } - /** - * @param string $lastname - * - * @return self - */ public function setLastname(string $lastname): self { $this->lastname = $lastname; @@ -112,20 +79,12 @@ public function setLastname(string $lastname): self return $this; } - /** - * @return DateTime - */ - public function getBirthDate(): DateTime + public function getBirthDate(): \DateTimeInterface { return $this->birthDate; } - /** - * @param DateTime $birthDate - * - * @return self - */ - public function setBirthDate(DateTime $birthDate): self + public function setBirthDate(\DateTimeInterface $birthDate): self { $this->birthDate = $birthDate; diff --git a/Model/RaCertificateInfo.php b/Model/RaCertificateInfo.php index 647e80b..a25093a 100644 --- a/Model/RaCertificateInfo.php +++ b/Model/RaCertificateInfo.php @@ -2,7 +2,7 @@ namespace Mpp\UniversignBundle\Model; -use Laminas\XmlRpc\Value\Base64; +use Mpp\UniversignBundle\Model\XmlRpc\Base64; use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; @@ -14,35 +14,41 @@ class RaCertificateInfo { - /** - * @var string - */ - protected $subjectDN; + protected string $subjectDN; + + protected string $serialNumber; /** - * @var string + * @var Base64[] */ - protected $serialNumber; + protected array $chain; /** - * @var Base64[] + * @param Base64[] $chain */ - protected $chain; + public function __construct(string $subjectDN, string $serialNumber, array $chain) + { + $this->subjectDN = $subjectDN; + $this->serialNumber = $serialNumber; + $this->chain = $chain; + } /** - * @param OptionsResolver $resolver + * @throws \UnexpectedValueException */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setRequired('subjectDN')->setAllowedTypes('subjectDN', ['string']) ->setRequired('serialNumber')->setAllowedTypes('serialNumber', ['string']) - ->setRequired('chain')->setAllowedTypes('chain', ['array', Base64::class])->setNormalizer('chain', function (Options $options, $value): array { - if (null === $value) { - return $value; - } + ->setRequired('chain')->setAllowedTypes('chain', ['array'])->setNormalizer('chain', function (Options $options, $value): array { $result = []; foreach ($value as $item) { + if (!is_string($item)) { + throw new \UnexpectedValueException( + 'Type ' . gettype($item) . ' is not allowed in chain array' + ); + } $result[] = new Base64($item); } @@ -52,10 +58,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -70,26 +72,18 @@ public static function createFromArray(array $options): self $resolvedOptions = $resolver->resolve($options); - return (new self()) - ->setSubjectDN($resolvedOptions['subjectDN']) - ->setSerialNumber($resolvedOptions['serialNumber']) - ->setChain($resolvedOptions['chain']) - ; + return (new self( + $resolvedOptions['subjectDN'], + $resolvedOptions['serialNumber'], + $resolvedOptions['chain'], + )); } - /** - * @return string - */ public function getSubjectDN(): string { return $this->subjectDN; } - /** - * @param string $subjectDN - * - * @return self - */ public function setSubjectDN(string $subjectDN): self { $this->subjectDN = $subjectDN; @@ -97,19 +91,11 @@ public function setSubjectDN(string $subjectDN): self return $this; } - /** - * @return string - */ public function getSerialNumber(): string { return $this->serialNumber; } - /** - * @param string $serialNumber - * - * @return self - */ public function setSerialNumber(string $serialNumber): self { $this->serialNumber = $serialNumber; @@ -127,8 +113,6 @@ public function getChain(): array /** * @param Base64[] $chain - * - * @return self */ public function setChain(array $chain): self { diff --git a/Model/RedirectionConfig.php b/Model/RedirectionConfig.php index 17cdc3b..fd7cab7 100644 --- a/Model/RedirectionConfig.php +++ b/Model/RedirectionConfig.php @@ -8,25 +8,24 @@ use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class RedirectionConfig { - /** - * @var string - */ - protected $URL; + protected ?string $URL; - /** - * @var string - */ - protected $displayName; + protected ?string $displayName; + + public function __construct() + { + $this->URL = null; + $this->displayName = null; + } /** * @param OptionsResolver */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('URL', null)->setAllowedTypes('URL', ['string', 'null']) @@ -35,10 +34,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -58,11 +53,6 @@ public static function createFromArray(array $options): self ; } - /** - * @param string|null $url - * - * @return self - */ public function setUrl(?string $url): self { $this->URL = $url; @@ -70,19 +60,11 @@ public function setUrl(?string $url): self return $this; } - /** - * @return string|null - */ public function getUrl(): ?string { return $this->URL; } - /** - * @param string|null $displayName - * - * @return self - */ public function setDisplayName(?string $displayName): self { $this->displayName = $displayName; @@ -90,9 +72,6 @@ public function setDisplayName(?string $displayName): self return $this; } - /** - * @return string|null - */ public function getDisplayName(): ?string { return $this->displayName; diff --git a/Model/RegistrationRequest.php b/Model/RegistrationRequest.php index 07b4fe6..530f4f3 100644 --- a/Model/RegistrationRequest.php +++ b/Model/RegistrationRequest.php @@ -8,7 +8,6 @@ use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class RegistrationRequest @@ -17,37 +16,25 @@ class RegistrationRequest public const DOCTYPE_PASSPORT = 'passport_eu'; public const DOCTYPE_TITLE_STAY = 'titre_sejour'; - /** - * @var array - */ - protected $documents; + protected array $documents; - /** - * @var string - */ - protected $type; + protected ?string $type; public function __construct() { $this->documents = []; + $this->type = null; } - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver - ->setDefined('documents', [])->setAllowedTypes('documents', ['array']) - ->setDefined('type', null)->setAllowedTypes('type', ['null', 'string']) + ->setDefault('documents', [])->setAllowedTypes('documents', ['array']) + ->setDefault('type', null)->setAllowedTypes('type', ['null', 'string']) ; } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -67,31 +54,18 @@ public static function createFromArray(array $options): self ; } - /** - * @param array|null $documents - * - * @return self - */ - public function setDocuments(?array $documents): self + public function setDocuments(array $documents): self { $this->documents = $documents; return $this; } - /** - * @return array|null - */ - public function getDocuments(): ?array + public function getDocuments(): array { return $this->documents; } - /** - * @param string|null $type - * - * @return self - */ public function setType(?string $type): self { $this->type = $type; @@ -99,9 +73,6 @@ public function setType(?string $type): self return $this; } - /** - * @return string|null - */ public function getType(): ?string { return $this->type; diff --git a/Model/SepaData.php b/Model/SepaData.php index b917d02..27ec6ac 100644 --- a/Model/SepaData.php +++ b/Model/SepaData.php @@ -13,51 +13,39 @@ class SepaData { - /** - * @var string - */ - protected $rum; + protected string $rum; - /** - * @var string - */ - protected $ics; + protected string $ics; - /** - * @var string - */ - protected $iban; + protected string $iban; - /** - * @var string - */ - protected $bic; + protected string $bic; - /** - * @var bool - */ - protected $recuring; + protected bool $recuring; - /** - * @var SepaThirdParty - */ - protected $debtor; + protected SepaThirdParty $debtor; - /** - * @var SepaThirdParty - */ - protected $creditor; + protected SepaThirdParty $creditor; - public function __construct() - { - $this->debtor = []; - $this->creditor = []; + public function __construct( + string $rum, + string $ics, + string $iban, + string $bic, + bool $recuring, + SepaThirdParty $debtor, + SepaThirdParty $creditor + ) { + $this->rum = $rum; + $this->ics = $ics; + $this->iban = $iban; + $this->bic = $bic; + $this->recuring = $recuring; + $this->debtor = $debtor; + $this->creditor = $creditor; } - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setRequired('rum')->setAllowedTypes('rum', ['string']) @@ -83,10 +71,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -100,153 +84,97 @@ public static function createFromArray(array $options): self self::configureData($resolver); $resolvedOptions = $resolver->resolve($options); - return (new self()) - ->setRum($resolvedOptions['rum']) - ->setIcs($resolvedOptions['ics']) - ->setIban($resolvedOptions['iban']) - ->setBic($resolvedOptions['bic']) - ->setRecuring($resolvedOptions['recurring']) - ->setDebtor($resolvedOptions['debtor']) - ->setCreditor($resolvedOptions['creditor']) - ; + return (new self( + $resolvedOptions['rum'], + $resolvedOptions['ics'], + $resolvedOptions['iban'], + $resolvedOptions['bic'], + $resolvedOptions['recurring'], + $resolvedOptions['debtor'], + $resolvedOptions['creditor'], + )); } - /** - * @param string|null $rum - * - * @return self - */ - public function setRum(?string $rum): self + public function setRum(string $rum): self { $this->rum = $rum; return $this; } - /** - * @return string|null - */ - public function getRum(): ?string + public function getRum(): string { return $this->rum; } - /** - * @param string|null $ics - * - * @return self - */ - public function setIcs(?string $ics): self + public function setIcs(string $ics): self { $this->ics = $ics; return $this; } - /** - * @return string|null - */ - public function getIcs(): ?string + public function getIcs(): string { return $this->ics; } - /** - * @param string|null $iban - * - * @return self - */ - public function setIban(?string $iban): self + public function setIban(string $iban): self { $this->iban = $iban; return $this; } - /** - * @return string|null - */ - public function getIban(): ?string + public function getIban(): string { return $this->iban; } - /** - * @param string|null $bic - * - * @return self - */ - public function setBic(?string $bic): self + public function setBic(string $bic): self { $this->bic = $bic; return $this; } - /** - * @return string|null - */ - public function getBic(): ?string + public function getBic(): string { return $this->bic; } - /** - * @param bool|null $recuring - * - * @return self - */ - public function setRecuring(?bool $recuring): self + public function setRecuring(bool $recuring): self { $this->recuring = $recuring; return $this; } - /** - * @return bool|null - */ - public function getRecuring(): ?bool + public function getRecuring(): bool { return $this->recuring; } - /** - * @param SepaThirdParty|null $debtor - * - * @return self - */ - public function setDebtor(?SepaThirdParty $debtor): self + public function setDebtor(SepaThirdParty $debtor): self { $this->debtor = $debtor; return $this; } - /** - * @return SepaThirdParty|null - */ - public function getDebtor(): ?SepaThirdParty + public function getDebtor(): SepaThirdParty { return $this->debtor; } - /** - * @param SepaThirdParty|null $creditor - * - * @return self - */ - public function setCreditor(?SepaThirdParty $creditor): self + public function setCreditor(SepaThirdParty $creditor): self { $this->creditor = $creditor; return $this; } - /** - * @return SepaThirdParty|null - */ - public function getCreditor(): ?SepaThirdParty + public function getCreditor(): SepaThirdParty { return $this->creditor; } diff --git a/Model/SepaThirdParty.php b/Model/SepaThirdParty.php index ab69529..3174d27 100644 --- a/Model/SepaThirdParty.php +++ b/Model/SepaThirdParty.php @@ -12,35 +12,31 @@ class SepaThirdParty { - /** - * @var string - */ - protected $name; + protected string $name; - /** - * @var string - */ - protected $address; + protected string $address; - /** - * @var string - */ - protected $postalCode; + protected string $postalCode; - /** - * @var string - */ - protected $city; + protected string $city; - /** - * @var string - */ - protected $country; + protected string $country; - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public function __construct( + string $name, + string $address, + string $postalCode, + string $city, + string $country, + ) { + $this->name = $name; + $this->address = $address; + $this->postalCode = $postalCode; + $this->city = $city; + $this->country = $country; + } + + public static function configureData(OptionsResolver $resolver): void { $resolver ->setRequired('name')->setAllowedTypes('name', ['string']) @@ -52,10 +48,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return SepaThirdParty - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -69,111 +61,71 @@ public static function createFromArray(array $options): SepaThirdParty self::configureData($resolver); $resolvedOptions = $resolver->resolve($options); - return (new self()) - ->setName($resolvedOptions['name']) - ->setAddress($resolvedOptions['address']) - ->setPostalCode($resolvedOptions['postalCode']) - ->setCity($resolvedOptions['city']) - ->setCountry($resolvedOptions['country']) - ; + return (new self( + $resolvedOptions['name'], + $resolvedOptions['address'], + $resolvedOptions['postalCode'], + $resolvedOptions['city'], + $resolvedOptions['country'] + )); } - /** - * @param string|null $name - * - * @return self - */ - public function setName(?string $name): self + public function setName(string $name): self { $this->name = $name; return $this; } - /** - * @return string|null - */ - public function getName(): ?string + public function getName(): string { return $this->name; } - /** - * @param string|null $address - * - * @return self - */ - public function setAddress(?string $address): self + public function setAddress(string $address): self { $this->address = $address; return $this; } - /** - * @return string|null - */ - public function getAddress(): ?string + public function getAddress(): string { return $this->address; } - /** - * @param string|null $postalCode - * - * @return self - */ - public function setPostalCode(?string $postalCode): self + public function setPostalCode(string $postalCode): self { $this->postalCode = $postalCode; return $this; } - /** - * @return string|null - */ - public function getPostalCode(): ?string + public function getPostalCode(): string { return $this->postalCode; } - /** - * @param string|null $city - * - * @return self - */ - public function setCity(?string $city): self + public function setCity(string $city): self { $this->city = $city; return $this; } - /** - * @return string|null - */ - public function getCity(): ?string + public function getCity(): string { return $this->city; } - /** - * @param string|null $country - * - * @return self - */ - public function setCountry(?string $country): self + public function setCountry(string $country): self { $this->country = $country; return $this; } - /** - * @return string|null - */ - public function getCountry(): ?string + public function getCountry(): string { return $this->country; } diff --git a/Model/SignOptions.php b/Model/SignOptions.php index b002a0c..f9b2c0f 100644 --- a/Model/SignOptions.php +++ b/Model/SignOptions.php @@ -13,53 +13,40 @@ class SignOptions { - const SINGNATURE_FORMAT_PADES = 'PADES'; - const SINGNATURE_FORMAT_PADES_COMP = 'PADES-COMP'; - const SINGNATURE_FORMAT_ISO32000_1 = 'ISO-32000-1'; + public const SINGNATURE_FORMAT_PADES = 'PADES'; + public const SINGNATURE_FORMAT_PADES_COMP = 'PADES-COMP'; + public const SINGNATURE_FORMAT_ISO32000_1 = 'ISO-32000-1'; - /** - * @var string|null - */ - protected $profile; + protected ?string $profile; - /** - * @var SignatureField|null - */ - protected $signatureField; + protected ?SignatureField $signatureField; - /** - * @var string|null - */ - protected $reason; + protected ?string $reason; - /** - * @var string|null - */ - protected $location; + protected ?string $location; - /** - * @var string|null - */ - protected $signatureFormat; + protected ?string $signatureFormat; - /** - * @var string|null - */ - protected $language; + protected ?string $language; - /** - * @var string|null - */ - protected $patternName; + protected ?string $patternName; - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public function __construct() + { + $this->profile = 'default'; + $this->signatureField = null; + $this->reason = null; + $this->location = null; + $this->signatureFormat = self::SINGNATURE_FORMAT_PADES; + $this->language = 'en'; + $this->patternName = null; + } + + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('profile', 'default')->setAllowedTypes('profile', ['string']) - ->setDefault('signatureField', null)->setAllowedTypes('signatureField', ['null', 'array', SignatureField::class])->setNormalizer('signatureField', function(Options $options, $value) { + ->setDefault('signatureField', null)->setAllowedTypes('signatureField', ['null', 'array', SignatureField::class])->setNormalizer('signatureField', function (Options $options, $value) { if (null === $value || $value instanceof SignatureField) { return $value; } @@ -75,10 +62,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -103,127 +86,78 @@ public static function createFromArray(array $options): self ; } - /** - * @return string|null - */ public function getProfile(): ?string { return $this->profile; } - /** - * @param string|null $profile - * @return SignOptions - */ - public function setProfile(?string $profile): SignOptions + public function setProfile(?string $profile): self { $this->profile = $profile; return $this; } - /** - * @return SignatureField|null - */ public function getSignatureField(): ?SignatureField { return $this->signatureField; } - /** - * @param SignatureField|null $signatureField - * @return SignOptions - */ - public function setSignatureField(?SignatureField $signatureField): SignOptions + public function setSignatureField(?SignatureField $signatureField): self { $this->signatureField = $signatureField; return $this; } - /** - * @return string|null - */ public function getReason(): ?string { return $this->reason; } - /** - * @param string|null $reason - * @return SignOptions - */ - public function setReason(?string $reason): SignOptions + public function setReason(?string $reason): self { $this->reason = $reason; return $this; } - /** - * @return string|null - */ public function getLocation(): ?string { return $this->location; } - /** - * @param string|null $location - * @return SignOptions - */ - public function setLocation(?string $location): SignOptions + public function setLocation(?string $location): self { $this->location = $location; return $this; } - /** - * @return string|null - */ public function getSignatureFormat(): ?string { return $this->signatureFormat; } - /** - * @param string|null $signatureFormat - * @return SignOptions - */ - public function setSignatureFormat(?string $signatureFormat): SignOptions + public function setSignatureFormat(?string $signatureFormat): self { $this->signatureFormat = $signatureFormat; return $this; } - /** - * @return string|null - */ public function getLanguage(): ?string { return $this->language; } - /** - * @param string|null $language - * @return SignOptions - */ - public function setLanguage(?string $language): SignOptions + public function setLanguage(?string $language): self { $this->language = $language; return $this; } - /** - * @return string|null - */ public function getPatternName(): ?string { return $this->patternName; } - /** - * @param string|null $patternName - * @return SignOptions - */ - public function setPatternName(?string $patternName): SignOptions + public function setPatternName(?string $patternName): self { $this->patternName = $patternName; return $this; diff --git a/Model/SignatureField.php b/Model/SignatureField.php index cb31afa..2e712f6 100644 --- a/Model/SignatureField.php +++ b/Model/SignatureField.php @@ -8,55 +8,41 @@ use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class SignatureField { - /** - * @var string - */ - protected $name; + protected ?string $name; - /** - * @var int - */ - protected $page; + protected int $page; - /** - * @var int - */ - protected $x; + protected ?int $x; - /** - * @var int - */ - protected $y; + protected ?int $y; - /** - * @var int - */ - protected $signerIndex; + protected int $signerIndex; - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public function __construct(int $signerIndex) + { + $this->signerIndex = $signerIndex; + $this->name = null; + $this->page = 1; + $this->x = null; + $this->y = null; + } + + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('name', null)->setAllowedTypes('name', ['null', 'string']) ->setDefault('page', 1)->setAllowedTypes('page', ['int']) ->setDefault('x', null)->setAllowedTypes('x', ['null', 'int']) ->setDefault('y', null)->setAllowedTypes('y', ['null', 'int']) - ->setRequired('signerIndex')->setAllowedTypes('signerIndex', ['null', 'int']) + ->setRequired('signerIndex')->setAllowedTypes('signerIndex', ['int']) ; } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -70,20 +56,14 @@ public static function createFromArray(array $options): self self::configureData($resolver); $resolvedOptions = $resolver->resolve($options); - return (new self()) + return (new self($resolvedOptions['signerIndex'])) ->setName($resolvedOptions['name']) ->setPage($resolvedOptions['page']) ->setX($resolvedOptions['x']) ->setY($resolvedOptions['y']) - ->setSignerIndex($resolvedOptions['signerIndex']) ; } - /** - * @param string $name - * - * @return self - */ public function setName(?string $name): self { $this->name = $name; @@ -91,39 +71,23 @@ public function setName(?string $name): self return $this; } - /** - * @return string - */ public function getName(): ?string { return $this->name; } - /** - * @param int $page - * - * @return self - */ - public function setPage(?int $page): self + public function setPage(int $page): self { $this->page = $page; return $this; } - /** - * @return int - */ public function getPage(): int { return $this->page; } - /** - * @param int $x; - * - * @return self - */ public function setX(?int $x): self { $this->x = $x; @@ -131,19 +95,11 @@ public function setX(?int $x): self return $this; } - /** - * @return int - */ - public function getX(): int + public function getX(): ?int { return $this->x; } - /** - * @param int $y; - * - * @return self - */ public function setY(?int $y): self { $this->y = $y; @@ -151,29 +107,18 @@ public function setY(?int $y): self return $this; } - /** - * @return int - */ - public function getY(): int + public function getY(): ?int { return $this->y; } - /** - * @param int $signerIndex - * - * @return self - */ - public function setSignerIndex(?int $signerIndex): self + public function setSignerIndex(int $signerIndex): self { $this->signerIndex = $signerIndex; return $this; } - /** - * @return int - */ public function getSignerIndex(): int { return $this->signerIndex; diff --git a/Model/Signer.php b/Model/Signer.php index 0f8ac65..4ef60bc 100644 --- a/Model/Signer.php +++ b/Model/Signer.php @@ -16,118 +16,71 @@ class Signer public const ROLE_SIGNER = 'signer'; public const ROLE_OBSERVER = 'observer'; - /** - * @var string - */ - protected $firstname; + protected ?string $firstname; - /** - * @var string - */ - protected $lastname; + protected ?string $lastname; - /** - * @var string - */ - protected $organization; + protected ?string $organization; - /** - * @var string - */ - protected $profile; + protected ?string $profile; - /** - * @var string - */ - protected $emailAddress; + protected ?string $emailAddress; - /** - * @var string - */ - protected $phoneNum; + protected ?string $phoneNum; - /** - * @var string - */ - protected $language; + protected string $language; - /** - * @var string - */ - protected $role; + protected string $role; - /** - * @var \Laminas\XmlRpc\Value\DateTime - */ - protected $birthDate; + protected ?\DateTimeInterface $birthDate; - /** - * @var string - */ - protected $universignId; + protected ?string $universignId; - /** - * @var array - */ - protected $successRedirection; + protected array $successRedirection; - /** - * @var array - */ - protected $cancelRedirection; + protected array $cancelRedirection; - /** - * @var array - */ - protected $failRedirection; + protected array $failRedirection; - /** - * @var string - */ - protected $certificateType; + protected ?string $certificateType; - /** - * @var RegistrationRequest - */ - protected $idDocuments; + protected ?RegistrationRequest $idDocuments; - /** - * @var string - */ - protected $validationSessionId; + protected ?string $validationSessionId; - /** - * @var string - */ - protected $redirectPolicy; + protected ?string $redirectPolicy; - /** - * @var int - */ - protected $redirectWait; + protected int $redirectWait; - /** - * @var bool - */ - protected $autoSendAgreements; + protected ?bool $autoSendAgreements; - /** - * @var string - */ - protected $invitationMessage; + protected ?string $invitationMessage; public function __construct() { + $this->firstname = null; + $this->lastname = null; + $this->organization = null; + $this->profile = null; + $this->emailAddress = null; + $this->phoneNum = null; + $this->language = 'en'; + $this->role = self::ROLE_SIGNER; + $this->birthDate = null; + $this->universignId = null; $this->successRedirection = []; $this->cancelRedirection = []; $this->failRedirection = []; - $this->idDocuments = []; + $this->certificateType = null; + $this->idDocuments = null; + $this->validationSessionId = null; + $this->redirectPolicy = null; + $this->redirectWait = 5; + $this->autoSendAgreements = null; + $this->invitationMessage = null; } - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('firstname', null)->setAllowedTypes('firstname', ['null', 'string']) @@ -138,17 +91,11 @@ public static function configureData(OptionsResolver $resolver) ->setDefault('profile', null)->setAllowedTypes('profile', ['null', 'string']) ->setDefault('language', 'en')->setAllowedValues('language', [Language::BULGARIAN, Language::CATALAN, Language::GERMAN, Language::ENGLISH, Language::SPANISH, Language::FRENCH, Language::ITALIAN, Language::DUTCH, Language::POLISH, Language::PORTUGUESE, Language::ROMANIAN]) ->setDefault('role', self::ROLE_SIGNER)->setAllowedValues('role', [self::ROLE_SIGNER, self::ROLE_OBSERVER]) - ->setDefault('birthDate', null)->setAllowedTypes('birthDate', ['DateTime', 'null'])->setNormalizer('birthDate', function (Options $options, $value): ?\Laminas\XmlRpc\Value\DateTime { - if (null === $value) { - return null; - } - - return new \Laminas\XmlRpc\Value\DateTime($value); - }) + ->setDefault('birthDate', null)->setAllowedTypes('birthDate', [\DateTimeInterface::class, 'null']) ->setDefault('universignId', null)->setAllowedTypes('universignId', ['null', 'string']) - ->setDefault('successRedirection', null)->setAllowedTypes('successRedirection', ['array', 'null']) - ->setDefault('cancelRedirection', null)->setAllowedTypes('cancelRedirection', ['array', 'null']) - ->setDefault('failRedirection', null)->setAllowedTypes('failRedirection', ['array', 'null']) + ->setDefault('successRedirection', [])->setAllowedTypes('successRedirection', ['array']) + ->setDefault('cancelRedirection', [])->setAllowedTypes('cancelRedirection', ['array']) + ->setDefault('failRedirection', [])->setAllowedTypes('failRedirection', ['array']) ->setDefault('certificateType', null)->setAllowedValues('certificateType', [null, CertificateType::SIMPLE, CertificateType::CERTIFIED, CertificateType::ADVANCED]) ->setDefault('idDocuments', null)->setAllowedTypes('idDocuments', ['array', RegistrationRequest::class, 'null'])->setNormalizer('idDocuments', function (Options $options, $value) { if ($value instanceof RegistrationRequest || null === $value) { @@ -158,7 +105,7 @@ public static function configureData(OptionsResolver $resolver) return RegistrationRequest::createFromArray($value); }) ->setDefault('validationSessionId', null)->setAllowedTypes('validationSessionId', ['null', 'string']) - ->setDefault('redirectPolicy', null)->setAllowedValues('redirectPolicy', [null, 'dashboard', 'quick']) + ->setDefault('redirectPolicy', null)->setAllowedValues('redirectPolicy', ['null', 'dashboard', 'quick']) ->setDefault('redirectWait', 5)->setAllowedTypes('redirectWait', ['int'])->setNormalizer('redirectWait', function (Options $options, $value) { if ('quick' === $options['redirectPolicy']) { return null; @@ -172,10 +119,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -213,11 +156,6 @@ public static function createFromArray(array $options): self ; } - /** - * @param string|null $firstname - * - * @return self - */ public function setFirstname(?string $firstname): self { $this->firstname = $firstname; @@ -225,19 +163,11 @@ public function setFirstname(?string $firstname): self return $this; } - /** - * @return string|null - */ public function getFirstname(): ?string { return $this->firstname; } - /** - * @param string|null $lastname - * - * @return self - */ public function setLastname(?string $lastname): self { $this->lastname = $lastname; @@ -245,19 +175,11 @@ public function setLastname(?string $lastname): self return $this; } - /** - * @return string|null - */ public function getLastname(): ?string { return $this->lastname; } - /** - * @param string|null $organization - * - * @return self - */ public function setOrganization(?string $organization): self { $this->organization = $organization; @@ -265,19 +187,11 @@ public function setOrganization(?string $organization): self return $this; } - /** - * @return string|null - */ public function getOrganization(): ?string { return $this->organization; } - /** - * @param string|null $profile - * - * @return self - */ public function setProfile(?string $profile): self { $this->profile = $profile; @@ -285,19 +199,11 @@ public function setProfile(?string $profile): self return $this; } - /** - * @return string|null - */ public function getProfile(): ?string { return $this->profile; } - /** - * @param string|null $emailAddress - * - * @return self - */ public function setEmailAddress(?string $emailAddress): self { $this->emailAddress = $emailAddress; @@ -305,19 +211,11 @@ public function setEmailAddress(?string $emailAddress): self return $this; } - /** - * @return string|null - */ public function getEmailAddress(): ?string { return $this->emailAddress; } - /** - * @param string|null $phoneNum - * - * @return self - */ public function setPhoneNum(?string $phoneNum): self { $this->phoneNum = $phoneNum; @@ -325,79 +223,47 @@ public function setPhoneNum(?string $phoneNum): self return $this; } - /** - * @return string|null - */ public function getPhoneNum(): ?string { return $this->phoneNum; } - /** - * @param string|null $language - * - * @return self - */ - public function setLanguage(?string $language): self + public function setLanguage(string $language): self { $this->language = $language; return $this; } - /** - * @return string|null - */ - public function getLanguage(): ?string + public function getLanguage(): string { return $this->language; } - /** - * @param string|null $role - * - * @return self - */ - public function setRole(?string $role): self + public function setRole(string $role): self { $this->role = $role; return $this; } - /** - * @return string|null - */ - public function getRole(): ?string + public function getRole(): string { return $this->role; } - /** - * @param \Laminas\XmlRpc\Value\DateTime|null $birthDate - * - * @return self - */ - public function setBirthDate(?\Laminas\XmlRpc\Value\DateTime $birthDate): self + public function setBirthDate(?\DateTimeInterface $birthDate): self { $this->birthDate = $birthDate; return $this; } - /** - * @return \Laminas\XmlRpc\Value\DateTime|null - */ - public function getBirthDate(): ?\Laminas\XmlRpc\Value\DateTime + public function getBirthDate(): ?\DateTimeInterface { return $this->birthDate; } - /** - * @param string|null $universignId - * - * @return self - */ public function setUniversignId(?string $universignId): self { $this->universignId = $universignId; @@ -405,79 +271,47 @@ public function setUniversignId(?string $universignId): self return $this; } - /** - * @return string|null - */ public function getUniversignId(): ?string { return $this->universignId; } - /** - * @param array|null $successRedirection - * - * @return self - */ - public function setSuccessRedirection(?array $successRedirection): self + public function setSuccessRedirection(array $successRedirection): self { $this->successRedirection = $successRedirection; return $this; } - /** - * @return array|null - */ - public function getSuccessRedirection(): ?array + public function getSuccessRedirection(): array { return $this->successRedirection; } - /** - * @param array|null $failRedirection - * - * @return self - */ - public function setFailRedirection(?array $failRedirection): self + public function setFailRedirection(array $failRedirection): self { $this->failRedirection = $failRedirection; return $this; } - /** - * @return array|null - */ - public function getFailRedirection(): ?array + public function getFailRedirection(): array { return $this->failRedirection; } - /** - * @param array|null $cancelRedirection - * - * @return self - */ - public function setCancelRedirection(?array $cancelRedirection): self + public function setCancelRedirection(array $cancelRedirection): self { $this->cancelRedirection = $cancelRedirection; return $this; } - /** - * @return array|null - */ - public function getCancelRedirection(): ?array + public function getCancelRedirection(): array { return $this->cancelRedirection; } - /** - * @param string|null $certificateType - * - * @return self - */ public function setCertificateType(?string $certificateType): self { $this->certificateType = $certificateType; @@ -485,19 +319,11 @@ public function setCertificateType(?string $certificateType): self return $this; } - /** - * @return string|null - */ public function getCertificateType(): ?string { return $this->certificateType; } - /** - * @param array|null $idDocument - * - * @return self - */ public function setIdDocuments(?RegistrationRequest $idDocuments): self { $this->idDocuments = $idDocuments; @@ -505,19 +331,11 @@ public function setIdDocuments(?RegistrationRequest $idDocuments): self return $this; } - /** - * @return array|null - */ public function getIdDocuments(): ?RegistrationRequest { return $this->idDocuments; } - /** - * @param string|null $validationSessionId - * - * @return self - */ public function setValidationSessionId(?string $validationSessionId): self { $this->validationSessionId = $validationSessionId; @@ -525,19 +343,11 @@ public function setValidationSessionId(?string $validationSessionId): self return $this; } - /** - * @return string|null - */ public function getValidationSessionId(): ?string { return $this->validationSessionId; } - /** - * @param string|null $redirectPolicy - * - * @return self - */ public function setRedirectPolicy(?string $redirectPolicy): self { $this->redirectPolicy = $redirectPolicy; @@ -545,39 +355,23 @@ public function setRedirectPolicy(?string $redirectPolicy): self return $this; } - /** - * @return string|null - */ public function getRedirectPolicy(): ?string { return $this->redirectPolicy; } - /** - * @param int|null $redirectWait - * - * @return self - */ - public function setRedirectWait(?int $redirectWait): self + public function setRedirectWait(int $redirectWait): self { $this->redirectWait = $redirectWait; return $this; } - /** - * @return int|null - */ - public function getRedirectWait(): ?int + public function getRedirectWait(): int { return $this->redirectWait; } - /** - * @param bool|null $autoSendAgreements - * - * @return self - */ public function setAutoSendAgreements(?bool $autoSendAgreements): self { $this->autoSendAgreements = $autoSendAgreements; @@ -585,19 +379,11 @@ public function setAutoSendAgreements(?bool $autoSendAgreements): self return $this; } - /** - * @return bool|null - */ public function getAutoSendAgreements(): ?bool { return $this->autoSendAgreements; } - /** - * @param string|null $invitationMessage - * - * @return self - */ public function setInvitationMessage(?string $invitationMessage): self { $this->invitationMessage = $invitationMessage; @@ -605,9 +391,6 @@ public function setInvitationMessage(?string $invitationMessage): self return $this; } - /** - * @return string|null - */ public function getInvitationMessage(): ?string { return $this->invitationMessage; diff --git a/Model/SignerInfo.php b/Model/SignerInfo.php index 34ec79d..97b30b9 100644 --- a/Model/SignerInfo.php +++ b/Model/SignerInfo.php @@ -23,90 +23,63 @@ class SignerInfo public const STATUS_CANCELED = 'canceled'; public const STATUS_FAILED = 'failed'; - /** - * @var string - */ - protected $status; + protected ?string $status; - /** - * @var string - */ - protected $error; + protected ?string $error; - /** - * @var CertificateInfo - */ - protected $certificateInfo; + protected ?CertificateInfo $certificateInfo; - /** - * @var string - */ - protected $url; + protected ?string $url; - /** - * @var string - */ - protected $id; + protected ?string $id; - /** - * @var string - */ - protected $email; + protected ?string $email; - /** - * @var string - */ - protected $firstName; + protected ?string $firstName; - /** - * @var string - */ - protected $lastName; + protected ?string $lastName; - /** - * @var \DateTime - */ - protected $actionDate; + protected ?\DateTime $actionDate; /** * @var array */ - protected $refusedDocs; + protected array $refusedDocs; - /** - * @var string - */ - protected $refusalComment; + protected ?string $refusalComment; - /** - * @var string - */ - protected $redirectPolicy; + protected ?string $redirectPolicy; - /** - * @var int - */ - protected $redirectWait; + protected ?int $redirectWait; - /** - * @var null|array - */ - protected $idDocuments; + protected ?array $idDocuments; public function __construct() { + $this->status = null; + $this->error = null; + $this->certificateInfo = null; + $this->url = null; + $this->id = null; + $this->email = null; + $this->firstName = null; + $this->lastName = null; + $this->actionDate = null; $this->refusedDocs = []; + $this->refusalComment = null; + $this->redirectPolicy = null; + $this->redirectWait = null; + $this->redirectPolicy = null; + $this->redirectWait = null; + $this->idDocuments = null; } - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('status', null)->setAllowedTypes('status', ['null', 'string']) ->setDefault('error', null)->setAllowedTypes('error', ['null', 'string']) - ->setDefault('certificateInfo', null)->setAllowedTypes('certificateInfo', ['null', 'array', CertificateInfo::class])->setNormalizer('certificateInfo', function(Options $options, $value) { + ->setDefault('certificateInfo', null)->setAllowedTypes('certificateInfo', ['null', 'array', CertificateInfo::class])->setNormalizer('certificateInfo', function (Options $options, $value) { if (null === $value || $value instanceof CertificateInfo) { return $value; } @@ -118,14 +91,14 @@ public static function configureData(OptionsResolver $resolver) ->setDefault('email', null)->setAllowedTypes('email', ['null', 'string']) ->setDefault('firstName', null)->setAllowedTypes('firstName', ['null', 'string']) ->setDefault('lastName', null)->setAllowedTypes('lastName', ['null', 'string']) - ->setDefault('actionDate', null)->setAllowedTypes('actionDate', ['null', 'string', \DateTime::class])->setNormalizer('actionDate', function(Options $options, $value) { + ->setDefault('actionDate', null)->setAllowedTypes('actionDate', ['null', 'string', \DateTime::class])->setNormalizer('actionDate', function (Options $options, $value) { if (null === $value || $value instanceof \DateTime) { return $value; } return \DateTime::createFromFormat("Ymd\TH:i:s", $value); }) - ->setDefault('refusedDocs', null)->setAllowedTypes('refusedDocs', ['null', 'string']) + ->setDefault('refusedDocs', [])->setAllowedTypes('refusedDocs', ['null', 'array']) ->setDefault('refusalComment', null)->setAllowedTypes('refusalComment', ['null', 'string']) ->setDefault('redirectPolicy', null)->setAllowedTypes('redirectPolicy', ['null', 'string']) ->setDefault('redirectWait', null)->setAllowedTypes('redirectWait', ['null', 'int']) @@ -134,10 +107,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -169,24 +138,6 @@ public static function createFromArray(array $options): self ; } - /** - * @param string|null $date - * - * @return \DateTime|null - */ - private static function createDate(?string $date): ?\DateTime { - if (is_null($date)) { - return null; - } - - return \DateTime::createFromFormat("Ymd\TH:i:s", $date); - } - - /** - * @param string|null $status - * - * @return self - */ public function setStatus(?string $status): self { $this->status = $status; @@ -194,19 +145,11 @@ public function setStatus(?string $status): self return $this; } - /** - * @return string|null - */ public function getStatus(): ?string { return $this->status; } - /** - * @param string|null $error - * - * @return self - */ public function setError(?string $error): self { $this->error = $error; @@ -214,19 +157,11 @@ public function setError(?string $error): self return $this; } - /** - * @return string|null - */ public function getError(): ?string { return $this->error; } - /** - * @param CertificateInfo|null $certificateInfo - * - * @return self - */ public function setCertificateInfo(?CertificateInfo $certificateInfo): self { $this->certificateInfo = $certificateInfo; @@ -234,19 +169,11 @@ public function setCertificateInfo(?CertificateInfo $certificateInfo): self return $this; } - /** - * @return CertificateInfo|null - */ public function getCertificateInfo(): ?CertificateInfo { return $this->certificateInfo; } - /** - * @param string|null $url - * - * @return self - */ public function setUrl(?string $url): self { $this->url = $url; @@ -254,19 +181,11 @@ public function setUrl(?string $url): self return $this; } - /** - * @return string|null - */ public function getUrl(): ?string { return $this->url; } - /** - * @param string|null $id - * - * @return self - */ public function setId(?string $id): self { $this->id = $id; @@ -274,19 +193,11 @@ public function setId(?string $id): self return $this; } - /** - * @return string|null - */ public function getId(): ?string { return $this->id; } - /** - * @param string|null $email - * - * @return self - */ public function setEmail(?string $email): self { $this->email = $email; @@ -294,19 +205,11 @@ public function setEmail(?string $email): self return $this; } - /** - * @return string|null - */ public function getEmail(): ?string { return $this->email; } - /** - * @param string|null $firstName - * - * @return self - */ public function setFirstName(?string $firstName): self { $this->firstName = $firstName; @@ -314,19 +217,11 @@ public function setFirstName(?string $firstName): self return $this; } - /** - * @return string|null - */ public function getFirstName(): ?string { return $this->firstName; } - /** - * @param string|null $lastName - * - * @return self - */ public function setLastName(?string $lastName): self { $this->lastName = $lastName; @@ -334,19 +229,11 @@ public function setLastName(?string $lastName): self return $this; } - /** - * @return string|null - */ public function getLastName(): ?string { return $this->lastName; } - /** - * @param \DateTime|null $actionDate - * - * @return self - */ public function setActionDate(?\DateTime $actionDate): self { $this->actionDate = $actionDate; @@ -354,39 +241,23 @@ public function setActionDate(?\DateTime $actionDate): self return $this; } - /** - * @return \DateTime|null - */ public function getActionDate(): ?\DateTime { return $this->actionDate; } - /** - * @param array|null $refusedDocs - * - * @return self - */ - public function setRefusedDocs(?array $refusedDocs): self + public function setRefusedDocs(array $refusedDocs): self { $this->refusedDocs = $refusedDocs; return $this; } - /** - * @return array|null - */ - public function getRefusedDocs(): ?array + public function getRefusedDocs(): array { return $this->refusedDocs; } - /** - * @param string|null $refusalComment - * - * @return self - */ public function setRefusalComment(?string $refusalComment): self { $this->refusalComment = $refusalComment; @@ -394,19 +265,11 @@ public function setRefusalComment(?string $refusalComment): self return $this; } - /** - * @return string|null - */ public function getRefusalComment(): ?string { return $this->refusalComment; } - /** - * @param string|null $redirectPolicy - * - * @return self - */ public function setRediRectPolicy(?string $redirectPolicy): self { $this->redirectPolicy = $redirectPolicy; @@ -414,19 +277,11 @@ public function setRediRectPolicy(?string $redirectPolicy): self return $this; } - /** - * @return string|null - */ public function getRedirectPolicy(): ?string { return $this->redirectPolicy; } - /** - * @param int|null $redirectWait - * - * @return self - */ public function setRedirectWait(?int $redirectWait): self { $this->redirectWait = $redirectWait; @@ -434,27 +289,16 @@ public function setRedirectWait(?int $redirectWait): self return $this; } - /** - * @return int|null - */ public function getRedirectWait(): ?int { return $this->redirectWait; } - /** - * @return array|null - */ public function getIdDocuments(): ?array { return $this->idDocuments; } - /** - * @param array|null $idDocuments - * - * @return SignerInfo - */ public function setIdDocuments(?array $idDocuments): SignerInfo { $this->idDocuments = $idDocuments; diff --git a/Model/TransactionFilter.php b/Model/TransactionFilter.php index b254232..874260d 100644 --- a/Model/TransactionFilter.php +++ b/Model/TransactionFilter.php @@ -8,130 +8,64 @@ use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class TransactionFilter { - /** - * @var string - */ - protected $requesterEmail; + protected ?string $requesterEmail; - /** - * @var string - */ - protected $profile; + protected ?string $profile; - /** - * @var \Laminas\XmlRpc\Value\DateTime - */ - protected $notBefore; + protected ?\DateTimeInterface $notBefore; - /** - * @var \Laminas\XmlRpc\Value\DateTime - */ - protected $notAfter; + protected ?\DateTimeInterface $notAfter; - /** - * @var int - */ - protected $startRange; + protected ?int $startRange; - /** - * @var int - */ - protected $stopRange; + protected ?int $stopRange; - /** - * @var string - */ - protected $signerId; + protected ?string $signerId; - /** - * @var \Laminas\XmlRpc\Value\DateTime - */ - protected $notBeforeCompletion; + protected ?\DateTimeInterface $notBeforeCompletion; - /** - * @var \Laminas\XmlRpc\Value\DateTime - */ - protected $notAfterCompletion; + protected ?\DateTimeInterface $notAfterCompletion; - /** - * @var int - */ - protected $status; + protected ?int $status; - /** - * @var bool - */ - protected $withAffiliated; + protected ?bool $withAffiliated; - /** - * @return TransactionFilter - */ - public function initiateTransactionFilter(): TransactionFilter + public function __construct() { - return new self(); + $this->requesterEmail = null; + $this->profile = null; + $this->notBefore = null; + $this->notAfter = null; + $this->startRange = null; + $this->stopRange = null; + $this->signerId = null; + $this->notBeforeCompletion = null; + $this->notAfterCompletion = null; + $this->status = null; + $this->withAffiliated = null; } - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('requesterEmail', null)->setAllowedTypes('requesterEmail', ['string', 'null']) ->setDefault('profile', null)->setAllowedTypes('profile', ['string', 'null']) - ->setDefault('notBefore', null)->setAllowedTypes('notBefore', ['DateTime', 'null'])->setNormalizer('notBefore', function (Options $option, $value) { - if (null === $value) { - return null; - } - $value = $value->format('Ymd\TH:i:s'); - $date = new \Laminas\XmlRpc\Value\DateTime($value); - - return $date; - }) - ->setDefault('notAfter', null)->setAllowedTypes('notAfter', ['DateTime', 'null'])->setNormalizer('notAfter', function (Options $options, $value) { - if (null === $value) { - return null; - } - $value = $value->format('Ymd\TH:i:s'); - $date = new \Laminas\XmlRpc\Value\DateTime($value); - - return $date; - }) + ->setDefault('notBefore', null)->setAllowedTypes('notBefore', [\DateTimeInterface::class, 'null']) + ->setDefault('notAfter', null)->setAllowedTypes('notAfter', [\DateTimeInterface::class, 'null']) ->setDefault('startRange', null)->setAllowedTypes('startRange', ['int', 'null']) ->setDefault('stopRange', null)->setAllowedTypes('stopRange', ['int', 'null']) ->setDefault('signerId', null)->setAllowedTypes('signerId', ['string', 'null']) - ->setDefault('notBeforeCompletion', null)->setAllowedTypes('notBeforeCompletion', ['DateTime', 'null'])->setNormalizer('notBeforeCompletion', function (Options $options, $value) { - if (null === $value) { - return null; - } - $value = $value->format('Ymd\TH:i:s'); - $date = new \Laminas\XmlRpc\Value\DateTime($value); - - return $date; - }) - ->setDefault('notAfterCompletion', null)->setAllowedTypes('notAfterCompletion', ['DateTime', 'null'])->setNormalizer('notAfterCompletion', function (Options $options, $value) { - if (null === $value) { - return null; - } - $value = $value->format('Ymd\TH:i:s'); - $date = new \Laminas\XmlRpc\Value\DateTime($value); - - return $date; - }) + ->setDefault('notBeforeCompletion', null)->setAllowedTypes('notBeforeCompletion', [\DateTimeInterface::class, 'null']) + ->setDefault('notAfterCompletion', null)->setAllowedTypes('notAfterCompletion', [\DateTimeInterface::class, 'null']) ->setDefault('status', null)->setAllowedTypes('status', ['int', 'null']) ->setDefault('withAffiliated', null)->setAllowedTypes('withAffiliated', ['bool', 'null']); } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -160,11 +94,6 @@ public static function createFromArray(array $options): self ; } - /** - * @param string|null $requesterEmail - * - * @return self - */ public function setRequesterEmail(?string $requesterEmail): self { $this->requesterEmail = $requesterEmail; @@ -172,19 +101,11 @@ public function setRequesterEmail(?string $requesterEmail): self return $this; } - /** - * @return string|null - */ public function getRequesterEmail(): ?string { return $this->requesterEmail; } - /** - * @param string|null - * - * @return self - */ public function setProfile(?string $profile): self { $this->profile = $profile; @@ -192,59 +113,35 @@ public function setProfile(?string $profile): self return $this; } - /** - * @return string|null - */ public function getProfile(): ?string { return $this->profile; } - /** - * @param \Laminas\XmlRpc\Value\DateTime|null $notBefore - * - * @return self - */ - public function setNotBefore(?\Laminas\XmlRpc\Value\DateTime $notBefore): self + public function setNotBefore(?\DateTimeInterface $notBefore): self { $this->notBefore = $notBefore; return $this; } - /** - * @return \Laminas\XmlRpc\Value\DateTime|null - */ - public function getNotBefore(): ?\Laminas\XmlRpc\Value\DateTime + public function getNotBefore(): ?\DateTimeInterface { return $this->notBefore; } - /** - * @param \Laminas\XmlRpc\Value\DateTime|null $notAfter - * - * @return self - */ - public function setNotAfter(?\Laminas\XmlRpc\Value\DateTime $notAfter): self + public function setNotAfter(?\DateTimeInterface $notAfter): self { $this->notAfter = $notAfter; return $this; } - /** - * @return \Laminas\XmlRpc\Value\DateTime|null - */ - public function getNotAfter(): ?\Laminas\XmlRpc\Value\DateTime + public function getNotAfter(): ?\DateTimeInterface { return $this->notAfter; } - /** - * @param int|null $startRange - * - * @return self - */ public function setStartRange(?int $startRange): self { $this->startRange = $startRange; @@ -252,19 +149,11 @@ public function setStartRange(?int $startRange): self return $this; } - /** - * @return int|null - */ public function getStartRange(): ?int { return $this->startRange; } - /** - * @param int|null $stopRange - * - * @return self - */ public function setStopRange(?int $stopRange): self { $this->stopRange = $stopRange; @@ -272,19 +161,11 @@ public function setStopRange(?int $stopRange): self return $this; } - /** - * @return int|null - */ public function getStopRange(): ?int { return $this->stopRange; } - /** - * @param string|null - * - * @return self - */ public function setSignerId(?string $signerId): self { $this->signerId = $signerId; @@ -292,59 +173,35 @@ public function setSignerId(?string $signerId): self return $this; } - /** - * @return string|null - */ public function getSignerId(): ?string { return $this->signerId; } - /** - * @param \Laminas\XmlRpc\Value\DateTime|null $notBeforeCompletion - * - * @return self - */ - public function setNotBeforeCompletion(?\Laminas\XmlRpc\Value\DateTime $notBeforeCompletion): self + public function setNotBeforeCompletion(?\DateTimeInterface $notBeforeCompletion): self { $this->notBeforeCompletion = $notBeforeCompletion; return $this; } - /** - * @return \Laminas\XmlRpc\Value\DateTime|null - */ - public function getNotBeforeCompletion(): ?\Laminas\XmlRpc\Value\DateTime + public function getNotBeforeCompletion(): ?\DateTimeInterface { return $this->notBeforeCompletion; } - /** - * @param \Laminas\XmlRpc\Value\DateTime|null $notAfterCompletion - * - * @return self - */ - public function setNotAfterCompletion(?\Laminas\XmlRpc\Value\DateTime $notAfterCompletion): self + public function setNotAfterCompletion(?\DateTimeInterface $notAfterCompletion): self { $this->notAfterCompletion = $notAfterCompletion; return $this; } - /** - * @return \Laminas\XmlRpc\Value\DateTime|null - */ - public function getNotAfterCompletion(): ?\Laminas\XmlRpc\Value\DateTime + public function getNotAfterCompletion(): ?\DateTimeInterface { return $this->notAfterCompletion; } - /** - * @param int|null $status - * - * @return self - */ public function setStatus(?int $status): self { $this->status = $status; @@ -352,19 +209,11 @@ public function setStatus(?int $status): self return $this; } - /** - * @return int|null - */ public function getStatus(): ?int { return $this->status; } - /** - * @param bool|null $withAffiliated - * - * @return self - */ public function setWithAffiliated(?bool $withAffiliated): self { $this->withAffiliated = $withAffiliated; @@ -372,9 +221,6 @@ public function setWithAffiliated(?bool $withAffiliated): self return $this; } - /** - * @return bool|null - */ public function getWithAffiliated(): ?bool { return $this->withAffiliated; diff --git a/Model/TransactionInfo.php b/Model/TransactionInfo.php index 41085cc..61ec3cc 100644 --- a/Model/TransactionInfo.php +++ b/Model/TransactionInfo.php @@ -13,75 +13,36 @@ class TransactionInfo public const STATUS_FAILED = 'failed'; public const STATUS_COMPLETED = 'completed'; - /** - * @var string - */ - protected $state; + protected ?string $state; - /** - * @var string - */ - protected $errorMessage; + protected ?string $errorMessage; - /** - * @var int - */ - protected $errorCode; + protected int $errorCode; - /** - * @var string - */ - protected $status; + protected ?string $status; /** * @var array */ - protected $signerInfos; + protected array $signerInfos; - /** - * @var int - */ - protected $currentSigner; + protected ?int $currentSigner; - /** - * @var \DateTime - */ - protected $creationDate; + protected ?\DateTime $creationDate; - /** - * @var string - */ - protected $description; + protected ?string $description; - /** - * @var InitiatorInfo - */ - protected $initiatorInfo; + protected InitiatorInfo $initiatorInfo; - /** - * @var bool - */ - protected $eachField; + protected ?bool $eachField; - /** - * @var string - */ - protected $customerId; + protected ?string $customerId; - /** - * @var string - */ - protected $transactionId; + protected ?string $transactionId; - /** - * @var string - */ - protected $redirectPolicy; + protected ?string $redirectPolicy; - /** - * @var int - */ - protected $redirectWait; + protected ?int $redirectWait; public function __construct() { @@ -101,11 +62,6 @@ public function __construct() $this->errorCode = 0; } - /** - * @param string|null $state - * - * @return self - */ public function setState(?string $state): self { $this->state = $state; @@ -113,19 +69,11 @@ public function setState(?string $state): self return $this; } - /** - * @return string|null - */ public function getState(): ?string { return $this->state; } - /** - * @param string|null $errorMessage - * - * @return self - */ public function setErrorMessage(?string $errorMessage): self { $this->errorMessage = $errorMessage; @@ -133,39 +81,23 @@ public function setErrorMessage(?string $errorMessage): self return $this; } - /** - * @return string|null - */ public function getErrorMessage(): ?string { return $this->errorMessage; } - /** - * @return int - */ public function getErrorCode(): int { return $this->errorCode; } - /** - * @param int $errorCode - * - * @return TransactionInfo - */ - public function setErrorCode(int $errorCode): TransactionInfo + public function setErrorCode(int $errorCode): self { $this->errorCode = $errorCode; return $this; } - /** - * @param string|null $status - * - * @return self - */ public function setStatus(?string $status): self { $this->status = $status; @@ -173,32 +105,22 @@ public function setStatus(?string $status): self return $this; } - /** - * @return string|null - */ public function getStatus(): ?string { return $this->status; } /** - * @param array|null $signerInfos - * - * @return self + * @param array $signerInfos */ - public function setSignerInfos(?array $signerInfos): self + public function setSignerInfos(array $signerInfos): self { $this->signerInfos = $signerInfos; return $this; } - /** - * @param SignerInfo|null $signerInfo - * - * @return self - */ - public function addSignerInfo(?SignerInfo $signerInfo): self + public function addSignerInfo(SignerInfo $signerInfo): self { $this->signerInfos[] = $signerInfo; @@ -206,18 +128,13 @@ public function addSignerInfo(?SignerInfo $signerInfo): self } /** - * @return array|null + * @return array */ - public function getSignerInfos(): ?array + public function getSignerInfos(): array { return $this->signerInfos; } - /** - * @param int|null $currentSigner - * - * @return self - */ public function setCurrentSigner(?int $currentSigner): self { $this->currentSigner = $currentSigner; @@ -225,19 +142,11 @@ public function setCurrentSigner(?int $currentSigner): self return $this; } - /** - * @return int|null - */ public function getCurrentSigner(): ?int { return $this->currentSigner; } - /** - * @param \DateTime|null $creationDate - * - * @return self - */ public function setCreationDate(?\DateTime $creationDate): self { $this->creationDate = $creationDate; @@ -245,19 +154,11 @@ public function setCreationDate(?\DateTime $creationDate): self return $this; } - /** - * @return \DateTime|null - */ public function getCreationDate(): ?\DateTime { return $this->creationDate; } - /** - * @param string|null $description - * - * @return self - */ public function setDescription(?string $description): self { $this->description = $description; @@ -265,19 +166,11 @@ public function setDescription(?string $description): self return $this; } - /** - * @return string|null - */ public function getDescription(): ?string { return $this->description; } - /** - * @param InitiatorInfo|null $initiatorInfo - * - * @return self - */ public function setInitiatorInfo(?InitiatorInfo $initiatorInfo): self { $this->initiatorInfo = $initiatorInfo; @@ -285,19 +178,11 @@ public function setInitiatorInfo(?InitiatorInfo $initiatorInfo): self return $this; } - /** - * @return InitiatorInfo|null - */ public function getInitiatorInfo(): ?InitiatorInfo { return $this->initiatorInfo; } - /** - * @param bool|null $eachField - * - * @return self - */ public function setEachField(?bool $eachField): self { $this->eachField = $eachField; @@ -305,19 +190,11 @@ public function setEachField(?bool $eachField): self return $this; } - /** - * @return bool|null - */ public function getEachField(): ?bool { return $this->eachField; } - /** - * @param string|null $customerId - * - * @return self - */ public function setCustomerId(?string $customerId): self { $this->customerId = $customerId; @@ -325,19 +202,11 @@ public function setCustomerId(?string $customerId): self return $this; } - /** - * @return string|null - */ public function getCustomerId(): ?string { return $this->customerId; } - /** - * @param string|null $transactionId - * - * @return self - */ public function setTransactionId(?string $transactionId): self { $this->transactionId = $transactionId; @@ -345,19 +214,11 @@ public function setTransactionId(?string $transactionId): self return $this; } - /** - * @return string|null - */ public function getTransactionId(): ?string { return $this->transactionId; } - /** - * @param string|null $redirectPolicy - * - * @return self - */ public function setRedirectPolicy(?string $redirectPolicy): self { $this->redirectPolicy = $redirectPolicy; @@ -365,19 +226,11 @@ public function setRedirectPolicy(?string $redirectPolicy): self return $this; } - /** - * @return string|null - */ public function getRedirectPolicy(): ?string { return $this->redirectPolicy; } - /** - * @param int|null $redirectWait - * - * @return self - */ public function setRedirectWait(?int $redirectWait): self { $this->redirectWait = $redirectWait; @@ -385,9 +238,6 @@ public function setRedirectWait(?int $redirectWait): self return $this; } - /** - * @return int|null - */ public function getRedirectWait(): ?int { return $this->redirectWait; diff --git a/Model/TransactionRequest.php b/Model/TransactionRequest.php index c9f5bef..b643288 100644 --- a/Model/TransactionRequest.php +++ b/Model/TransactionRequest.php @@ -13,136 +13,90 @@ class TransactionRequest { - /** - * @var string - */ - protected $profile; + protected ?string $profile; - /** - * @var string - */ - protected $customId; + protected ?string $customId; /** * @var array */ - protected $signers; + protected array $signers; /** * @var array */ - protected $documents; + protected array $documents; - /** - * @var bool - */ - protected $mustContactFirstSigner; + protected bool $mustContactFirstSigner; - /** - * @var bool - */ - protected $finalDocSent; + protected bool $finalDocSent; - /** - * @var bool - */ - protected $finalDocRequesterSent; + protected bool $finalDocRequesterSent; - /** - * @var bool - */ - protected $finalDocObserverSent; + protected bool $finalDocObserverSent; - /** - * @var string - */ - protected $description; + protected ?string $description; - /** - * @var string - */ - protected $certificateType; + protected string $certificateType; - /** - * @var string - */ - protected $language; + protected string $language; - /** - * @var int - */ - protected $handwrittenSignatureMode; + protected ?int $handwrittenSignatureMode; - /** - * @var string - */ - protected $chainingMode; + protected string $chainingMode; - /** - * @var array - */ - protected $finalDocCCeMails; + protected ?array $finalDocCCeMails; - /** - * @var RedirectionConfig - */ - protected $autoValidationRedirection; + protected ?RedirectionConfig $autoValidationRedirection; - /** - * @var string - */ - protected $redirectPolicy; + protected string $redirectPolicy; - /** - * @var int - */ - protected $redirectWait; + protected int $redirectWait; - /** - * @var bool - */ - protected $autoSendAgreements; + protected ?bool $autoSendAgreements; - /** - * @var string - */ - protected $operator; + protected ?string $operator; - /** - * @var string - */ - protected $registrationCallbackURL; + protected ?string $registrationCallbackURL; - /** - * @var RedirectionConfig - */ - protected $successRedirection; + protected ?RedirectionConfig $successRedirection; - /** - * @var RedirectionConfig - */ - protected $failRedirection; + protected ?RedirectionConfig $failRedirection; - /** - * @var RedirectionConfig - */ - protected $cancelRedirection; + protected ?RedirectionConfig $cancelRedirection; - /** - * @var string - */ - protected $invitationMessage; + protected ?string $invitationMessage; public function __construct() { + $this->profile = null; + $this->customId = null; $this->signers = []; $this->documents = []; - } - - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + $this->mustContactFirstSigner = false; + $this->finalDocSent = false; + $this->finalDocRequesterSent = false; + $this->finalDocObserverSent = false; + $this->description = null; + $this->certificateType = CertificateType::SIMPLE; + $this->language = 'en'; + $this->handwrittenSignatureMode = null; + $this->chainingMode = 'email'; + $this->finalDocCCeMails = null; + $this->autoValidationRedirection = null; + $this->redirectPolicy = 'dashboard'; + $this->redirectWait = 5; + $this->autoSendAgreements = null; + $this->operator = null; + $this->autoSendAgreements = null; + $this->registrationCallbackURL = null; + $this->successRedirection = null; + $this->cancelRedirection = null; + $this->failRedirection = null; + $this->invitationMessage = null; + } + + public static function configureData(OptionsResolver $resolver): void { $resolver ->setDefault('profile', null)->setAllowedTypes('profile', ['null', 'string']) @@ -205,10 +159,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -250,11 +200,6 @@ public static function createFromArray(array $options): self ; } - /** - * @param string|null $profile - * - * @return self - */ public function setProfile(?string $profile): self { $this->profile = $profile; @@ -262,19 +207,11 @@ public function setProfile(?string $profile): self return $this; } - /** - * @return string|null - */ public function getProfile(): ?string { return $this->profile; } - /** - * @param string|null $customId - * - * @return self - */ public function setCustomId(?string $customId): self { $this->customId = $customId; @@ -282,19 +219,11 @@ public function setCustomId(?string $customId): self return $this; } - /** - * @return string|null - */ public function getCustomId(): ?string { return $this->customId; } - /** - * @param Signer $signer - * - * @return self - */ public function addSigner(Signer $signer): self { $this->signers[] = $signer; @@ -304,8 +233,6 @@ public function addSigner(Signer $signer): self /** * @param array $signers - * - * @return self */ public function setSigners(array $signers): self { @@ -322,12 +249,6 @@ public function getSigners(): array return $this->signers; } - /** - * @param string $name - * @param Document $document - * - * @return self - */ public function addDocument(string $name, Document $document): self { $this->documents[$name] = $document; @@ -337,8 +258,6 @@ public function addDocument(string $name, Document $document): self /** * @param array $documents - * - * @return self */ public function setDocuments(array $documents): self { @@ -347,11 +266,6 @@ public function setDocuments(array $documents): self return $this; } - /** - * @param string $name - * - * @return Document - */ public function getDocument(string $name): Document { return $this->documents[$name]; @@ -365,89 +279,54 @@ public function getDocuments(): array return $this->documents; } - /** - * @param bool|null $mustContactFirstSigner - * - * @return self - */ - public function setMustContactFirstSigner(?bool $mustContactFirstSigner): self + public function setMustContactFirstSigner(bool $mustContactFirstSigner): self { $this->mustContactFirstSigner = $mustContactFirstSigner; return $this; } - /** - * @return bool|null - */ - public function getMustContactFirstSigner(): ?bool + public function getMustContactFirstSigner(): bool { return $this->mustContactFirstSigner; } - /** - * @param bool|null $finalDocSent - * - * @return self - */ - public function setFinalDocSent(?bool $finalDocSent): self + public function setFinalDocSent(bool $finalDocSent): self { $this->finalDocSent = $finalDocSent; return $this; } - /** - * @param bool|null - */ - public function getFinalDocSent(): ?bool + public function getFinalDocSent(): bool { return $this->finalDocSent; } - /** - * @param bool|null $finalDocRequesterSent - * - * @return self - */ - public function setFinalDocRequesterSent(?bool $finalDocRequesterSent): self + public function setFinalDocRequesterSent(bool $finalDocRequesterSent): self { $this->finalDocRequesterSent = $finalDocRequesterSent; return $this; } - /** - * @return bool|null - */ - public function getFinalDocRequesterSent(): ?bool + public function getFinalDocRequesterSent(): bool { return $this->finalDocRequesterSent; } - /** - * @param bool|null $finalDocObserverSent - * - * @return self - */ - public function setFinalDocObserverSent(?bool $finalDocObserverSent): self + public function setFinalDocObserverSent(bool $finalDocObserverSent): self { $this->finalDocObserverSent = $finalDocObserverSent; return $this; } - /** - * @return bool|null - */ - public function getFinalDocObserverSent(): ?bool + public function getFinalDocObserverSent(): bool { return $this->finalDocObserverSent; } - /** - * @param string|null $descripton - */ public function setDescription(?string $description): self { $this->description = $description; @@ -455,59 +334,35 @@ public function setDescription(?string $description): self return $this; } - /** - * @return string|null - */ public function getDescription(): ?string { return $this->description; } - /** - * @param string|null $certificateType - * - * @return self - */ - public function setCertificateType(?string $certificateType): self + public function setCertificateType(string $certificateType): self { $this->certificateType = $certificateType; return $this; } - /** - * @return string|null - */ - public function getCertificateType(): ?string + public function getCertificateType(): string { return $this->certificateType; } - /** - * @param string|null $language - * - * @return self - */ - public function setLanguage(?string $language): self + public function setLanguage(string $language): self { $this->language = $language; return $this; } - /** - * @return string|null - */ - public function getLanguage(): ?string + public function getLanguage(): string { return $this->language; } - /** - * @param int|null $handwrittenSignatureMode - * - * @return self - */ public function setHandwrittenSignatureMode(?int $handwrittenSignatureMode): self { $this->handwrittenSignatureMode = $handwrittenSignatureMode; @@ -515,39 +370,23 @@ public function setHandwrittenSignatureMode(?int $handwrittenSignatureMode): sel return $this; } - /** - * @return int|null - */ public function getHandwrittenSignatureMode(): ?int { return $this->handwrittenSignatureMode; } - /** - * @param string|null $chainingMode - * - * @return self - */ - public function setChainingMode(?string $chainingMode): self + public function setChainingMode(string $chainingMode): self { $this->chainingMode = $chainingMode; return $this; } - /** - * @return string|null - */ - public function getChainingMode(): ?string + public function getChainingMode(): string { return $this->chainingMode; } - /** - * @param array|null $finalDocCCeMails - * - * @return self - */ public function setFinalDocCCeMails(?array $finalDocCCeMails): self { $this->finalDocCCeMails = $finalDocCCeMails; @@ -555,19 +394,11 @@ public function setFinalDocCCeMails(?array $finalDocCCeMails): self return $this; } - /** - * @return array|null - */ public function getFinalDocCCemails(): ?array { return $this->finalDocCCeMails; } - /** - * @param RedirectionConfig|null $autoValidationRedirection - * - * @return self - */ public function setAutoValidationRedirection(?RedirectionConfig $autoValidationRedirection): self { $this->autoValidationRedirection = $autoValidationRedirection; @@ -575,59 +406,35 @@ public function setAutoValidationRedirection(?RedirectionConfig $autoValidationR return $this; } - /** - * @return RedirectionConfig|null - */ public function getAutoValidationRedirection(): ?RedirectionConfig { return $this->autoValidationRedirection; } - /** - * @param string|null $redirectPolicy - * - * @return self - */ - public function setRedirectPolicy(?string $redirectPolicy): self + public function setRedirectPolicy(string $redirectPolicy): self { $this->redirectPolicy = $redirectPolicy; return $this; } - /** - * @return string|null - */ - public function getRedirectPolicy(): ?string + public function getRedirectPolicy(): string { return $this->redirectPolicy; } - /** - * @param int|null $redirectWait - * - * @return self - */ - public function setRedirectWait(?int $redirectWait): self + public function setRedirectWait(int $redirectWait): self { $this->redirectWait = $redirectWait; return $this; } - /** - * @return int|null - */ - public function getRedirectWait(): ?int + public function getRedirectWait(): int { return $this->redirectWait; } - /** - * @param bool|null $autoSendAgreements - * - * @return self - */ public function setAutoSendAgreements(?bool $autoSendAgreements): self { $this->autoSendAgreements = $autoSendAgreements; @@ -635,19 +442,11 @@ public function setAutoSendAgreements(?bool $autoSendAgreements): self return $this; } - /** - * @return bool|null - */ public function getAutoSendAgreements(): ?bool { return $this->autoSendAgreements; } - /** - * @param string|null $operator - * - * @return self - */ public function setOperator(?string $operator): self { $this->operator = $operator; @@ -655,19 +454,11 @@ public function setOperator(?string $operator): self return $this; } - /** - * @return string|null - */ public function getOperator(): ?string { return $this->operator; } - /** - * @param string|null $registrationCallbackURL - * - * @return self - */ public function setRegistrationCallbackURL(?string $registrationCallbackURL): self { $this->registrationCallbackURL = $registrationCallbackURL; @@ -675,19 +466,11 @@ public function setRegistrationCallbackURL(?string $registrationCallbackURL): se return $this; } - /** - * @return string|null - */ public function getRegistrationCallbackURL(): ?string { return $this->registrationCallbackURL; } - /** - * @param RedirectionConfig|null $successRedirection - * - * @return self - */ public function setSuccessRedirection(?RedirectionConfig $successRedirection): self { $this->successRedirection = $successRedirection; @@ -695,19 +478,11 @@ public function setSuccessRedirection(?RedirectionConfig $successRedirection): s return $this; } - /** - * @return RedirectionConfig|null - */ public function getSuccessRedirection(): ?RedirectionConfig { return $this->successRedirection; } - /** - * @param RedirectionConfig|null $cancelRedirection - * - * @return self - */ public function setCancelRedirection(?RedirectionConfig $cancelRedirection): self { $this->cancelRedirection = $cancelRedirection; @@ -715,19 +490,11 @@ public function setCancelRedirection(?RedirectionConfig $cancelRedirection): sel return $this; } - /** - * @return RedirectionConfig|null - */ - public function getCancelRedirection(): ? RedirectionConfig + public function getCancelRedirection(): ?RedirectionConfig { return $this->cancelRedirection; } - /** - * @param RedirectionConfig|null $failRedirection - * - * @return self - */ public function setFailRedirection(?RedirectionConfig $failRedirection): self { $this->failRedirection = $failRedirection; @@ -735,19 +502,11 @@ public function setFailRedirection(?RedirectionConfig $failRedirection): self return $this; } - /** - * @return RedirectionConfig|null - */ public function getFailRedirection(): ?RedirectionConfig { return $this->failRedirection; } - /** - * @param string|null $invitationMessage - * - * @return self - */ public function setInvitationMessage(?string $invitationMessage): self { $this->invitationMessage = $invitationMessage; @@ -755,9 +514,6 @@ public function setInvitationMessage(?string $invitationMessage): self return $this; } - /** - * @return string|null - */ public function getInvitationMessage(): ?string { return $this->invitationMessage; diff --git a/Model/TransactionResponse.php b/Model/TransactionResponse.php index b86fb15..7a9a530 100644 --- a/Model/TransactionResponse.php +++ b/Model/TransactionResponse.php @@ -4,33 +4,18 @@ class TransactionResponse { - const STATE_SUCCESS = 'SUCCESS'; - const STATE_ERROR = 'ERROR'; - - /** - * @var string - */ - protected $id; - - /** - * @var string - */ - protected $url; - - /** - * @var string - */ - protected $state; - - /** - * @var string - */ - protected $errorCode; - - /** - * @var string - */ - protected $errorMessage; + public const STATE_SUCCESS = 'SUCCESS'; + public const STATE_ERROR = 'ERROR'; + + protected ?string $id; + + protected ?string $url; + + protected ?string $state; + + protected ?string $errorCode; + + protected ?string $errorMessage; public function __construct() { @@ -41,11 +26,6 @@ public function __construct() $this->errorMessage = null; } - /** - * @param string|null $id - * - * @return self - */ public function setId(?string $id): self { $this->id = $id; @@ -53,19 +33,11 @@ public function setId(?string $id): self return $this; } - /** - * @return string|null - */ public function getId(): ?string { return $this->id; } - /** - * @param string|null $url - * - * @return self - */ public function setUrl(?string $url): self { $this->url = $url; @@ -73,19 +45,11 @@ public function setUrl(?string $url): self return $this; } - /** - * @return string|null - */ public function getUrl(): ?string { return $this->url; } - /** - * @param string|null - * - * @return self - */ public function setState(?string $state): self { $this->state = $state; @@ -93,19 +57,11 @@ public function setState(?string $state): self return $this; } - /** - * @return string|null - */ public function getState(): ?string { return $this->state; } - /** - * @param string|null - * - * @return self - */ public function setErrorCode(?string $errorCode): self { $this->errorCode = $errorCode; @@ -113,19 +69,11 @@ public function setErrorCode(?string $errorCode): self return $this; } - /** - * @return string|null - */ public function getErrorCode(): ?string { return $this->errorCode; } - /** - * @param string|null - * - * @return self - */ public function setErrorMessage(?string $errorMessage): self { $this->errorMessage = $errorMessage; @@ -133,9 +81,6 @@ public function setErrorMessage(?string $errorMessage): self return $this; } - /** - * @return string|null - */ public function getErrorMessage(): ?string { return $this->errorMessage; diff --git a/Model/ValidationRequest.php b/Model/ValidationRequest.php index 80072b7..0262000 100644 --- a/Model/ValidationRequest.php +++ b/Model/ValidationRequest.php @@ -13,36 +13,23 @@ class ValidationRequest { - /** - * @var IdDocument - */ - protected $idDocument; + protected IdDocument $idDocument; - /** - * @var PersonalInfo - */ - protected $personalInfo; + protected PersonalInfo $personalInfo; - /** - * @var bool - */ - protected $allowManual; + protected bool $allowManual; - /** - * @var null|string - */ - protected $callbackURL; + protected ?string $callbackURL; - public function __construct() + public function __construct(IdDocument $idDocument, PersonalInfo $personalInfo, bool $allowManual) { - $this->allowManual = false; + $this->idDocument = $idDocument; + $this->personalInfo = $personalInfo; + $this->allowManual = $allowManual; $this->callbackURL = null; } - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setRequired('idDocument')->setAllowedTypes('idDocument', ['array', IdDocument::class])->setNormalizer('idDocument', function (Options $options, $value) { @@ -65,10 +52,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -82,27 +65,19 @@ public static function createFromArray(array $options): self self::configureData($resolver); $resolvedOptions = $resolver->resolve($options); - return (new self()) - ->setIdDocument($resolvedOptions['idDocument']) - ->setPersonalInfo($resolvedOptions['personalInfo']) - ->setAllowManual($resolvedOptions['allowManual']) - ->setCallbackURL($resolvedOptions['callbackUrl']) + return (new self( + $resolvedOptions['idDocument'], + $resolvedOptions['personalInfo'], + $resolvedOptions['allowManual'], + ))->setCallbackURL($resolvedOptions['callbackUrl']) ; } - /** - * @return IdDocument - */ public function getIdDocument(): IdDocument { return $this->idDocument; } - /** - * @param IdDocument $idDocument - * - * @return self - */ public function setIdDocument(IdDocument $idDocument): self { $this->idDocument = $idDocument; @@ -110,19 +85,11 @@ public function setIdDocument(IdDocument $idDocument): self return $this; } - /** - * @return PersonalInfo - */ public function getPersonalInfo(): PersonalInfo { return $this->personalInfo; } - /** - * @param PersonalInfo $personalInfo - * - * @return self - */ public function setPersonalInfo(PersonalInfo $personalInfo): self { $this->personalInfo = $personalInfo; @@ -130,19 +97,11 @@ public function setPersonalInfo(PersonalInfo $personalInfo): self return $this; } - /** - * @return bool - */ public function isAllowManual(): bool { return $this->allowManual; } - /** - * @param bool $allowManual - * - * @return self - */ public function setAllowManual(bool $allowManual): self { $this->allowManual = $allowManual; @@ -150,19 +109,11 @@ public function setAllowManual(bool $allowManual): self return $this; } - /** - * @return string|null - */ public function getCallbackURL(): ?string { return $this->callbackURL; } - /** - * @param string|null $callbackURL - * - * @return self - */ public function setCallbackURL(?string $callbackURL): self { $this->callbackURL = $callbackURL; diff --git a/Model/ValidatorResult.php b/Model/ValidatorResult.php index 3da8230..0e79047 100644 --- a/Model/ValidatorResult.php +++ b/Model/ValidatorResult.php @@ -8,51 +8,34 @@ use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class ValidatorResult { - const STATUS_PENDING = 0; - const STATUS_VALID = 1; - const STATUS_INVALID = 2; + public const STATUS_PENDING = 0; + public const STATUS_VALID = 1; + public const STATUS_INVALID = 2; - /** - * @var string - */ - protected $id; + protected string $id; - /** - * @var int - */ - protected $status; + protected int $status; - /** - * @var null|int - */ - protected $reason; + protected ?int $reason; - /** - * @var null|string - */ - protected $reasonMessage; + protected ?string $reasonMessage; - /** - * @var null|array - */ - protected $result; + protected ?array $result; - public function __construct() + public function __construct(string $id, int $status) { + $this->id = $id; + $this->status = $status; $this->reason = null; $this->reasonMessage = null; $this->result = null; } - /** - * @param OptionsResolver $resolver - */ - public static function configureData(OptionsResolver $resolver) + public static function configureData(OptionsResolver $resolver): void { $resolver ->setRequired('id')->setAllowedTypes('id', ['string']) @@ -64,10 +47,6 @@ public static function configureData(OptionsResolver $resolver) } /** - * @param array $options - * - * @return self - * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the language specified validation rules * @throws MissingOptionsException If a required option is missing @@ -81,28 +60,21 @@ public static function createFromArray(array $options): self self::configureData($resolver); $resolvedOptions = $resolver->resolve($options); - return (new self()) - ->setId($resolvedOptions['id']) - ->setStatus($resolvedOptions['status']) + return (new self( + $resolvedOptions['id'], + $resolvedOptions['status'], + )) ->setReason($resolvedOptions['reason']) ->setReasonMessage($resolvedOptions['reasonMessage']) ->setResult($resolvedOptions['result']) ; } - /** - * @return string - */ public function getId(): string { return $this->id; } - /** - * @param string $id - * - * @return self - */ public function setId(string $id): self { $this->id = $id; @@ -110,19 +82,11 @@ public function setId(string $id): self return $this; } - /** - * @return int - */ public function getStatus(): int { return $this->status; } - /** - * @param int $status - * - * @return self - */ public function setStatus(int $status): self { $this->status = $status; @@ -130,19 +94,11 @@ public function setStatus(int $status): self return $this; } - /** - * @return int|null - */ public function getReason(): ?int { return $this->reason; } - /** - * @param int|null $reason - * - * @return self - */ public function setReason(?int $reason): self { $this->reason = $reason; @@ -150,19 +106,11 @@ public function setReason(?int $reason): self return $this; } - /** - * @return string|null - */ public function getReasonMessage(): ?string { return $this->reasonMessage; } - /** - * @param string|null $reasonMessage - * - * @return self - */ public function setReasonMessage(?string $reasonMessage): self { $this->reasonMessage = $reasonMessage; @@ -170,19 +118,11 @@ public function setReasonMessage(?string $reasonMessage): self return $this; } - /** - * @return array|null - */ public function getResult(): ?array { return $this->result; } - /** - * @param array|null $result - * - * @return self - */ public function setResult(?array $result): self { $this->result = $result; diff --git a/Model/XmlRpc/Base64.php b/Model/XmlRpc/Base64.php new file mode 100644 index 0000000..f5709be --- /dev/null +++ b/Model/XmlRpc/Base64.php @@ -0,0 +1,16 @@ +logger = $logger; $this->router = $router; $this->entrypoint = $entrypoint; parent::__construct($clientOptions); } - /** - * @return string; - */ - public function getUrl() + public function getUrl(): string { return $this->entrypoint['ra']; } - private function call(string $method, $args) + private function call(string $method, $args): mixed { $response = null; try { - $response = $this->xmlRpcClient->call($method, self::flatten($args)); + $response = $this->send($method, $args); $this->logger->info(sprintf('[Universign - %s] SUCCESS', $method)); - } catch (FaultException $fe) { - $this->logger->error(sprintf('[Universign - %s] ERROR (%s): %s', $method, $fe->getCode(), $fe->getMessage())); + } catch (Exception $e) { + $this->logger->error(sprintf( + '[Universign - %s] ERROR (%s): %s', + $method, + $e->getCode(), + $e->getMessage() + )); } return $response; @@ -77,17 +75,17 @@ public function matchAccount(MatchingFilter $matchingFilter): array return $results; } - public function getCertificateAgreement(string $email) + public function getCertificateAgreement(string $email): mixed { return $this->call('ra.getCertificateAgreement', $email); } - public function revokeCertificate(string $emailOrPhoneNumber) + public function revokeCertificate(string $emailOrPhoneNumber): mixed { return $this->call('ra.revokeCertificate', $emailOrPhoneNumber); } - public function revokeMyCertificate(string $emailOrPhoneNumber) + public function revokeMyCertificate(string $emailOrPhoneNumber): mixed { return $this->call('ra.revokeMyCertificate', $emailOrPhoneNumber); } @@ -103,7 +101,10 @@ public function validate(ValidationRequest $validationRequest): ?ValidatorResult ) ); - $this->logger->info(sprintf('[Universign - validate] define default callback URL : "%s"', $validationRequest->getCallbackURL())); + $this->logger->info(sprintf( + '[Universign - validate] define default callback URL : "%s"', + $validationRequest->getCallbackURL() + )); } $result = $this->call('validator.validate', [$validationRequest]); diff --git a/Requester/RegistrationAuthorityInterface.php b/Requester/RegistrationAuthorityInterface.php index 2bd66c0..0a8fb12 100644 --- a/Requester/RegistrationAuthorityInterface.php +++ b/Requester/RegistrationAuthorityInterface.php @@ -9,10 +9,10 @@ interface RegistrationAuthorityInterface { - const OPERATOR_STATUS_NOT_OPERATOR = 0; - const OPERATOR_STATUS_RA_OPERATOR = 1; - const OPERATOR_STATUS_INVITED_RA_OPERATOR = 2; - const OPERATOR_STATUS_NOT_EXISTENT = 5; + public const OPERATOR_STATUS_NOT_OPERATOR = 0; + public const OPERATOR_STATUS_RA_OPERATOR = 1; + public const OPERATOR_STATUS_INVITED_RA_OPERATOR = 2; + public const OPERATOR_STATUS_NOT_EXISTENT = 5; /** * @param string $email Email of User @@ -41,7 +41,7 @@ public function matchAccount(MatchingFilter $matchingFilter): array; * * @return byte[]|null Certificate */ - public function getCertificateAgreement(string $email); + public function getCertificateAgreement(string $email): mixed; /** * This service allows the admin of an organization to revoke a user’s certifi- @@ -49,14 +49,12 @@ public function getCertificateAgreement(string $email); * * @param string $emailOrPhoneNumber Email or Phone number of User */ - public function revokeCertificate(string $emailOrPhoneNumber); + public function revokeCertificate(string $emailOrPhoneNumber): mixed; /** * This service allows a user to revoke his own certificate. - * - * @param string $emailOrPhoneNumber */ - public function revokeMyCertificate(string $emailOrPhoneNumber); + public function revokeMyCertificate(string $emailOrPhoneNumber): mixed; /** * Sends a validation request in order to validate ID documents with the provided user info @@ -67,20 +65,12 @@ public function revokeMyCertificate(string $emailOrPhoneNumber); * * Optionnaly, a callback URL can be provided. This URL will be requested * when the validation session is completed (i.e. it ended with a final status). - * - * @param ValidationRequest $validationRequest - * - * @return ValidatorResult|null */ public function validate(ValidationRequest $validationRequest): ?ValidatorResult; /** * Retrieves the validation result of the validation session that matches the * given id. - * - * @param string $validationSessionId - * - * @return ValidatorResult|null */ public function getResult(string $validationSessionId): ?ValidatorResult; } diff --git a/Requester/Signer.php b/Requester/Signer.php index 7c76f21..bfb3e55 100644 --- a/Requester/Signer.php +++ b/Requester/Signer.php @@ -2,10 +2,6 @@ namespace Mpp\UniversignBundle\Requester; -use Laminas\XmlRpc\Client; -use Laminas\XmlRpc\Client\Exception\FaultException; -use Laminas\XmlRpc\Value\Base64; -use Laminas\XmlRpc\Value\DateTime; use Mpp\UniversignBundle\Model\InitiatorInfo; use Mpp\UniversignBundle\Model\RedirectionConfig; use Mpp\UniversignBundle\Model\SignerInfo; @@ -13,34 +9,30 @@ use Mpp\UniversignBundle\Model\TransactionInfo; use Mpp\UniversignBundle\Model\TransactionRequest; use Mpp\UniversignBundle\Model\TransactionResponse; +use Mpp\UniversignBundle\Model\XmlRpc\Base64; +use PhpXmlRpc\Encoder; +use PhpXmlRpc\Exception; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Routing\Router; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class Signer extends XmlRpcRequester implements SignerInterface { - /** - * @var LoggerInterface - */ - protected $logger; - - /** - * @var Router - */ - protected $router; - - /** - * @var array - */ - protected $entrypoint; - - /** - * @var array - */ - protected $options; - - public function __construct(LoggerInterface $logger, Router $router, array $entrypoint, array $options, array $clientOptions) - { + protected LoggerInterface $logger; + + protected Router $router; + + protected array $entrypoint; + + protected array $options; + + public function __construct( + LoggerInterface $logger, + Router $router, + array $entrypoint, + array $options, + array $clientOptions + ) { $this->logger = $logger; $this->router = $router; $this->entrypoint = $entrypoint; @@ -49,17 +41,11 @@ public function __construct(LoggerInterface $logger, Router $router, array $entr parent::__construct($clientOptions); } - /** - * @return string; - */ - public function getUrl() + public function getUrl(): string { return $this->entrypoint['sign']; } - /** - * {@inheritdoc} - */ public function initiateTransactionRequest(array $options = []): TransactionRequest { $defaultOptions = []; @@ -120,80 +106,76 @@ public function initiateTransactionRequest(array $options = []): TransactionRequ return $transaction; } - /** - * {@inheritdoc} - */ public function requestTransaction(TransactionRequest $transactionRequest): TransactionResponse { $transactionResponse = new TransactionResponse(); - $flattenedTransactionRequest = self::flatten($transactionRequest); + $flattenedTransactionRequest = $this->flatten($transactionRequest); $flattenedTransactionRequest['documents'] = array_values($flattenedTransactionRequest['documents']); try { - $response = $this->xmlRpcClient->call('requester.requestTransaction', [$flattenedTransactionRequest]); + $response = $this->send('requester.requestTransaction', $this->flatten([$flattenedTransactionRequest])); $this->logger->info('[Universign - requester.requestTransaction] SUCCESS'); $transactionResponse ->setId($response['id']) ->setUrl($response['url']) ->setState(TransactionResponse::STATE_SUCCESS) ; - } catch (FaultException $fe) { + } catch (Exception $e) { $transactionResponse ->setState(TransactionResponse::STATE_ERROR) - ->setErrorCode($fe->getCode()) - ->setErrorMessage($fe->getMessage()) + ->setErrorCode($e->getCode()) + ->setErrorMessage($e->getMessage()) ; - $this->logger->error(sprintf('[Universign - requester.requestTransaction] ERROR (%s): %s', $fe->getCode(), $fe->getMessage())); + $this->logger->error( + sprintf('[Universign - requester.requestTransaction] ERROR (%s): %s', $e->getCode(), $e->getMessage()) + ); } return $transactionResponse; } - /** - * {@inheritdoc} - */ public function getDocuments(string $documentId): array { $documents = []; try { - $documents = $this->xmlRpcClient->call('requester.getDocuments', $documentId); + $documents = $this->send('requester.getDocuments', $documentId); $this->logger->info('[Universign - requester.getDocuments] SUCCESS'); - } catch (FaultException $fe) { - $this->logger->error(sprintf('[Universign - requester.getDocuments] ERROR (%s): %s', $fe->getCode(), $fe->getMessage())); + } catch (Exception $e) { + $this->logger->error( + sprintf('[Universign - requester.getDocuments] ERROR (%s): %s', $e->getCode(), $e->getMessage()) + ); } return $documents; } - /** - * {@inheritdoc} - */ public function getDocumentsByCustomId(string $customId): array { $documents = []; try { - $documents = $this->xmlRpcClient->call('requester.getDocumentsByCustomId', $customId); + $documents = $this->send('requester.getDocumentsByCustomId', $customId); $this->logger->info('[Universign - requester.getDocumentsByCustomId] SUCCESS'); - } catch (FaultException $fe) { - $this->logger->error(sprintf('[Universign - requester.getDocumentsByCustomId] ERROR (%s): %s', $fe->getCode(), $fe->getMessage())); + } catch (Exception $e) { + $this->logger->error(sprintf( + '[Universign - requester.getDocumentsByCustomId] ERROR (%s): %s', + $e->getCode(), + $e->getMessage() + )); } return $documents; } - /** - * {@inheritdoc} - */ public function getTransactionInfo(string $transactionId): TransactionInfo { $transactionInfo = new TransactionInfo(); try { - $response = $this->xmlRpcClient->call('requester.getTransactionInfo', $transactionId); + $response = $this->send('requester.getTransactionInfo', $transactionId); $this->logger->info('[Universign - requester.getTransactionInfo] SUCCESS'); $transactionInfo ->setState(TransactionInfo::STATE_SUCCESS) @@ -211,28 +193,27 @@ public function getTransactionInfo(string $transactionId): TransactionInfo foreach ($response['signerInfos'] as $signerInfo) { $transactionInfo->addSignerInfo(SignerInfo::createFromArray($signerInfo)); } - } catch (FaultException $fe) { - $this->logger->error(sprintf('[Universign - requester.getTransactionInfo] ERROR (%s): %s', $fe->getCode(), $fe->getMessage())); + } catch (Exception $e) { + $this->logger->error( + sprintf('[Universign - requester.getTransactionInfo] ERROR (%s): %s', $e->getCode(), $e->getMessage()) + ); $transactionInfo ->setState(TransactionInfo::STATE_ERROR) - ->setErrorCode($fe->getCode()) - ->setErrorMessage($fe->getMessage()) + ->setErrorCode($e->getCode()) + ->setErrorMessage($e->getMessage()) ; } return $transactionInfo; } - /** - * {@inheritdoc} - */ public function getTransactionInfoByCustomId(string $customId): TransactionInfo { $transactionInfo = new TransactionInfo(); try { - $response = $this->xmlRpcClient->call('requester.getTransactionInfoByCustomId', $customId); + $response = $this->send('requester.getTransactionInfoByCustomId', $customId); $this->logger->info('[Universign - requester.getTransactionInfoByCustomId] SUCCESS'); $transactionInfo ->setState(TransactionInfo::STATE_SUCCESS) @@ -247,90 +228,90 @@ public function getTransactionInfoByCustomId(string $customId): TransactionInfo ->setRedirectPolicy($response['redirectPolicy'] ?? null) ->setRedirectWait($response['redirectWait'] ?? null) ; - } catch (FaultException $fe) { - $this->logger->error(sprintf('[Universign - requester.getTransactionInfoByCustomId] ERROR (%s): %s', $fe->getCode(), $fe->getMessage())); + } catch (Exception $e) { + $this->logger->error(sprintf( + '[Universign - requester.getTransactionInfoByCustomId] ERROR (%s): %s', + $e->getCode(), + $e->getMessage() + )); $transactionInfo ->setState(TransactionInfo::STATE_ERROR) - ->setErrorCode($fe->getCode()) - ->setErrorMessage($fe->getMessage()) + ->setErrorCode($e->getCode()) + ->setErrorMessage($e->getMessage()) ; } return $transactionInfo; } - /** - * {@inheritdoc} - */ public function relaunchTransaction(string $transactionId): TransactionInfo { $transactionInfo = new TransactionInfo(); try { - $response = $this->xmlRpcClient->call('requester.relaunchTransaction', $transactionId); + $response = $this->send('requester.relaunchTransaction', $transactionId); $this->logger->info('[Universign - requester.relaunchTransaction] SUCCESS'); $transactionInfo->setState(TransactionInfo::STATE_SUCCESS); - } catch (FaultException $fe) { - $this->logger->error(sprintf('[Universign - requester.relaunchTransaction] ERROR (%s): %s', $fe->getCode(), $fe->getMessage())); + } catch (Exception $e) { + $this->logger->error(sprintf( + '[Universign - requester.relaunchTransaction] ERROR (%s): %s', + $e->getCode(), + $e->getMessage() + )); $transactionInfo ->setState(TransactionInfo::STATE_ERROR) - ->setErrorCode($fe->getCode()) - ->setErrorMessage($fe->getMessage()) + ->setErrorCode($e->getCode()) + ->setErrorMessage($e->getMessage()) ; } return $transactionInfo; } - /** - * {@inheritdoc} - */ public function cancelTransaction(string $transactionId): TransactionInfo { $transactionInfo = new TransactionInfo(); try { - $response = $this->xmlRpcClient->call('requester.cancelTransaction', $transactionId); + $response = $this->send('requester.cancelTransaction', $transactionId); $this->logger->info('[Universign - requester.cancelTransaction] SUCCESS'); $transactionInfo->setState(TransactionInfo::STATE_SUCCESS); - } catch (FaultException $fe) { - $this->logger->error(sprintf('[Universign - requester.cancelTransaction] ERROR (%s): %s', $fe->getCode(), $fe->getMessage())); + } catch (Exception $e) { + $this->logger->error( + sprintf('[Universign - requester.cancelTransaction] ERROR (%s): %s', $e->getCode(), $e->getMessage()) + ); $transactionInfo ->setState(TransactionInfo::STATE_ERROR) - ->setErrorCode($fe->getCode()) - ->setErrorMessage($fe->getMessage()) + ->setErrorCode($e->getCode()) + ->setErrorMessage($e->getMessage()) ; } return $transactionInfo; } - /** - * {@inheritdoc} - */ public function sign(Base64 $document): ?string { $response = null; $data = [ - 'document' => new Base64($document), + 'document' => $document, ]; try { - $response = $this->xmlRpcClient->call('signer.sign', self::flatten($data)); + $response = $this->send('signer.sign', $this->flatten($data)); $this->logger->info('[Universign - signer.sign] SUCCESS'); - } catch (FaultException $fe) { - $this->logger->error(sprintf('[Universign - signer.sign] ERROR (%s): %s', $fe->getCode(), $fe->getMessage())); + } catch (Exception $e) { + $this->logger->error( + sprintf('[Universign - signer.sign] ERROR (%s): %s', $e->getCode(), $e->getMessage()) + ); } return $response; } - /** - * {@inheritdoc} - */ public function signWithOptions(Base64 $document, SignOptions $options): ?string { $response = null; @@ -340,10 +321,12 @@ public function signWithOptions(Base64 $document, SignOptions $options): ?string ]; try { - $response = $this->xmlRpcClient->call('signer.signWithOptions', self::flatten($data)); + $response = $this->send('signer.signWithOptions', $this->flatten($data)); $this->logger->info('[Universign - signer.signWithOptions] SUCCESS'); - } catch (FaultException $fe) { - $this->logger->error(sprintf('[Universign - signer.signWithOptions] ERROR (%s): %s', $fe->getCode(), $fe->getMessage())); + } catch (Exception $e) { + $this->logger->error( + sprintf('[Universign - signer.signWithOptions] ERROR (%s): %s', $e->getCode(), $e->getMessage()) + ); } return $response; diff --git a/Requester/SignerInterface.php b/Requester/SignerInterface.php index e3f36a0..5c0c5ce 100644 --- a/Requester/SignerInterface.php +++ b/Requester/SignerInterface.php @@ -2,83 +2,39 @@ namespace Mpp\UniversignBundle\Requester; -use Laminas\XmlRpc\Value\Base64; use Mpp\UniversignBundle\Model\Document; use Mpp\UniversignBundle\Model\SignOptions; use Mpp\UniversignBundle\Model\TransactionInfo; use Mpp\UniversignBundle\Model\TransactionRequest; use Mpp\UniversignBundle\Model\TransactionResponse; +use Mpp\UniversignBundle\Model\XmlRpc\Base64; interface SignerInterface { - /** - * @param array $options - * - * @return TransactionRequest - */ public function initiateTransactionRequest(array $options = []): TransactionRequest; - /** - * @param TransactionRequest $transactionRequest - * - * @return TransactionResponse - */ public function requestTransaction(TransactionRequest $transactionRequest): TransactionResponse; /** - * @param string $transactionId - * * @return array */ public function getDocuments(string $transactionId): array; /** - * @param string $customId - * * @return array */ public function getDocumentsByCustomId(string $customId): array; - /** - * @param string $transactionId - * - * @return TransactionInfo - */ public function getTransactionInfo(string $transactionId): TransactionInfo; - /** - * @param string $customId - * - * @return TransactionInfo - */ public function getTransactionInfoByCustomId(string $customId): TransactionInfo; - /** - * @param string $transactionId - * - * @return TransactionInfo - */ + public function relaunchTransaction(string $transactionId): TransactionInfo; - /** - * @param string $transactionId - * - * @return TransactionInfo - */ public function cancelTransaction(string $transactionId): TransactionInfo; - /** - * @param Base64 $document - * - * @return string|null - */ public function sign(Base64 $document): ?string; - /** - * @param Base64 $document - * @param SignOptions $options - * - * @return string|null - */ public function signWithOptions(Base64 $document, SignOptions $options): ?string; } diff --git a/Requester/XmlRpcRequester.php b/Requester/XmlRpcRequester.php index 77d1bde..86fb97e 100644 --- a/Requester/XmlRpcRequester.php +++ b/Requester/XmlRpcRequester.php @@ -2,66 +2,64 @@ namespace Mpp\UniversignBundle\Requester; -use Laminas\XmlRpc\Client; -use Laminas\XmlRpc\Value\Base64; -use Laminas\XmlRpc\Value\DateTime; +use PhpXmlRpc\Client; +use PhpXmlRpc\Encoder; +use PhpXmlRpc\Helper\XMLParser; +use PhpXmlRpc\Request; +use PhpXmlRpc\Value; abstract class XmlRpcRequester { - /** - * @var Client - */ - protected $xmlRpcClient; + protected Client $xmlRpcClient; + + protected Encoder $encoder; - public function __construct(?array $clientOptions = null) + public function __construct(array $clientOptions = []) { - $this->xmlRpcClient = new Client($this->getURL(), new \Laminas\Http\Client(null, $clientOptions)); + $this->encoder = new Encoder(); + $this->xmlRpcClient = new Client($this->getUrl()); + foreach ($clientOptions as $name => $value) { + $this->xmlRpcClient->setOption($name, $value); + } + $this->xmlRpcClient->setOption(Client::OPT_RETURN_TYPE, XMLParser::RETURN_PHP); } - /** - * @return string; - */ - abstract public function getUrl(); + abstract public function getUrl(): string; /** - * @param mixed $data - * @param bool $skipNullValue - * - * @return mixed + * @return Value|array */ - public static function flatten($data, bool $skipNullValue = true) + public function flatten(mixed $data, bool $skipNullValue = true): Value|array { $flattenedData = []; - if (is_object($data) && - !($data instanceof DateTime) && - !($data instanceof Base64) - ) { - return self::dismount($data, $skipNullValue); + if (is_object($data) && !$data instanceof Value && !$data instanceof \DateTimeInterface) { + return $this->dismount($data, $skipNullValue); } if (is_array($data)) { foreach ($data as $key => $value) { - $flattenedValue = self::flatten($value, $skipNullValue); + $flattenedValue = $this->flatten($value, $skipNullValue); if (true === $skipNullValue && null === $flattenedValue) { continue; } + if (!$flattenedValue instanceof Value) { + $flattenedValue = $this->encoder->encode($flattenedValue); + } $flattenedData[$key] = $flattenedValue; } return $flattenedData; } + if (!$data instanceof Value) { + $data = $this->encoder->encode($data); + } + return $data; } - /** - * @param mixed $object - * @param bool $skipNullValue - * - * @return array - */ - public static function dismount($object, bool $skipNullValue = true): array + public function dismount(mixed $object, bool $skipNullValue = true): array { $rc = new \ReflectionClass($object); $data = []; @@ -72,9 +70,28 @@ public static function dismount($object, bool $skipNullValue = true): array if (true === $skipNullValue && (null === $value || (is_array($value) && empty($value)))) { continue; } - $data[$property->getName()] = self::flatten($value, $skipNullValue); + $data[$property->getName()] = $this->flatten($value, $skipNullValue); } return $data; } + + protected function send(string $method, $params): mixed + { + $response = $this->xmlRpcClient->send($this::buildRequest($method, $this->flatten($params))); + + return $response->value(); + } + + protected static function buildRequest(string $method, $params): Request + { + if (!is_array($params)) { + $params = [$params]; + } + + return new Request( + $method, + $params + ); + } } diff --git a/Resources/config/services.yaml b/Resources/config/services.yaml index eb765b9..e9395d7 100644 --- a/Resources/config/services.yaml +++ b/Resources/config/services.yaml @@ -8,18 +8,18 @@ services: Mpp\UniversignBundle\Requester\Signer: arguments: - - '@logger' - - '@router' - - '%mpp_universign.entrypoint%' - - '%mpp_universign.options%' - - '%mpp_universign.client_options%' + $logger: '@logger' + $router: '@router' + $entrypoint: '%mpp_universign.entrypoint%' + $options: '%mpp_universign.options%' + $clientOptions: '%mpp_universign.client_options%' Mpp\UniversignBundle\Requester\RegistrationAuthority: arguments: - - '@logger' - - '@router' - - '%mpp_universign.entrypoint%' - - '%mpp_universign.client_options%' + $logger: '@logger' + $router: '@router' + $entrypoint: '%mpp_universign.entrypoint%' + $clientOptions: '%mpp_universign.client_options%' Mpp\UniversignBundle\Requester\SignerInterface: '@Mpp\UniversignBundle\Requester\Signer' Mpp\UniversignBundle\Requester\RegistrationAuthorityInterface: '@Mpp\UniversignBundle\Requester\RegistrationAuthority' \ No newline at end of file diff --git a/composer.json b/composer.json index 3071442..dfe4da8 100644 --- a/composer.json +++ b/composer.json @@ -1,40 +1,41 @@ { - "name": "mpp/universign-bundle", - "type": "symfony-bundle", - "description": "Symfony Universign Bundle", - "keywords": ["json", "yaml", "api", "xmlrpc"], - "license": "MIT", - "authors": [ - { - "name": "Gabriel BONDAZ", - "email": "gabriel.bondaz@idci-consulting.fr", - "homepage": "https://www.idci-consulting.fr" - }, - { - "name": "Louis-Arnaud CATOIRE", - "email": "la.catoire@itefficience.com", - "homepage": "https://www.itefficience.com" - } - ], - "require": { - "php": ">=7.3", - "laminas/laminas-xmlrpc": "^2.10.1", - "symfony/dependency-injection": "^4.0 | ^5.0 | ^6.0", - "symfony/event-dispatcher": "*", - "symfony/framework-bundle": "^4.0 | ^5.0 | ^6.0", - "symfony/monolog-bundle": "*", - "ext-json": "*" + "name": "mpp/universign-bundle", + "type": "symfony-bundle", + "description": "Symfony Universign Bundle", + "keywords": ["json", "yaml", "api", "xmlrpc"], + "license": "MIT", + "authors": [ + { + "name": "Gabriel BONDAZ", + "email": "gabriel.bondaz@idci-consulting.fr", + "homepage": "https://www.idci-consulting.fr" }, - "autoload":{ - "psr-4":{ - "Mpp\\UniversignBundle\\": "" - }, - "exclude-from-classmap": [ - "Resources/", - "Tests/" - ] - }, - "require-dev": { - "phpunit/phpunit": "^9.5" + { + "name": "Louis-Arnaud CATOIRE", + "email": "la.catoire@itefficience.com", + "homepage": "https://www.itefficience.com" } + ], + "require": { + "php": ">=7.4", + "symfony/dependency-injection": "^4.0 | ^5.0 | ^6.0", + "symfony/event-dispatcher": "*", + "symfony/framework-bundle": "^4.0 | ^5.0 | ^6.0", + "symfony/monolog-bundle": "*", + "ext-json": "*", + "phpxmlrpc/phpxmlrpc": "^4.9", + "symfony/options-resolver": "^6.3" + }, + "autoload":{ + "psr-4":{ + "Mpp\\UniversignBundle\\": "" + }, + "exclude-from-classmap": [ + "Resources/", + "Tests/" + ] + }, + "require-dev": { + "phpunit/phpunit": "^9.5" } +}