TrackRecordPro API Documentation TrackRecordPro

__construct()

Summary

Method Name

__construct

Minimum Supported API Version3.0

__construct

__construct($certificatefile, Psr\Log\LoggerInterface $logger = null)

Details

The constructor for the CoMech\TRP\API class sets up the default variables used, such as the path to the certificate file and optionally a PSR-3 compliant logger. If the logger you choose is enabled, debug messages are output using the debug log facility. If you do not specify a logger, debug messages are silently dropped.

 

We recommend installing monolog via composer to handle logging, which implements a compatible interface.

Parameters

$certificatefileA path to a PEM format certificate file, with the private key included. Only the public key portion is sent over the wire to the server.
$loggerAn instance of a PSR-3 compliant logger interface.

Return value

Constructors do not return values. Calling the constructor as part of object construction returns an instance of the CoMech\TRP\API class.

Possible Exceptions

The constructor may throw one of the following exceptions on error:

CoMech\TRP\Exception\FileNotFoundExceptionThe certificate file you specified cannot be found (or accessed)
CoMech\TRP\Exception\CertificateFormatExceptionThe certificate file you specified is an invalid format. The certificate file should be a correctly formatted OpenSSL-comaptible PEM file.