\LazyJsonMapper\ExportPropertyDescription

Provides a human-readable description of a compiled PropertyDefinition.

NOTE: The class validates all parameters, but provides public properties to avoid needless function calls. It's therefore your responsibility to never assign any bad values to the public properties after this object's creation!

Summary

Methods
Properties
Constants
__construct()
$owner
$is_defined
$name
$type
$is_basic_type
$is_relative_type_path
$function_has
$function_is
$function_get
$function_set
$function_unset
$func_case
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$owner

$owner : string

The strict, global path to the class which owns this property.

Examples: \MyNamespace\MyClass or \MyGlobalClass.

Type

string

$is_defined

$is_defined : boolean

Whether this property is defined in the class property map.

Properties are only reliable when defined within the class map. Because undefined properties will be inaccessible as soon as they are missing from the data, whereas class properties are always accessible.

Is TRUE if the property is defined in the class map, otherwise FALSE if this property only exists within the current class instance's data.

Type

boolean

$name

$name : string

The JSON data name of the property.

Examples: some_property.

Type

string

$type

$type : string

The property type in PHPdoc format.

Examples: int[], mixed, mixed[][], \Foo\Bar[], \Baz.

Type

string

$is_basic_type

$is_basic_type : boolean

Whether the type is a basic PHP type.

Basic types are mixed, int, float, string or bool.

Note that mixed is simply an alias for "allow any of the basic types, as well as arrays of those basic types" (although it's worth noting that mixed[] for example would enforce a depth of 1 with no deeper arrays).

Is TRUE if basic type, or FALSE if object type.

Type

boolean

$is_relative_type_path

$is_relative_type_path : boolean

Whether the type is a relative class path (relative to owner class).

Examples: Imagine that the $owner is \Foo\Bar, and the $type is \Foo\Xyz. In that case, the type is not a relative path. However, if the type had been Xyz, it would be marked as relative here.

This is always FALSE for basic types. And is only TRUE for object types if the path is actually relative. That's only possible when the target class type lives within the same namespace as the owner.

Type

boolean

$function_has

$function_has : string

The signature of the hasX()-function.

This function checks whether the property exists.

Type

string

$function_is

$function_is : string

The signature of the isX()-function.

This function checks whether the property exists and evaluates to TRUE.

Type

string

$function_get

$function_get : string

The signature of the getX()-function.

This function gets the value of the property.

Type

string

$function_set

$function_set : string

The signature of the setX()-function.

This function sets the value of the property.

Type

string

$function_unset

$function_unset : string

The signature of the unsetX()-function.

This function erases the property value from the internal object data. You can still use all other functions on the property afterwards.

Type

string

$func_case

$func_case : string

The bare "FuncCase" translation of the property name.

Might be helpful for very advanced users.

Type

string

Methods

__construct()

__construct(string  $ownerClassName, string  $propName, \LazyJsonMapper\Property\PropertyDefinition  $propDef, boolean  $allowRelativeTypePath = false) 

Constructor.

Parameters

string $ownerClassName

The full path of the class that owns this property, but without any leading \ global prefix. To save time, we assume the caller has already verified that it is a valid LazyJsonMapper class.

string $propName

The JSON property name.

\LazyJsonMapper\Property\PropertyDefinition $propDef

Compiled definition of the property.

boolean $allowRelativeTypePath

If TRUE, object types will use relative paths (compared to the owner class), when possible. It's only possible when the target class type lives within the same namespace as the owner.

Throws

\LazyJsonMapper\Exception\LazyJsonMapperException

If there are any problems with the input.