-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPusherManager.php
More file actions
106 lines (93 loc) · 1.82 KB
/
PusherManager.php
File metadata and controls
106 lines (93 loc) · 1.82 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
namespace IrishDan\NotificationBundle;
/**
* Class PusherManager
*
* @package NotificationBundle
*/
class PusherManager
{
/**
* @var array
*/
private $config;
public function setConfig(array $config)
{
$this->config = $config;
}
/**
* @return \Pusher
*/
public function getPusherClient()
{
$options = [
'cluster' => $this->config['cluster'],
'encrypted' => $this->config['encrypted'],
];
$pusher = new \Pusher(
$this->config['auth_key'],
$this->config['secret'],
$this->config['app_id'],
$options
);
return $pusher;
}
/**
* @param PusherableInterface $user
* @return string
*/
public function getUserChannelName(PusherableInterface $user)
{
return $this->config['channel_name'] . $user->getPusherChannelSuffix();
}
/**
* @param $suffix
* @return string
*/
public function getChannelName($suffix)
{
return $this->config['channel_name'] . $suffix;
}
/**
* @return mixed
*/
public function getEvent()
{
return $this->config['event'];
}
/**
* @return mixed
*/
public function getAuthKey()
{
return $this->config['auth_key'];
}
/**
* @return mixed
*/
public function getSecret()
{
return $this->config['secret'];
}
/**
* @return mixed
*/
public function getAppId()
{
return $this->config['app_id'];
}
/**
* @return mixed
*/
public function getCluster()
{
return $this->config['cluster'];
}
/**
* @return mixed
*/
public function getEncrypted()
{
return $this->config['encrypted'];
}
}