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

declare(strict_types=1);

namespace 
InterventionImageGeometryFactories;

use 
InterventionImageExceptionsInvalidArgumentException;
use 
InterventionImageGeometryEllipse;
use 
InterventionImageInterfacesColorInterface;
use 
InterventionImageInterfacesDrawableFactoryInterface;
use 
InterventionImageInterfacesDrawableInterface;

class 
EllipseFactory implements DrawableFactoryInterface
{
    protected 
Ellipse $ellipse;

    
/**
     * Create new factory instance.
     */
    
public function __construct(null|callable|Ellipse $ellipse null)
    {
        
$this->ellipse $ellipse instanceof Ellipse ? clone $ellipse : new Ellipse(00);

        if (
is_callable($ellipse)) {
            
$ellipse($this);
        }
    }

    
/**
     * {@inheritdoc}
     *
     * @see DrawableFactoryInterface::build()
     */
    
public static function build(null|callable|DrawableInterface $drawable null): Ellipse
    
{
        return (new 
self($drawable))->drawable();
    }

    
/**
     * {@inheritdoc}
     *
     * @see DrawableFactoryInterface::drawable()
     */
    
public function drawable(): Ellipse
    
{
        return 
$this->ellipse;
    }

    
/**
     * Set the size of the ellipse to be produced.
     */
    
public function size(int $widthint $height): self
    
{
        
$this->ellipse->setSize($width$height);

        return 
$this;
    }

    
/**
     * Set the width of the ellipse to be produced.
     */
    
public function width(int $width): self
    
{
        
$this->ellipse->setWidth($width);

        return 
$this;
    }

    
/**
     * Set the height of the ellipse to be produced.
     */
    
public function height(int $height): self
    
{
        
$this->ellipse->setHeight($height);

        return 
$this;
    }

    
/**
     * Set the background color of the ellipse to be produced.
     */
    
public function background(string|ColorInterface $color): self
    
{
        
$this->ellipse->setBackgroundColor($color);

        return 
$this;
    }

    
/**
     * Set the border color & border size of the ellipse to be produced.
     *
     * @throws InvalidArgumentException
     */
    
public function border(string|ColorInterface $colorint $size 1): self
    
{
        
$this->ellipse->setBorder($color$size);

        return 
$this;
    }

    
/**
     * Set the position where the ellipse should be drawn.
     */
    
public function at(int $xint $y): self
    
{
        
$this->ellipse->position()->setPosition($x$y);

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