0 follower

Final Class Yiisoft\Db\Pgsql\Column\BitColumnInternal

InheritanceYiisoft\Db\Pgsql\Column\BitColumnInternal

Helper utilities for bit and varbit column handling.

Method Details

Hide inherited methods

className() public static method

public static string className ( integer|null $size )
$size integer|null

                public static function className(?int $size): string
{
    return !empty($size) && ($size > 63 || PHP_INT_SIZE !== 8 && $size > 31)
        ? BigBitColumn::class
        : BitColumn::class;
}

            
dbTypecast() public static method

public static string|\Yiisoft\Db\Expression\ExpressionInterface|null dbTypecast ( mixed $value, integer|null $size )
$value mixed
$size integer|null

                public static function dbTypecast(mixed $value, ?int $size): string|ExpressionInterface|null
{
    return match (gettype($value)) {
        'integer', 'double' => self::addZero(decbin((int) $value), $size),
        'NULL' => null,
        'boolean' => self::addZero($value ? '1' : '0', $size),
        'string' => $value === '' ? null : $value,
        default => $value instanceof ExpressionInterface ? $value : (string) $value,
    };
}