com\setasign\Konquadrat\Field

Bitmask

File: /Konquadrat/src/Field/Bitmask.php

Class hierarchy

Summary

Constants

ALLOW_NULL_VALUE

protected const Bitmask::ALLOW_NULL_VALUE = false

Properties

$dirty

protected bool AbstractField::$dirty = false

If this flag is true it couldn't correctly be loaded from the database.

$fieldConfig

$fieldContainer

$languageManager

$messageList

$value

protected mixed AbstractField::$value

The field value


Static Methods

getClassNameByType()

public static AbstractField::getClassNameByType (
string $type
): string

Get the matching field class name for $type.

Parameters
$type : string
 

render()

public static Bitmask::render (
\com\setasign\Konquadrat\LanguageManager $languageManager,
array $flags,
?int $value,
string $delimiter = ', ',
bool $useSystemLanguage = false
): string
Parameters
$languageManager : \com\setasign\Konquadrat\LanguageManager
 
$flags : array
 
$value : ?int
 
$delimiter : string
 
$useSystemLanguage : bool
 

resolveTexts()

protected static Bitmask::resolveTexts (
\com\setasign\Konquadrat\LanguageManager $languageManager,
array $flags,
?int $value,
bool $useSystemLanguage = false
): array
Parameters
$languageManager : \com\setasign\Konquadrat\LanguageManager
 
$flags : array
 
$value : ?int
 
$useSystemLanguage : bool
 

Methods

__construct()

public AbstractField::__construct (
\com\setasign\Konquadrat\LanguageManager $languageManager,
\com\setasign\Konquadrat\Object\MessageList $messageList,
FieldContainer\FieldContainerInterface $fieldContainer,
string $name,
array $fieldConfig
)

AbstractField constructor.

Parameters
$languageManager : \com\setasign\Konquadrat\LanguageManager
 
$messageList : \com\setasign\Konquadrat\Object\MessageList
 
$fieldContainer : FieldContainer\FieldContainerInterface
 
$name : string

The field name

$fieldConfig : array

The field configuration

Exceptions

Throws \com\setasign\Konquadrat\Exception

__clone()

public AbstractField::__clone (
void
): void
Exceptions

Throws \com\setasign\Konquadrat\Exception

__sleep()

public AbstractField::__sleep (
void
): void

callGetMethod()

public Bitmask::callGetMethod (
callable $getMethod
): mixed

Wrapper method to ensure the correct value type

Parameters
$getMethod : callable
 

getDefaultValue()

public Bitmask::getDefaultValue (
void
): int

getFieldConfig()

public AbstractField::getFieldConfig (
void
): array

getLabel()

public AbstractField::getLabel (
void
): string

getName()

public AbstractField::getName (
void
): string

Return the name

getText()

public Bitmask::getText (
string $delimiter = ', ',
bool $useSystemLanguage = false
): string

Get the display text for the chosen flags as one string delimited by $delimiter.

Parameters
$delimiter : string
 
$useSystemLanguage : bool
 

getTexts()

public Bitmask::getTexts (
bool $useSystemLanguage = false
): array

Get the display text for the chosen flags as an array of strings (one entry for every active flag).

Parameters
$useSystemLanguage : bool
 

getValue()

public AbstractField::getValue (
void
): ?mixed

Get the value

hasBit()

public Bitmask::hasBit (
int $bit
): bool
Parameters
$bit : int
 

isDirty()

public AbstractField::isDirty (
void
): bool

Checks whether the field could correctly be loaded from the database.

parseValue()

protected Bitmask::parseValue (
mixed $value
): int

Parse the value to the correct type

Parameters
$value : mixed
 
Exceptions

Throws \InvalidArgumentException

setBit()

public Bitmask::setBit (
int $bit,
bool $value = true
): static

Set a single bit.

Parameters
$bit : int
 
$value : bool
 

setBits()

public Bitmask::setBits (
string|array $bits,
bool $value = true
): static

Set multiple bits to a value.

Parameters
$bits : string|array

If is string it will explode on every ','

$value : bool
 

setValue()

public AbstractField::setValue (
mixed|DefaultValue $value
): void

Set the value

Parameters
$value : mixed|DefaultValue