Skip to content

Attribute


  • Full name: \Qubus\Validation\Attribute

Properties

rules

protected array $rules

key

protected string $key

alias

protected ?string $alias

validation

protected ?\Qubus\Validation\Validation $validation

required

protected bool $required

primaryAttribute

protected ?\Qubus\Validation\Attribute $primaryAttribute

otherAttributes

protected array $otherAttributes

keyIndexes

protected array $keyIndexes

Methods

__construct

public __construct(\Qubus\Validation\Validation $validation, string $key, string|null $alias = null, array $rules = []): void

Parameters:

Parameter Type Description
$validation \Qubus\Validation\Validation
$key string
$alias string|null
$rules array

setPrimaryAttribute

Set the primary attribute.

public setPrimaryAttribute(\Qubus\Validation\Attribute $primaryAttribute): void

Parameters:

Parameter Type Description
$primaryAttribute \Qubus\Validation\Attribute

setKeyIndexes

Set key indexes.

public setKeyIndexes(array $keyIndexes): void

Parameters:

Parameter Type Description
$keyIndexes array

getPrimaryAttribute

Get primary attributes.

public getPrimaryAttribute(): \Qubus\Validation\Attribute|null

setOtherAttributes

Set other attributes.

public setOtherAttributes(array $otherAttributes): void

Parameters:

Parameter Type Description
$otherAttributes array

addOtherAttribute

Add other attributes.

public addOtherAttribute(\Qubus\Validation\Attribute $otherAttribute): void

Parameters:

Parameter Type Description
$otherAttribute \Qubus\Validation\Attribute

getOtherAttributes

Get other attributes.

public getOtherAttributes(): array

addRule

Add rule.

public addRule(\Qubus\Validation\Rule $rule): void

Parameters:

Parameter Type Description
$rule \Qubus\Validation\Rule

getRule

Get rule.

public getRule(string $ruleKey): void

Parameters:

Parameter Type Description
$ruleKey string

getRules

Get rules.

public getRules(): array

hasRule

Check the $ruleKey has in the rule.

public hasRule(string $ruleKey): bool

Parameters:

Parameter Type Description
$ruleKey string

setRequired

Set required.

public setRequired(bool $required): void

Parameters:

Parameter Type Description
$required bool

isRequired

Set rule is required.

public isRequired(): bool

getKey

Get key.

public getKey(): string

getKeyIndexes

Get key indexes.

public getKeyIndexes(): array

getValue

Get value.

public getValue(string|null $key = null): mixed

Parameters:

Parameter Type Description
$key string|null

Throws:


isArrayAttribute

Get that is array attribute.

public isArrayAttribute(): bool

isUsingDotNotation

Check this attribute is using dot notation.

public isUsingDotNotation(): bool

resolveSiblingKey

Resolve sibling key.

public resolveSiblingKey(string $key): string

Parameters:

Parameter Type Description
$key string

getHumanizedKey

Get humanize key.

public getHumanizedKey(): string

setAlias

Set alias.

public setAlias(string $alias): void

Parameters:

Parameter Type Description
$alias string

getAlias

Get alias.

public getAlias(): string|null