AbstractService

class Firstred\PostNL\Service\AbstractService
Class AbstractService.

Summary

Methods

Constants

COMMON_NAMESPACE = \'http://postnl\.nl/cif/services/common/\'
XML_SCHEMA_NAMESPACE = \'http://www\.w3\.org/2001/XMLSchema\-instance\'
ENVELOPE_NAMESPACE = \'http://schemas\.xmlsoap\.org/soap/envelope/\'
OLD_ENVELOPE_NAMESPACE = \'http://www\.w3\.org/2003/05/soap\-envelope\'

Properties

public property Firstred\PostNL\Service\AbstractService::$namespaces
Type:

array

protected static property Firstred\PostNL\Service\AbstractService::$postnl
Type:

\Firstred\PostNL\PostNL

public static property Firstred\PostNL\Service\AbstractService::$ttl
TTL for the cache.
`null` disables the cache
`int` is the TTL in seconds
Any `DateTime` will be used as the exact date/time at which to expire the data (auto calculate TTL)
A `DateInterval` can be used as well to set the TTL
Type:

int | \DateTimeInterface | \DateInterval | null

Deprecated:

1.4.0

public static property Firstred\PostNL\Service\AbstractService::$cache
The [PSR-6](https://www.php-fig.org/psr/psr-6/) CacheItemPoolInterface.
Use a caching library that implements [PSR-6](https://www.php-fig.org/psr/psr-6/) and you'll be good to go
`null` disables the cache
Type:

\Psr\Cache\CacheItemPoolInterface | null

Deprecated:

1.4.0

Methods

public Firstred\PostNL\Service\AbstractService::__construct($postnl, $cache=null, $ttl=null)
AbstractService constructor.
Parameters:
  • $postnl (Firstred\PostNL\PostNL) PostNL instance

  • $cache (Psr\Cache\CacheItemPoolInterface | null)

  • $ttl (int | \DateTimeInterface | \DateInterval | null)

public Firstred\PostNL\Service\AbstractService::__call($name, $args)
Parameters:
  • $name (string)

  • $args (mixed)

Returns:

mixed

Throws:

\Firstred\PostNL\Exception\InvalidMethodException

Since:

1.0.0

public Firstred\PostNL\Service\AbstractService::setService($object)
Set the webservice on the object.
This lets the object know for which service it should serialize
Parameters:
Returns:

bool

Since:

1.0.0

public static Firstred\PostNL\Service\AbstractService::registerNamespaces($element)
Register namespaces.
Parameters:
  • $element (SimpleXMLElement)

Since:

1.0.0

public static Firstred\PostNL\Service\AbstractService::validateRESTResponse($response)
Parameters:
  • $response (Psr\Http\Message\ResponseInterface | \Exception)

Returns:

bool

Throws:

\Firstred\PostNL\Exception\CifDownException

Throws:

\Firstred\PostNL\Exception\CifException

Throws:

\Firstred\PostNL\Exception\HttpClientException

Throws:

\Firstred\PostNL\Exception\ResponseException

Throws:

\Firstred\PostNL\Exception\InvalidConfigurationException

Throws:

\Firstred\PostNL\Exception\CifDownException

Throws:

\Firstred\PostNL\Exception\CifException

Throws:

\Firstred\PostNL\Exception\HttpClientException

Throws:

\Firstred\PostNL\Exception\ResponseException

Throws:

\Firstred\PostNL\Exception\InvalidConfigurationException

Throws:

\Firstred\PostNL\Exception\CifDownException

Throws:

\Firstred\PostNL\Exception\CifException

Throws:

\Firstred\PostNL\Exception\HttpClientException

Throws:

\Firstred\PostNL\Exception\ResponseException

Throws:

\Firstred\PostNL\Exception\InvalidConfigurationException

Throws:

\Firstred\PostNL\Exception\CifDownException

Throws:

\Firstred\PostNL\Exception\CifException

Throws:

\Firstred\PostNL\Exception\HttpClientException

Throws:

\Firstred\PostNL\Exception\ResponseException

Throws:

\Firstred\PostNL\Exception\InvalidConfigurationException

Throws:

\Firstred\PostNL\Exception\CifDownException

Throws:

\Firstred\PostNL\Exception\CifException

Throws:

\Firstred\PostNL\Exception\HttpClientException

Throws:

\Firstred\PostNL\Exception\ResponseException

Throws:

\Firstred\PostNL\Exception\InvalidConfigurationException

Since:

1.0.0

public static Firstred\PostNL\Service\AbstractService::validateSOAPResponse($xml)
Parameters:
  • $xml (SimpleXMLElement)

Returns:

bool

Throws:

\Firstred\PostNL\Exception\CifDownException

Throws:

\Firstred\PostNL\Exception\CifException

Throws:

\Firstred\PostNL\Exception\CifDownException

Throws:

\Firstred\PostNL\Exception\CifException

Since:

1.0.0

public static Firstred\PostNL\Service\AbstractService::getResponseText($response)
Get the response.
Parameters:
  • $response

Returns:

string

Throws:

\Firstred\PostNL\Exception\ResponseException

Throws:

\Firstred\PostNL\Exception\HttpClientException

Throws:

\Firstred\PostNL\Exception\ResponseException

Throws:

\Firstred\PostNL\Exception\HttpClientException

Since:

1.0.0

public Firstred\PostNL\Service\AbstractService::retrieveCachedItem($uuid)
Retrieve a cached item.
Parameters:
  • $uuid (string)

Returns:

\Psr\Cache\CacheItemInterface | null

Throws:

\Psr\Cache\InvalidArgumentException

Since:

1.0.0

public Firstred\PostNL\Service\AbstractService::cacheItem($item)
Cache an item
Parameters:
  • $item (Psr\Cache\CacheItemInterface)

Since:

1.0.0

public Firstred\PostNL\Service\AbstractService::removeCachedItem($item)
Delete an item from cache
Parameters:
  • $item (Psr\Cache\CacheItemInterface)

Throws:

\Psr\Cache\InvalidArgumentException

Since:

1.2.0

public Firstred\PostNL\Service\AbstractService::getTtl()
Returns:

\DateInterval | \DateTimeInterface | int | null

Since:

1.2.0

public Firstred\PostNL\Service\AbstractService::setTtl($ttl=null)
Parameters:
  • $ttl (int | \DateTimeInterface | \DateInterval | null)

Returns:

static

Since:

1.2.0

public Firstred\PostNL\Service\AbstractService::getCache()
Returns:

\Psr\Cache\CacheItemPoolInterface | null

Since:

1.2.0

Deprecated:

1.4.0

public Firstred\PostNL\Service\AbstractService::setCache($cache=null)
Parameters:
  • $cache (Psr\Cache\CacheItemPoolInterface | null)

Returns:

static

Since:

1.2.0

Deprecated:

1.4.0

public static Firstred\PostNL\Service\AbstractService::defaultDateFormat($writer, $value)
Write default date format in XML
Parameters:
  • $writer (Sabre\Xml\Writer)

  • $value (DateTimeImmutable)

Since:

1.2.0