1 | <?php |
||
19 | class Client |
||
20 | { |
||
21 | const URI_SANDBOX = 'https://api.development.push.apple.com:443'; |
||
22 | const URI_PROD = 'https://api.push.apple.com:443'; |
||
23 | |||
24 | /** |
||
25 | * @var bool |
||
26 | */ |
||
27 | protected $useSandbox; |
||
28 | |||
29 | /** |
||
30 | * Path to a file containing a private SSL key in PEM format. |
||
31 | * If a password is required, then it's an array containing the path to the SSL key in the first array element |
||
32 | * followed by the password required for the certificate in the second element. |
||
33 | * |
||
34 | * @var array|string |
||
35 | */ |
||
36 | protected $sslCert; |
||
37 | |||
38 | /** |
||
39 | * @var callable |
||
40 | */ |
||
41 | private $handler; |
||
42 | |||
43 | /** |
||
44 | * AppleNotification constructor. |
||
45 | * |
||
46 | * @param string|array $sslCert string containing certificate file name or array [<filename>,<password>] |
||
47 | * @param bool $useSandbox |
||
48 | * @param callable $handler |
||
49 | */ |
||
50 | 6 | public function __construct($sslCert, $useSandbox = false, callable $handler = null) |
|
57 | |||
58 | /** |
||
59 | * @param Message $message |
||
60 | * |
||
61 | * @return bool |
||
62 | * |
||
63 | * @throws ApnsException |
||
64 | */ |
||
65 | 1 | public function send(Message $message) |
|
71 | |||
72 | /** |
||
73 | * @return array|string |
||
74 | */ |
||
75 | 2 | public function getSslCert() |
|
79 | |||
80 | /** |
||
81 | * @return string |
||
82 | */ |
||
83 | 3 | public function getServer() |
|
87 | |||
88 | /** |
||
89 | * @param Message $message |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | 1 | public function getPushURI(Message $message) |
|
97 | } |
||
98 |