Вход Регистрация
Файл: vendor/intervention/image/src/Decoders/ColorObjectDecoder.php
Строк: 51
<?php

declare(strict_types=1);

namespace 
InterventionImageDecoders;

use 
InterventionImageDriversAbstractDecoder;
use 
InterventionImageExceptionsInvalidArgumentException;
use 
InterventionImageInterfacesColorInterface;

class 
ColorObjectDecoder extends AbstractDecoder
{
    
/**
     * {@inheritdoc}
     *
     * @see DecoderInterface::supports()
     */
    
public function supports(mixed $input): bool
    
{
        return 
$input instanceof ColorInterface;
    }

    
/**
     * {@inheritdoc}
     *
     * @see DecoderInterface::decode()
     *
     * @throws InvalidArgumentException
     */
    
public function decode(mixed $input): ColorInterface
    
{
        if (!
$input instanceof ColorInterface) {
            throw new 
InvalidArgumentException('Color object must be of type ' ColorInterface::class);
        }

        return 
$input;
    }
}
Онлайн: 1
Реклама