diff --git a/src/Class/Controller/QuantityValue/ConvertAllController.php b/src/Class/Controller/QuantityValue/ConvertAllController.php index c9b07087..6ecf4d74 100644 --- a/src/Class/Controller/QuantityValue/ConvertAllController.php +++ b/src/Class/Controller/QuantityValue/ConvertAllController.php @@ -21,14 +21,12 @@ use Pimcore\Bundle\StudioBackendBundle\Class\Attribute\Request\ConvertRequestBody; use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ConvertAllParameters; use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ConvertedQuantityValues; -use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ConvertParameters; use Pimcore\Bundle\StudioBackendBundle\Class\Service\QuantityValueServiceInterface; use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\AccessDeniedException; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\DatabaseException; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\UserNotFoundException; -use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\Content\DataJson; use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses; use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse; use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags; @@ -79,7 +77,7 @@ public function __construct( #[ConvertRequestBody(ConvertAllParameters::class)] #[DefaultResponses([ HttpResponseCodes::UNAUTHORIZED, - HttpResponseCodes::NOT_FOUND + HttpResponseCodes::NOT_FOUND, ])] public function get(#[MapRequestPayload] ConvertAllParameters $parameters): JsonResponse { diff --git a/src/Class/Controller/QuantityValue/ConvertController.php b/src/Class/Controller/QuantityValue/ConvertController.php index 253cac32..1b8aa4a7 100644 --- a/src/Class/Controller/QuantityValue/ConvertController.php +++ b/src/Class/Controller/QuantityValue/ConvertController.php @@ -74,7 +74,7 @@ public function __construct( #[ConvertRequestBody] #[DefaultResponses([ HttpResponseCodes::UNAUTHORIZED, - HttpResponseCodes::NOT_FOUND + HttpResponseCodes::NOT_FOUND, ])] public function get(#[MapRequestPayload] ConvertParameters $parameters): JsonResponse { diff --git a/src/Class/Controller/QuantityValue/UnitListController.php b/src/Class/Controller/QuantityValue/UnitListController.php index afad3436..b6e26905 100644 --- a/src/Class/Controller/QuantityValue/UnitListController.php +++ b/src/Class/Controller/QuantityValue/UnitListController.php @@ -20,8 +20,6 @@ use Pimcore\Bundle\StudioBackendBundle\Class\Attribute\Response\QuantityValueUnitsJson; use Pimcore\Bundle\StudioBackendBundle\Class\Service\QuantityValueServiceInterface; use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController; -use Pimcore\Bundle\StudioBackendBundle\Exception\Api\AccessDeniedException; -use Pimcore\Bundle\StudioBackendBundle\Exception\Api\UserNotFoundException; use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses; use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse; use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags; @@ -66,7 +64,7 @@ public function __construct( content: new QuantityValueUnitsJson() )] #[DefaultResponses([ - HttpResponseCodes::UNAUTHORIZED + HttpResponseCodes::UNAUTHORIZED, ])] public function listUnits(): JsonResponse { diff --git a/src/Class/Repository/QuantityValueRepository.php b/src/Class/Repository/QuantityValueRepository.php index 541b86df..8ec69aef 100644 --- a/src/Class/Repository/QuantityValueRepository.php +++ b/src/Class/Repository/QuantityValueRepository.php @@ -16,7 +16,6 @@ namespace Pimcore\Bundle\StudioBackendBundle\Class\Repository; - use Pimcore\Model\DataObject\QuantityValue\Unit; use Pimcore\Model\DataObject\QuantityValue\Unit\Listing; diff --git a/src/Class/Schema/ConvertedQuantityValue.php b/src/Class/Schema/ConvertedQuantityValue.php index 62301f62..900d8fea 100644 --- a/src/Class/Schema/ConvertedQuantityValue.php +++ b/src/Class/Schema/ConvertedQuantityValue.php @@ -24,7 +24,7 @@ required: [ 'originalValue', 'fromUnitId', - 'convertedValues' + 'convertedValues', ], type: 'object' )] diff --git a/src/Class/Schema/ConvertedQuantityValues.php b/src/Class/Schema/ConvertedQuantityValues.php index ec42494e..7b70c494 100644 --- a/src/Class/Schema/ConvertedQuantityValues.php +++ b/src/Class/Schema/ConvertedQuantityValues.php @@ -27,7 +27,7 @@ required: [ 'originalValue', 'fromUnitId', - 'convertedValues' + 'convertedValues', ], type: 'object' )] diff --git a/src/Class/Schema/QuantityValueUnit.php b/src/Class/Schema/QuantityValueUnit.php index 075cc4d8..288ebc13 100644 --- a/src/Class/Schema/QuantityValueUnit.php +++ b/src/Class/Schema/QuantityValueUnit.php @@ -61,7 +61,7 @@ public function __construct( private readonly ?string $converter, ) { } - + public function getId(): ?string { return $this->id; diff --git a/src/Class/Service/QuantityValueService.php b/src/Class/Service/QuantityValueService.php index 15537816..3c602838 100644 --- a/src/Class/Service/QuantityValueService.php +++ b/src/Class/Service/QuantityValueService.php @@ -32,6 +32,7 @@ use Pimcore\Model\DataObject\QuantityValue\Unit; use Pimcore\Model\DataObject\QuantityValue\UnitConversionService; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use function sprintf; /** * @internal @@ -80,7 +81,7 @@ public function listUnits(): array /** * @throws DatabaseException|NotFoundException - */ + */ public function convertUnit(ConvertParameters $parameters): float|int { return $this->getConvertedValue( @@ -140,7 +141,7 @@ private function getUnit(string $unitId): Unit /** * @throws DatabaseException */ - private function getConvertedValue(Unit $fromUnit, Unit $toUnit, float|int $value ): float|int + private function getConvertedValue(Unit $fromUnit, Unit $toUnit, float|int $value): float|int { try { $convertedValue = $this->unitConversionService->convert( @@ -155,5 +156,4 @@ private function getConvertedValue(Unit $fromUnit, Unit $toUnit, float|int $valu return $convertedValue->getValue(); } - }