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

declare(strict_types=1);

namespace 
InterventionGifDecoders;

use 
InterventionGifAbstractExtension;
use 
InterventionGifBlocksApplicationExtension;
use 
InterventionGifBlocksCommentExtension;
use 
InterventionGifBlocksFrameBlock;
use 
InterventionGifBlocksGraphicControlExtension;
use 
InterventionGifBlocksImageDescriptor;
use 
InterventionGifBlocksNetscapeApplicationExtension;
use 
InterventionGifBlocksPlainTextExtension;
use 
InterventionGifBlocksTableBasedImage;
use 
InterventionGifExceptionsDecoderException;

class 
FrameBlockDecoder extends AbstractDecoder
{
    
/**
     * Decode FrameBlock
     *
     * @throws DecoderException
     * @return FrameBlock
     */
    
public function decode(): FrameBlock
    
{
        
$frame = new FrameBlock();

        do {
            
$block match ($this->viewNextBytes(2)) {
                
AbstractExtension::MARKER GraphicControlExtension::LABEL
                
=> GraphicControlExtension::decode($this->handle),
                
AbstractExtension::MARKER NetscapeApplicationExtension::LABEL
                
=> NetscapeApplicationExtension::decode($this->handle),
                
AbstractExtension::MARKER ApplicationExtension::LABEL
                
=> ApplicationExtension::decode($this->handle),
                
AbstractExtension::MARKER PlainTextExtension::LABEL
                
=> PlainTextExtension::decode($this->handle),
                
AbstractExtension::MARKER CommentExtension::LABEL
                
=> CommentExtension::decode($this->handle),
                default => 
match ($this->viewNextByte()) {
                    
ImageDescriptor::SEPARATOR => TableBasedImage::decode($this->handle),
                    default => throw new 
DecoderException('Unable to decode Data Block'),
                }
            };

            
$frame->addEntity($block);
        } while (!(
$block instanceof TableBasedImage));

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