Skip to content

Commit f052224

Browse files
mcop1github-actions[bot]
authored andcommitted
Apply php-cs-fixer changes
1 parent 7b9b5aa commit f052224

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/DataObject/Data/Adapter/HotspotImageAdapter.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,23 @@
3232
use Pimcore\Model\Asset\Image;
3333
use Pimcore\Model\DataObject\AbstractObject;
3434
use Pimcore\Model\DataObject\ClassDefinition\Data;
35-
use Pimcore\Model\DataObject\ClassDefinition\Data\Block;
3635
use Pimcore\Model\DataObject\ClassDefinition\Data\Hotspotimage as HotspotImageData;
3736
use Pimcore\Model\DataObject\Concrete;
3837
use Pimcore\Model\DataObject\Data\Hotspotimage;
3938
use Pimcore\Model\Document;
4039
use Pimcore\Model\Element\Data\MarkerHotspotItem;
4140
use Pimcore\Model\UserInterface;
4241
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
42+
use function get_class;
4343
use function in_array;
4444
use function is_array;
4545

4646
/**
4747
* @internal
4848
*/
4949
#[AutoconfigureTag(DataAdapterLoaderInterface::ADAPTER_TAG)]
50-
final readonly class HotspotImageAdapter implements SetterDataInterface,
50+
final readonly class HotspotImageAdapter implements
51+
SetterDataInterface,
5152
SearchPreviewDataInterface,
5253
DataNormalizerInterface
5354
{
@@ -112,25 +113,25 @@ public function normalizeImageData(MarkerHotspotItem $hotspotItem): array
112113

113114
public function normalize(mixed $value, Data $fieldDefinition): mixed
114115
{
115-
if(!($fieldDefinition instanceof HotspotImageData)) {
116+
if (!($fieldDefinition instanceof HotspotImageData)) {
116117
throw new InvalidDataTypeException(HotspotImageData::class, get_class($fieldDefinition));
117118
}
118119

119120
$value = $fieldDefinition->normalize($value);
120-
if(!is_array($value)) {
121+
if (!is_array($value)) {
121122
return null;
122123
}
123124

124125
$id = $value['image']['id'] ?? null;
125126
$type = $value['image']['type'] ?? null;
126127

127-
if($id === null || $type === null) {
128+
if ($id === null || $type === null) {
128129
return $value;
129130
}
130131

131132
$value['image'] = [
132133
... $value['image'],
133-
...$this->normalizeElementData($id, $type)
134+
...$this->normalizeElementData($id, $type),
134135
];
135136
$value['hotspots'] = $this->normalizeHotSpotData($value['hotspots']);
136137

@@ -140,7 +141,7 @@ public function normalize(mixed $value, Data $fieldDefinition): mixed
140141
private function normalizeElementData(int $id, string $type): array
141142
{
142143
$element = $this->getElementData($id, $type);
143-
if($element instanceof AbstractObject || $element instanceof Document) {
144+
if ($element instanceof AbstractObject || $element instanceof Document) {
144145
$elementData['published'] = $element->isPublished();
145146
}
146147
$elementData['subtype'] = $element->getType();
@@ -156,13 +157,13 @@ private function normalizeHotSpotData(array $hotSpotData): array
156157
if (!is_array($data)) {
157158
continue;
158159
}
159-
foreach($data as $item) {
160-
if($item instanceof MarkerHotspotItem &&
160+
foreach ($data as $item) {
161+
if ($item instanceof MarkerHotspotItem &&
161162
$this->isValidItem($item)
162163
) {
163164
$hotSpot['data'] = [
164165
... $this->normalizeImageData($item),
165-
... $this->normalizeElementData($item->getValue(), $item->getType())
166+
... $this->normalizeElementData($item->getValue(), $item->getType()),
166167
];
167168
}
168169
}
@@ -177,6 +178,7 @@ private function getElementData(int $id, string $type): Asset|Document|AbstractO
177178
if ($element === null) {
178179
throw new NotFoundException($type, $id);
179180
}
181+
180182
return $element;
181183
}
182184

0 commit comments

Comments
 (0)