Skip to content

Latest commit

 

History

History
56 lines (32 loc) · 1.87 KB

ivopetkov.dataobject.class.md

File metadata and controls

56 lines (32 loc) · 1.87 KB

IvoPetkov\DataObject

A data object that supports registering properties and importing/exporting from array and JSON.

IvoPetkov\DataObject implements ArrayAccess {

	/* Methods */
	public __construct ( [ array $data = [] ] )
	protected self defineProperty ( string $name [, array $options = [] ] )
	public static object fromArray ( array $data )
	public static object fromJSON ( string $data )
	public array toArray ( [ array $options = [] ] )
	public string toJSON ( [ array $options = [] ] )

}

Implements

Methods

public __construct ( [ array $data = [] ] )

      Constructs a new data object.

protected self defineProperty ( string $name [, array $options = [] ] )

      Defines a new property. Use closures with $this->privateProperty instead of local variables in the constructor (thay cannot be cloned).

public static object fromArray ( array $data )

      Creates an object and fills its properties from the array specified.

public static object fromJSON ( string $data )

      Creates an object and fills its properties from the JSON specified.

public array toArray ( [ array $options = [] ] )

      Returns the object data converted as an array.

public string toJSON ( [ array $options = [] ] )

      Returns the object data converted as JSON.

Details

Location: ~/src/DataObject.php


back to index