File: D:/HostingSpaces/Lacom/lacom.nl/app/KommaApp/Kms/Core/Attributes/Models/AbstractImageProperty.php
<?php
namespace App\KommaApp\Kms\Core\Attributes\Models;
/**
* Interface ImagePropertyInterface
* @package App\KommaApp\Kms\Core\Attributes\Models
*/
abstract class AbstractImageProperty
{
/** @const int Thumb The smallest image size representing a thumbnail */
const Thumb = 1;
/** @const int Thumb Representing a small image */
const Small = 2;
/** @const int Thumb Representing a medium image */
const Medium = 3;
/** @const int Thumb Representing a large image */
const Large = 4;
/** @const int Thumb Representing the original image size */
const Original = 5;
/**
* @return int[] All image sizes as an array of integers
* @throws \ReflectionException
*/
static function getAsArray() {
return self::getAllImageSizes();
}
/**
* Check if the passed image size is really an image size that is defined as a constant in this class.
*
* @param int $imageSize
* @param bool $strict If true it will only consider an image size as valid if it is a string.
* @return bool Returns true if the image size is a valid one, false otherwise
* @throws \ReflectionException
*/
static function isValidImageSize(int $imageSize, $strict = false) {
return in_array($imageSize, self::getAllImageSizes(), $strict);
}
/**
* Returns an array containing integers representing the defined image sizes.
*
* @return int[]
* @throws \ReflectionException
*/
private static function getAllImageSizes()
{
$thisClassAsReflectionClass = new \ReflectionClass(__CLASS__);
return $thisClassAsReflectionClass->getConstants();
}
/**
* @return string Gets the name of this ImagePropertyInterface instance
*/
abstract public function getName(): string;
/**
* Sets the name of this ImagePropertyInterface instance and returns itself
*
* @param string $name
* @return AbstractImageProperty
*/
abstract public function setName(string $name): AbstractImageProperty;
/**
* Sets the width of this ImagePropertyInterface and returns itself
*
* @param float $width
* @return AbstractImageProperty
*/
abstract public function setWidth(float $width): AbstractImageProperty;
/**
* Returns the width of this ImagePropertyInterface instance
*
* @return float
*/
abstract public function getWidth(): float;
/**
* Sets the height of this ImagePropertyInterface and returns itself.
* 0 for auto if implemented in the cropper that uses this
*
* @param float $height
* @return AbstractImageProperty
*/
abstract public function setHeight(float $height): AbstractImageProperty;
/**
* Returns the height of this ImagePropertyInterface instance
*
* @return float
*/
abstract public function getHeight(): float;
/**
* Sets the crop method of this ImagePropertyInterface and returns itself
*
* @param int $method
* @return AbstractImageProperty
*/
abstract public function setCropMethod(int $method): AbstractImageProperty;
/**
* Returns the crop method of this ImagePropertyInterface instance
*
* @return int
*/
abstract public function getCropMethod(): int;
}