1 | <?php |
||
14 | class OneSignal |
||
15 | { |
||
16 | const API_URL = 'https://onesignal.com/api/v1'; |
||
17 | |||
18 | /** |
||
19 | * @var Config |
||
20 | */ |
||
21 | protected $config; |
||
22 | |||
23 | /** |
||
24 | * @var Client |
||
25 | */ |
||
26 | protected $client; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $services = []; |
||
32 | |||
33 | /** |
||
34 | * Constructor. |
||
35 | * |
||
36 | * @param Config $config |
||
37 | * @param Client $client |
||
38 | */ |
||
39 | public function __construct(Config $config = null, Client $client = null) |
||
47 | |||
48 | /** |
||
49 | * Set config. |
||
50 | * |
||
51 | * @param Config $config |
||
52 | */ |
||
53 | public function setConfig(Config $config) |
||
57 | |||
58 | /** |
||
59 | * Get config. |
||
60 | * |
||
61 | * @return Config |
||
62 | */ |
||
63 | public function getConfig() |
||
67 | |||
68 | /** |
||
69 | * Set client |
||
70 | * |
||
71 | * @param Client $client |
||
72 | */ |
||
73 | public function setClient(Client $client) |
||
77 | |||
78 | /** |
||
79 | * Get client |
||
80 | * |
||
81 | * @return Client|null |
||
82 | */ |
||
83 | public function getClient() |
||
87 | |||
88 | /** |
||
89 | * Make a custom api request. |
||
90 | * |
||
91 | * @param string $method HTTP Method |
||
92 | * @param string $uri URI template |
||
93 | * @param array $headers |
||
94 | * @param string|StreamInterface|null $body |
||
95 | * |
||
96 | * @throws OneSignalException |
||
97 | * |
||
98 | * @return array |
||
99 | */ |
||
100 | public function request($method, $uri, array $headers = [], $body = null) |
||
110 | |||
111 | /** |
||
112 | * Create required services on the fly. |
||
113 | * |
||
114 | * @param string $name |
||
115 | * |
||
116 | * @return object |
||
117 | */ |
||
118 | public function __get($name) |
||
140 | } |
||
141 |