-
Notifications
You must be signed in to change notification settings - Fork 3
/
campaignmonitor.php
44 lines (35 loc) · 962 Bytes
/
campaignmonitor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* A Laravel wrapper for the Campaign Monitor API
*
* @package CampaignMonitor
* @author Durham Hale <[email protected]>
* @link http://github.com/durhamhale/laravel-campaignmonitor
*/
class CampaignMonitor {
/**
* Creates a new instance for the specified Campaign Monitor API class
*
* @param string $class
* @param string $arguments
* @return CS_REST_$class Object
*/
public static function __callStatic($class, $arguments)
{
// Reset any string formatting
$class = strtolower($class);
// Include the class file
require_once(Bundle::path('campaignmonitor').'vendor/csrest_'.$class.'.php');
$options = array(
Config::get('campaignmonitor.api_key')
);
if(isset($arguments[0]))
{
array_unshift($options, $arguments[0]);
}
// Load the class
$class = 'CS_REST_'.ucfirst($class);
$instance = new ReflectionClass($class);
return $instance->newInstanceArgs($options);
}
}