BencodeProperty
in package
FinalYes
Defines a class method or property as a Bencoded object property.
Attributes
- #[Attribute]
- \Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY
Table of Contents
Methods
- __construct() : mixed
- getName() : string|null
- Gets name for the property value in the Bencoded object.
- getOmittedValues() : array<string|int, mixed>
- Gets which values should be omitted.
- getOrder() : int
- Gets the order value for this property.
- shouldBeOmitted() : bool
- Checks whether a given value should be omitted from the Bencoded object.
- shouldConvertNumbersToString() : bool
- Gets whether numbers should be converted to string.
- shouldOmitIfNull() : bool
- Gets whether this should be omitted if the value is null.
Methods
__construct()
public
__construct([string $name = null ][, int $order = 0 ][, bool $omitIfNull = true ][, mixed|array<string|int, mixed> $omitIfValue = [] ][, bool $numbersAsString = false ]) : mixed
Parameters
- $name : string = null
-
Name of the property in the Bencoded object.
- $order : int = 0
-
Ordering of the property in the Bencoded object.
- $omitIfNull : bool = true
-
Whether the value should be omitted if its null.
- $omitIfValue : mixed|array<string|int, mixed> = []
-
Which values should be omitted.
- $numbersAsString : bool = false
-
Whether numbers should be cast to strings.
getName()
Gets name for the property value in the Bencoded object.
public
getName() : string|null
Return values
string|nullgetOmittedValues()
Gets which values should be omitted.
public
getOmittedValues() : array<string|int, mixed>
Return values
array<string|int, mixed>getOrder()
Gets the order value for this property.
public
getOrder() : int
Return values
intshouldBeOmitted()
Checks whether a given value should be omitted from the Bencoded object.
public
shouldBeOmitted(mixed $value) : bool
Parameters
- $value : mixed
-
Value to check.
Return values
boolshouldConvertNumbersToString()
Gets whether numbers should be converted to string.
public
shouldConvertNumbersToString() : bool
Return values
boolshouldOmitIfNull()
Gets whether this should be omitted if the value is null.
public
shouldOmitIfNull() : bool