src/Mapper/Asset.php
public function map($resource, array $data): ResourceClass
    {
        /** @var SystemProperties $sys */
        $sys = $this->createSystemProperties(SystemProperties::class, $data);
        $locale = $sys->getLocale();

        /** @var ResourceClass $asset */
        $asset = $this->hydrator->hydrate($resource ?: ResourceClass::class, [
            'sys' => $sys,
            'title' => isset($data['fields']['title'])
                ? $this->normalizeFieldData($data['fields']['title'], $locale)
                : null,
            'description' => isset($data['fields']['description'])
                ? $this->normalizeFieldData($data['fields']['description'], $locale)
                : null,
            'file' => isset($data['fields']['file'])
                ? \array_map([$this, 'buildFile'], $this->normalizeFieldData($data['fields']['file'], $locale))
                : null,
        ]);

        $asset->initLocales($asset->getSystemProperties()->getEnvironment()->getLocales());

        return $asset;
    }
public function map($resource, array $data): ResourceClass
    {
        /** @var SystemProperties $sys */
        $sys = $this->createSystemProperties(SystemProperties::class, $data);
        $locale = $sys->getLocale();

        /** @var ResourceClass $asset */
        $asset = $this->hydrator->hydrate($resource ?: ResourceClass::class, [
            'sys' => $sys,
            'title' => isset($data['fields']['title'])
                ? $this->normalizeFieldData($data['fields']['title'], $locale)
                : null,
            'description' => isset($data['fields']['description'])
                ? $this->normalizeFieldData($data['fields']['description'], $locale)
                : null,
            'file' => isset($data['fields']['file'])
                ? \array_map([$this, 'buildFile'], $this->normalizeFieldData($data['fields']['file'], $locale))
                : null,
        ]);

        $asset->initLocales($asset->getSystemProperties()->getEnvironment()->getLocales());

        return $asset;
    }
public function map ( $ resource , array $ data ) : ResourceClass { /** @var SystemProperties $sys */ $ sys = $ this -> createSystemProperties ( SystemProperties :: class , $ data ) ; $ locale = $ sys -> getLocale ( ) ; /** @var ResourceClass $asset */ $ asset = $ this -> hydrator -> hydrate ( $ resource ? : ResourceClass :: class , [ 'sys' => $ sys , 'title' => isset ( $ data [ 'fields' ] [ 'title' ] ) ? $ this -> normalizeFieldData ( $ data [ 'fields' ] [ 'title' ] , $ locale ) : null , 'description' => isset ( $ data [ 'fields' ] [ 'description' ] ) ? $ this -> normalizeFieldData ( $ data [ 'fields' ] [ 'description' ] , $ locale ) : null , 'file' => isset ( $ data [ 'fields' ] [ 'file' ] ) ? \ array_map ( [ $ this , 'buildFile' ] , $ this -> normalizeFieldData ( $ data [ 'fields' ] [ 'file' ] , $ locale ) ) : null , ] ) ; $ asset -> initLocales ( $ asset -> getSystemProperties ( ) -> getEnvironment ( ) -> getLocales ( ) ) ; return $ asset ; }
{@inheritdoc}
{