Source of file CMBase.php
Size: 0,798 Bytes - Last Modified: 2021-12-23T10:53:26+00:00
/var/www/docs.ssmods.com/process/src/code/CMBase.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445 | <?php /** * Base class for Campaign Monitor objects * * @author Damian Mooyman */ abstract class CMBase extends ViewableData { /** * The API key used for future requests * * @var string */ protected $apiKey = null; function __construct($apiKey = null) { $this->apiKey = $apiKey; } /** * Checks that a result is successful * * @param type $result * @throws CMError */ protected function checkResult($result) { if (!$result->was_successful()) { throw new CMError($result->response->Message, $result->http_status_code); } return true; } /** * Safely extracts results from a CM API call * * @param type $result * @return type */ protected function parseResult($result) { $this->checkResult($result); return $result->response; } } |