AbstractEntity

class Firstred\PostNL\Entity\AbstractEntity
Class Entity.
Implements

JsonSerializable Firstred\PostNL\Util\XmlSerializable

Summary

Methods

Properties

public property Firstred\PostNL\Entity\AbstractEntity::$defaultProperties
Type

array

protected static property Firstred\PostNL\Entity\AbstractEntity::$id
Type

string

protected static property Firstred\PostNL\Entity\AbstractEntity::$currentService
Type

string

Methods

public Firstred\PostNL\Entity\AbstractEntity::__construct()
AbstractEntity constructor.
public static Firstred\PostNL\Entity\AbstractEntity::create( $properties=\[\])
Create an instance of this class without touching the constructor.
Parameters
  • $properties (array)

Returns

object | null

Since

1.0.0

public Firstred\PostNL\Entity\AbstractEntity::__call($name, $value)
Parameters
  • $name (string)

  • $value (mixed)

Returns

object | null

Throws

\Firstred\PostNL\Exception\InvalidArgumentException

public Firstred\PostNL\Entity\AbstractEntity::jsonSerialize()
Return a serializable array for `json_encode`.
Returns

array

Throws

\Firstred\PostNL\Exception\InvalidArgumentException

public Firstred\PostNL\Entity\AbstractEntity::xmlSerialize($writer)
Return a serializable array for the XMLWriter.
Parameters
  • $writer (Sabre\Xml\Writer)

Returns

void

Throws

\Firstred\PostNL\Exception\InvalidArgumentException

public static Firstred\PostNL\Entity\AbstractEntity::jsonDeserialize($json)
Deserialize JSON.
Parameters
  • $json (stdClass) JSON object {“EntityName”: object}

Returns

mixed

Throws

\Firstred\PostNL\Exception\NotSupportedException

Throws

\Firstred\PostNL\Exception\InvalidArgumentException

Throws

\Firstred\PostNL\Exception\NotSupportedException

Throws

\Firstred\PostNL\Exception\InvalidArgumentException

public static Firstred\PostNL\Entity\AbstractEntity::xmlDeserialize($xml)
Deserialize XML.
Parameters
  • $xml (array) Associative array representation of XML response, using Clark notation for namespaces

Returns

\Firstred\PostNL\Entity\AbstractEntity

public static Firstred\PostNL\Entity\AbstractEntity::shouldBeAnArray($fqcn, $propertyName)
Whether the given property should bbe an array
Parameters
  • $fqcn (string)

  • $propertyName (string)

Returns

false | string If found, singular name of property

Since

1.2.0

public static Firstred\PostNL\Entity\AbstractEntity::getFullyQualifiedEntityClassName($shortName)
Get the fully qualified class name for the given entity name.
Parameters
  • $shortName (string)

Returns

string The FQCN

Throws

\Firstred\PostNL\Exception\InvalidArgumentException

Since

1.2.0