ICanBoogie/Prototype v2.2.1
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • Prototype

Classes

  • Object
  • Prototype

Traits

  • PrototypeTrait

Class Object

Together with the ICanBoogie\Prototype class the ICanBoogie\Object class provides means to define getters and setters, as well as define getters, setters, and method at runtime.

The class also provides a method to create instances in the same fashion PDO creates instances with the FETCH_CLASS mode, that is the properties of the instance are set before its constructor is invoked.

ICanBoogie\Object implements ICanBoogie\ToArrayRecursive uses ICanBoogie\ToArrayRecursiveTrait (not available) ICanBoogie\PrototypeTrait
Namespace: ICanBoogie
Located at Object.php

Methods summary

public static mixed
# from( array $properties = null, array $construct_args = [], string|null $class_name = null )

Creates a new instance of the class using the supplied properties.

Creates a new instance of the class using the supplied properties.

The instance is created in the same fashion PDO creates instances when fetching objects using the FETCH_CLASS mode, that is the properties of the instance are set before its constructor is invoked.

Note: Because the method uses the unserialize function to create the instance, the __wakeup() magic method will be called if it is defined by the class, and it will be called before the constructor.

Note: The __wakeup() method of the ICanBoogie\Object class removes null properties for which a getter is defined.

Parameters

$properties
Properties to be set before the constructor is invoked.
$construct_args
Arguments passed to the constructor.
$class_name

The name of the instance class. If empty the name of the called class is used.

Returns

mixed
The new instance.
public array
# to_array( )

Converts the object into an array.

Converts the object into an array.

Only public properties and façade properties are included.

Returns

array
public string
# to_json( )

Converts the object into a JSON string.

Converts the object into a JSON string.

Returns

string

Methods used from ICanBoogie\PrototypeTrait

__call(), __sleep(), accessor_get(), accessor_set(), get_prototype(), has_method(), has_property(), last_chance_get(), last_chance_set()

Properties summary

Magic properties

public read-only ICanBoogie\Prototype $prototype

The prototype associated with the class.

ICanBoogie/Prototype v2.2.1 API documentation generated by ApiGen