Skip to content

Commit

Permalink
Apply php-cs-fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukmzig authored and github-actions[bot] committed May 6, 2024
1 parent e82de7b commit 6d36819
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Asset/Controller/CustomSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __construct(
'customSettings',
ref: CustomSettings::class,
type: 'object'
)
),
]
)
)]
Expand Down
9 changes: 5 additions & 4 deletions src/Asset/Hydrator/CustomSettingsHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
final class CustomSettingsHydrator implements CustomSettingsHydratorInterface
{
private const METADATA_KEY = 'embeddedMetaData';

private const METADATA_EXTRACTED_KEY = 'embeddedMetaDataExtracted';

private const FIXED_CUSTOM_SETTINGS_KEYS = [
self::METADATA_KEY,
self::METADATA_EXTRACTED_KEY
self::METADATA_EXTRACTED_KEY,
];

public function hydrate(array $customSettings): CustomSettings
Expand All @@ -48,8 +50,7 @@ public function hydrate(array $customSettings): CustomSettings

private function getFixedCustomSettings(
array $customSettings
): FixedCustomSettings
{
): FixedCustomSettings {
$embeddedMetadata = $customSettings[self::METADATA_KEY] ?? [];
$extracted = $customSettings[self::METADATA_EXTRACTED_KEY] ?? false;

Expand All @@ -69,4 +70,4 @@ private function getDynamicCustomSettings(array $customSettings): array

return $customSettings;
}
}
}
4 changes: 2 additions & 2 deletions src/Asset/Schema/CustomSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(
example: '{ imageWidth: 1280, imageHeight: 720 }')
]
private array $dynamicCustomSettings = [],
){
) {

}

Expand All @@ -57,4 +57,4 @@ public function getDynamicCustomSettings(): array
{
return $this->dynamicCustomSettings;
}
}
}
6 changes: 2 additions & 4 deletions src/Asset/Schema/CustomSettings/FixedCustomSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

namespace Pimcore\Bundle\StudioBackendBundle\Asset\Schema\CustomSettings;


use OpenApi\Attributes\Items;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Schema;
Expand Down Expand Up @@ -44,8 +43,7 @@ public function __construct(
example: true
)]
private bool $embeddedMetaDataExtracted = false,
)
{
) {
}

public function getEmbeddedMetaData(): array
Expand All @@ -57,4 +55,4 @@ public function isEmbeddedMetaDataExtracted(): bool
{
return $this->embeddedMetaDataExtracted;
}
}
}
9 changes: 5 additions & 4 deletions tests/Unit/Asset/Hydrator/CustomSettingsHydratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function _before(): void
{
$this->hydrator = new CustomSettingsHydrator();
}

public function testHydrateEmpty(): void
{
$fixedCustomSettings = new FixedCustomSettings();
Expand All @@ -48,25 +49,25 @@ public function testHydrate(): void
$assetCustomSettings = [
'embeddedMetaData' => [
'FileSize' => '6.9 MB',
'FileType' => 'PNG'
'FileType' => 'PNG',
],
'embeddedMetaDataExtracted' => true,
'imageDimensionsCalculated' => true,
'imageWidth' => 932,
'imageHeight' => 327
'imageHeight' => 327,
];

$hydratedCustomSettings = $this->hydrator->hydrate($assetCustomSettings);

$this->assertEquals([
'FileSize' => '6.9 MB',
'FileType' => 'PNG'
'FileType' => 'PNG',
], $hydratedCustomSettings->getFixedCustomSettings()->getEmbeddedMetaData());
$this->assertTrue($hydratedCustomSettings->getFixedCustomSettings()->isEmbeddedMetaDataExtracted());
$this->assertEquals([
'imageDimensionsCalculated' => true,
'imageWidth' => 932,
'imageHeight' => 327
'imageHeight' => 327,
], $hydratedCustomSettings->getDynamicCustomSettings());
}
}

0 comments on commit 6d36819

Please sign in to comment.