-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes by create-pull-request action (#29)
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action Co-authored-by: qdequippe <3193300+qdequippe@users.noreply.github.com>
- Loading branch information
1 parent
f121171
commit ad72981
Showing
8 changed files
with
272 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Qdequippe\Yousign\Api\Exception; | ||
|
||
class InternalServerErrorException extends \RuntimeException implements ServerException | ||
{ | ||
public function __construct(string $message) | ||
{ | ||
parent::__construct($message, 500); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...tchSignatureRequestsSignatureRequestIdApproversApproverIdInternalServerErrorException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Qdequippe\Yousign\Api\Exception; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
use Qdequippe\Yousign\Api\Model\InternalServerError; | ||
|
||
class PatchSignatureRequestsSignatureRequestIdApproversApproverIdInternalServerErrorException extends InternalServerErrorException | ||
{ | ||
public function __construct(private readonly InternalServerError $internalServerError, private readonly ResponseInterface $response) | ||
{ | ||
parent::__construct('Internal Server Error'); | ||
} | ||
|
||
public function getInternalServerError(): InternalServerError | ||
{ | ||
return $this->internalServerError; | ||
} | ||
|
||
public function getResponse(): ResponseInterface | ||
{ | ||
return $this->response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Qdequippe\Yousign\Api\Model; | ||
|
||
class InternalServerError extends \ArrayObject | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $initialized = []; | ||
|
||
public function isInitialized($property): bool | ||
{ | ||
return \array_key_exists($property, $this->initialized); | ||
} | ||
/** | ||
* @var string|null | ||
*/ | ||
protected $type; | ||
/** | ||
* @var string|null | ||
*/ | ||
protected $detail; | ||
|
||
public function getType(): ?string | ||
{ | ||
return $this->type; | ||
} | ||
|
||
public function setType(?string $type): self | ||
{ | ||
$this->initialized['type'] = true; | ||
$this->type = $type; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDetail(): ?string | ||
{ | ||
return $this->detail; | ||
} | ||
|
||
public function setDetail(?string $detail): self | ||
{ | ||
$this->initialized['detail'] = true; | ||
$this->detail = $detail; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<?php | ||
|
||
namespace Qdequippe\Yousign\Api\Normalizer; | ||
|
||
use Jane\Component\JsonSchemaRuntime\Reference; | ||
use Qdequippe\Yousign\Api\Model\InternalServerError; | ||
use Qdequippe\Yousign\Api\Runtime\Normalizer\CheckArray; | ||
use Qdequippe\Yousign\Api\Runtime\Normalizer\ValidatorTrait; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; | ||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; | ||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; | ||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; | ||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; | ||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface; | ||
|
||
if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { | ||
class InternalServerErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface | ||
{ | ||
use CheckArray; | ||
use DenormalizerAwareTrait; | ||
use NormalizerAwareTrait; | ||
use ValidatorTrait; | ||
|
||
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool | ||
{ | ||
return InternalServerError::class === $type; | ||
} | ||
|
||
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool | ||
{ | ||
return \is_object($data) && InternalServerError::class === $data::class; | ||
} | ||
|
||
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed | ||
{ | ||
if (isset($data['$ref'])) { | ||
return new Reference($data['$ref'], $context['document-origin']); | ||
} | ||
if (isset($data['$recursiveRef'])) { | ||
return new Reference($data['$recursiveRef'], $context['document-origin']); | ||
} | ||
$object = new InternalServerError(); | ||
if (null === $data || false === \is_array($data)) { | ||
return $object; | ||
} | ||
if (\array_key_exists('type', $data) && null !== $data['type']) { | ||
$object->setType($data['type']); | ||
unset($data['type']); | ||
} elseif (\array_key_exists('type', $data) && null === $data['type']) { | ||
$object->setType(null); | ||
} | ||
if (\array_key_exists('detail', $data) && null !== $data['detail']) { | ||
$object->setDetail($data['detail']); | ||
unset($data['detail']); | ||
} elseif (\array_key_exists('detail', $data) && null === $data['detail']) { | ||
$object->setDetail(null); | ||
} | ||
foreach ($data as $key => $value) { | ||
if (preg_match('/.*/', (string) $key)) { | ||
$object[$key] = $value; | ||
} | ||
} | ||
|
||
return $object; | ||
} | ||
|
||
public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null | ||
{ | ||
$data = []; | ||
$data['type'] = $object->getType(); | ||
$data['detail'] = $object->getDetail(); | ||
foreach ($object as $key => $value) { | ||
if (preg_match('/.*/', (string) $key)) { | ||
$data[$key] = $value; | ||
} | ||
} | ||
|
||
return $data; | ||
} | ||
|
||
public function getSupportedTypes(?string $format = null): array | ||
{ | ||
return [InternalServerError::class => false]; | ||
} | ||
} | ||
} else { | ||
class InternalServerErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface | ||
{ | ||
use CheckArray; | ||
use DenormalizerAwareTrait; | ||
use NormalizerAwareTrait; | ||
use ValidatorTrait; | ||
|
||
public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool | ||
{ | ||
return InternalServerError::class === $type; | ||
} | ||
|
||
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool | ||
{ | ||
return \is_object($data) && InternalServerError::class === $data::class; | ||
} | ||
|
||
/** | ||
* @param mixed|null $format | ||
*/ | ||
public function denormalize($data, $type, $format = null, array $context = []) | ||
{ | ||
if (isset($data['$ref'])) { | ||
return new Reference($data['$ref'], $context['document-origin']); | ||
} | ||
if (isset($data['$recursiveRef'])) { | ||
return new Reference($data['$recursiveRef'], $context['document-origin']); | ||
} | ||
$object = new InternalServerError(); | ||
if (null === $data || false === \is_array($data)) { | ||
return $object; | ||
} | ||
if (\array_key_exists('type', $data) && null !== $data['type']) { | ||
$object->setType($data['type']); | ||
unset($data['type']); | ||
} elseif (\array_key_exists('type', $data) && null === $data['type']) { | ||
$object->setType(null); | ||
} | ||
if (\array_key_exists('detail', $data) && null !== $data['detail']) { | ||
$object->setDetail($data['detail']); | ||
unset($data['detail']); | ||
} elseif (\array_key_exists('detail', $data) && null === $data['detail']) { | ||
$object->setDetail(null); | ||
} | ||
foreach ($data as $key => $value) { | ||
if (preg_match('/.*/', (string) $key)) { | ||
$object[$key] = $value; | ||
} | ||
} | ||
|
||
return $object; | ||
} | ||
|
||
/** | ||
* @param mixed|null $format | ||
* | ||
* @return array|string|int|float|bool|\ArrayObject|null | ||
*/ | ||
public function normalize($object, $format = null, array $context = []) | ||
{ | ||
$data = []; | ||
$data['type'] = $object->getType(); | ||
$data['detail'] = $object->getDetail(); | ||
foreach ($object as $key => $value) { | ||
if (preg_match('/.*/', (string) $key)) { | ||
$data[$key] = $value; | ||
} | ||
} | ||
|
||
return $data; | ||
} | ||
|
||
public function getSupportedTypes(?string $format = null): array | ||
{ | ||
return [InternalServerError::class => false]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters