Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /** * Copyright Magento, Inc. All rights reserved. * See COPYING.txt for license ..

Decoded Output download

<?php
/**
 * Copyright  Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Catalog\Model\Product\Attribute\Backend\Media;

/**
 * Class aggregate all Media Gallery Entry Converters
 *
 * @api
 * @since 100.0.2
 */
class EntryConverterPool
{
    /**
     * @var EntryConverterInterface[]
     */
    private $mediaGalleryEntryConvertersCollection;

    /**
     * @param EntryConverterInterface[] $mediaGalleryEntryConvertersCollection
     */
    public function __construct(array $mediaGalleryEntryConvertersCollection)
    {
        foreach ($mediaGalleryEntryConvertersCollection as $converter) {
            if (!$converter instanceof EntryConverterInterface) {
                throw new \InvalidArgumentException(
                    __('Media Gallery converter should be an instance of EntryConverterInterface.')
                );
            }
        }
        $this->mediaGalleryEntryConvertersCollection = $mediaGalleryEntryConvertersCollection;
    }

    /**
     * Get specific converter by given media entry type
     *
     * @param string $mediaType
     * @return EntryConverterInterface
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function getConverterByMediaType($mediaType)
    {
        foreach ($this->mediaGalleryEntryConvertersCollection as $converter) {
            if ($converter->getMediaEntryType() == $mediaType) {
                return $converter;
            }
        }
        throw new \Magento\Framework\Exception\LocalizedException(
            __('There is no MediaGalleryEntryConverter for given type')
        );
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
/**
 * Copyright  Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Catalog\Model\Product\Attribute\Backend\Media;

/**
 * Class aggregate all Media Gallery Entry Converters
 *
 * @api
 * @since 100.0.2
 */
class EntryConverterPool
{
    /**
     * @var EntryConverterInterface[]
     */
    private $mediaGalleryEntryConvertersCollection;

    /**
     * @param EntryConverterInterface[] $mediaGalleryEntryConvertersCollection
     */
    public function __construct(array $mediaGalleryEntryConvertersCollection)
    {
        foreach ($mediaGalleryEntryConvertersCollection as $converter) {
            if (!$converter instanceof EntryConverterInterface) {
                throw new \InvalidArgumentException(
                    __('Media Gallery converter should be an instance of EntryConverterInterface.')
                );
            }
        }
        $this->mediaGalleryEntryConvertersCollection = $mediaGalleryEntryConvertersCollection;
    }

    /**
     * Get specific converter by given media entry type
     *
     * @param string $mediaType
     * @return EntryConverterInterface
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function getConverterByMediaType($mediaType)
    {
        foreach ($this->mediaGalleryEntryConvertersCollection as $converter) {
            if ($converter->getMediaEntryType() == $mediaType) {
                return $converter;
            }
        }
        throw new \Magento\Framework\Exception\LocalizedException(
            __('There is no MediaGalleryEntryConverter for given type')
        );
    }
}

Function Calls

None

Variables

None

Stats

MD5 9b5ede7562cb9d367ba8369ac5ac4a09
Eval Count 0
Decode Time 89 ms