class HEX extends Model implements ModelInterface

Traits

Properties

protected array $channels
protected array $types
protected float $alpha from Model
protected string $hex
protected string $hexa

Methods

void
__construct(string $value = NULL)

No description

from Model
static Model
create(string $value)

No description

from Model
array
getChannelsList()

No description

from Model
array
getTypesList()

No description

from Model
void
syncAlpha(string|float $alpha)

No description

from Model
boolean
isType(string $type)

No description

from Model
boolean
isChannel(string $channel)

No description

from Model
void
set(string|array $value)

Set all model channels

int|float
limitation(int|float $value, int $max, int $min = 0)

Limitation of a variable in the range

from Model
string
RgbToHex(string $rgb, bool $withAlpha = true)

Converting rgb to hex code

from HexTrait
int
strToDec(string $value)

Converting hex code to decimal number

from HexTrait
string
decToHex(int $value)

Converting decimal number to hex code string

from HexTrait
array
parseHex(string $value)

No description

from HexTrait
array
explodeHex(string $value)

No description

from HexTrait
string|stdClass
convertToRgb(bool $withAlpha = false, bool $toString = false)

Convert instance values to RGB

void
convertFromRgb(string|array $rgb)

Convert instance values from RGB

void
setChannel(string $channel, string|integer|float $value)

Set single channel

float|integer|string
getChannel(string $channel)

Get single channel

string|stdClass
get(bool $withAlpha = false, bool $toString = false)

Get all model channels

Details

in Model at line 23
void __construct(string $value = NULL)

Parameters

string $value

Return Value

void

in Model at line 35
static Model create(string $value)

Parameters

string $value

Return Value

Model

in Model at line 43
array getChannelsList()

Return Value

array

in Model at line 51
array getTypesList()

Return Value

array

in Model at line 61
void syncAlpha(string|float $alpha)

Parameters

string|float $alpha

Return Value

void

in Model at line 76
boolean isType(string $type)

Parameters

string $type

Return Value

boolean

in Model at line 86
boolean isChannel(string $channel)

Parameters

string $channel

Return Value

boolean

at line 114
void set(string|array $value)

Set all model channels

Parameters

string|array $value

Return Value

void

in Model at line 110
protected int|float limitation(int|float $value, int $max, int $min = 0)

Limitation of a variable in the range

Parameters

int|float $value
int $max
int $min

Return Value

int|float

in HexTrait at line 18
protected string RgbToHex(string $rgb, bool $withAlpha = true)

Converting rgb to hex code

Parameters

string $rgb
bool $withAlpha

Return Value

string

in HexTrait at line 50
protected int strToDec(string $value)

Converting hex code to decimal number

Parameters

string $value hex code in string format

Return Value

int

Exceptions

HexException

in HexTrait at line 69
protected string decToHex(int $value)

Converting decimal number to hex code string

Parameters

int $value

Return Value

string

in HexTrait at line 86
protected array parseHex(string $value)

Parameters

string $value

Return Value

array

Exceptions

HexException

in HexTrait at line 128
protected array explodeHex(string $value)

Parameters

string $value

Return Value

array

Exceptions

HexException

at line 36
string|stdClass convertToRgb(bool $withAlpha = false, bool $toString = false)

Convert instance values to RGB

Parameters

bool $withAlpha
bool $toString

Return Value

string|stdClass

at line 66
void convertFromRgb(string|array $rgb)

Convert instance values from RGB

Parameters

string|array $rgb

Return Value

void

at line 80
void setChannel(string $channel, string|integer|float $value)

Set single channel

Parameters

string $channel
string|integer|float $value

Return Value

void

at line 96
float|integer|string getChannel(string $channel)

Get single channel

Parameters

string $channel

Return Value

float|integer|string

at line 135
string|stdClass get(bool $withAlpha = false, bool $toString = false)

Get all model channels

Parameters

bool $withAlpha
bool $toString

Return Value

string|stdClass