public function castByte()
{
$min = self::BYTE_MIN_VALUE;
$max = self::BYTE_MAX_VALUE;
$castFunction = function ($value) use($min, $max) {
return $value < 0 ? $min : $max;
};
if (is_numeric($this->value) && $this->value >= $min && $this->value <= $max) {
return $this->value;
}
return $this->handleMismatch($castFunction, 'byte');
}