@@ -4,24 +4,24 @@ |
||
4 | 4 | |
5 | 5 | class ServiceProvider extends \Illuminate\Support\ServiceProvider |
6 | 6 | { |
7 | - const CONFIG_PATH = __DIR__ . '/../config/live-engage-laravel.php'; |
|
7 | + const CONFIG_PATH = __DIR__ . '/../config/live-engage-laravel.php'; |
|
8 | 8 | |
9 | - public function boot() |
|
10 | - { |
|
11 | - $this->publishes([ |
|
12 | - self::CONFIG_PATH => config_path('live-engage-laravel.php'), |
|
13 | - ], 'config'); |
|
14 | - } |
|
9 | + public function boot() |
|
10 | + { |
|
11 | + $this->publishes([ |
|
12 | + self::CONFIG_PATH => config_path('live-engage-laravel.php'), |
|
13 | + ], 'config'); |
|
14 | + } |
|
15 | 15 | |
16 | - public function register() |
|
17 | - { |
|
18 | - $this->mergeConfigFrom( |
|
19 | - self::CONFIG_PATH, |
|
20 | - 'live-engage-laravel' |
|
21 | - ); |
|
16 | + public function register() |
|
17 | + { |
|
18 | + $this->mergeConfigFrom( |
|
19 | + self::CONFIG_PATH, |
|
20 | + 'live-engage-laravel' |
|
21 | + ); |
|
22 | 22 | |
23 | - $this->app->bind('live-engage-laravel', function () { |
|
24 | - return new LiveEngageLaravel(); |
|
25 | - }); |
|
26 | - } |
|
23 | + $this->app->bind('live-engage-laravel', function () { |
|
24 | + return new LiveEngageLaravel(); |
|
25 | + }); |
|
26 | + } |
|
27 | 27 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | 'live-engage-laravel' |
21 | 21 | ); |
22 | 22 | |
23 | - $this->app->bind('live-engage-laravel', function () { |
|
23 | + $this->app->bind('live-engage-laravel', function() { |
|
24 | 24 | return new LiveEngageLaravel(); |
25 | 25 | }); |
26 | 26 | } |
@@ -6,8 +6,8 @@ |
||
6 | 6 | |
7 | 7 | class LiveEngageLaravel extends Facade |
8 | 8 | { |
9 | - protected static function getFacadeAccessor() |
|
10 | - { |
|
11 | - return 'live-engage-laravel'; |
|
12 | - } |
|
9 | + protected static function getFacadeAccessor() |
|
10 | + { |
|
11 | + return 'live-engage-laravel'; |
|
12 | + } |
|
13 | 13 | } |
@@ -19,7 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | public function next() { |
21 | 21 | |
22 | - if (!$this->instance) return false; |
|
22 | + if (!$this->instance) { |
|
23 | + return false; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | $instance = $this->instance; |
25 | 27 | |
@@ -42,7 +44,9 @@ discard block |
||
42 | 44 | |
43 | 45 | public function prev() { |
44 | 46 | |
45 | - if (!$this->instance) return false; |
|
47 | + if (!$this->instance) { |
|
48 | + return false; |
|
49 | + } |
|
46 | 50 | |
47 | 51 | $instance = $this->instance; |
48 | 52 |
@@ -19,7 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | public function next() { |
21 | 21 | |
22 | - if (!$this->instance) return false; |
|
22 | + if (!$this->instance) { |
|
23 | + return false; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | $instance = $this->instance; |
25 | 27 | |
@@ -42,7 +44,9 @@ discard block |
||
42 | 44 | |
43 | 45 | public function prev() { |
44 | 46 | |
45 | - if (!$this->instance) return false; |
|
47 | + if (!$this->instance) { |
|
48 | + return false; |
|
49 | + } |
|
46 | 50 | |
47 | 51 | $instance = $this->instance; |
48 | 52 |
@@ -6,14 +6,14 @@ |
||
6 | 6 | |
7 | 7 | class LiveEngageException extends Exception |
8 | 8 | { |
9 | - public function __construct($message, $code = 0, Exception $previous = null) |
|
10 | - { |
|
11 | - parent::__construct($message, $code, $previous); |
|
12 | - } |
|
9 | + public function __construct($message, $code = 0, Exception $previous = null) |
|
10 | + { |
|
11 | + parent::__construct($message, $code, $previous); |
|
12 | + } |
|
13 | 13 | |
14 | - // custom string representation of object |
|
15 | - public function __toString() { |
|
16 | - return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; |
|
17 | - } |
|
14 | + // custom string representation of object |
|
15 | + public function __toString() { |
|
16 | + return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; |
|
17 | + } |
|
18 | 18 | |
19 | 19 | } |
20 | 20 | \ No newline at end of file |
@@ -255,17 +255,17 @@ |
||
255 | 255 | $secret = config("{$this->config}.token_secret"); |
256 | 256 | |
257 | 257 | $stack = HandlerStack::create(); |
258 | - $auth = new Oauth1([ |
|
259 | - 'consumer_key' => $consumer_key, |
|
260 | - 'consumer_secret' => $consumer_secret, |
|
261 | - 'token' => $token, |
|
262 | - 'token_secret' => $secret, |
|
263 | - 'signature_method'=> Oauth1::SIGNATURE_METHOD_HMAC |
|
258 | + $auth = new Oauth1([ |
|
259 | + 'consumer_key' => $consumer_key, |
|
260 | + 'consumer_secret' => $consumer_secret, |
|
261 | + 'token' => $token, |
|
262 | + 'token_secret' => $secret, |
|
263 | + 'signature_method'=> Oauth1::SIGNATURE_METHOD_HMAC |
|
264 | 264 | ]); |
265 | 265 | $stack->push($auth); |
266 | 266 | |
267 | 267 | $client = new Client([ |
268 | - 'handler' => $stack |
|
268 | + 'handler' => $stack |
|
269 | 269 | ]); |
270 | 270 | |
271 | 271 | $args = [ |
@@ -94,7 +94,9 @@ discard block |
||
94 | 94 | |
95 | 95 | public function visitor($visitorID, $sessionID, $setData = false) { |
96 | 96 | |
97 | - if (!$this->domain) $this->domain('smt'); |
|
97 | + if (!$this->domain) { |
|
98 | + $this->domain('smt'); |
|
99 | + } |
|
98 | 100 | |
99 | 101 | if ($setData) { |
100 | 102 | $url = "https://{$this->domain}/api/account/{$this->account}/monitoring/visitors/{$visitorID}/visits/current/events?v=1&sid={$sessionID}"; |
@@ -108,7 +110,9 @@ discard block |
||
108 | 110 | |
109 | 111 | public function agentStatus() { |
110 | 112 | |
111 | - if (!$this->domain) $this->domain('msgHist'); |
|
113 | + if (!$this->domain) { |
|
114 | + $this->domain('msgHist'); |
|
115 | + } |
|
112 | 116 | |
113 | 117 | $url = "https://{$this->domain}/messaging_history/api/account/{$this->account}/agent-view/status"; |
114 | 118 | return $this->request($url, 'POST', new Payload(['skillIds' => $this->skills])); |
@@ -117,7 +121,9 @@ discard block |
||
117 | 121 | |
118 | 122 | public final function retrieveHistory(Carbon $start, Carbon $end, $url = false) { |
119 | 123 | |
120 | - if (!$this->domain) $this->domain('engHistDomain'); |
|
124 | + if (!$this->domain) { |
|
125 | + $this->domain('engHistDomain'); |
|
126 | + } |
|
121 | 127 | |
122 | 128 | $url = $url ?: "https://{$this->domain}/interaction_history/api/account/{$this->account}/interactions/search?limit={$this->history_limit}&offset=0"; |
123 | 129 | |
@@ -144,7 +150,9 @@ discard block |
||
144 | 150 | |
145 | 151 | public final function retrieveMsgHistory(Carbon $start, Carbon $end, $url = false) { |
146 | 152 | |
147 | - if (!$this->domain) $this->domain('msgHist'); |
|
153 | + if (!$this->domain) { |
|
154 | + $this->domain('msgHist'); |
|
155 | + } |
|
148 | 156 | |
149 | 157 | $url = $url ?: "https://{$this->domain}/messaging_history/api/account/{$this->account}/conversations/search?limit={$this->history_limit}&offset=0"; |
150 | 158 | |
@@ -191,14 +199,17 @@ discard block |
||
191 | 199 | $history = []; |
192 | 200 | foreach ($results as $item) { |
193 | 201 | |
194 | - if (property_exists($item, 'info')) |
|
195 | - $item->info = new Info((array) $item->info); |
|
202 | + if (property_exists($item, 'info')) { |
|
203 | + $item->info = new Info((array) $item->info); |
|
204 | + } |
|
196 | 205 | |
197 | - if (property_exists($item, 'visitorInfo')) |
|
198 | - $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
206 | + if (property_exists($item, 'visitorInfo')) { |
|
207 | + $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
208 | + } |
|
199 | 209 | |
200 | - if (property_exists($item, 'campaign')) |
|
201 | - $item->campaign = new Campaign((array) $item->campaign); |
|
210 | + if (property_exists($item, 'campaign')) { |
|
211 | + $item->campaign = new Campaign((array) $item->campaign); |
|
212 | + } |
|
202 | 213 | |
203 | 214 | $history[] = new Conversation((array) $item); |
204 | 215 | |
@@ -230,14 +241,17 @@ discard block |
||
230 | 241 | $history = []; |
231 | 242 | foreach ($results as $item) { |
232 | 243 | |
233 | - if (property_exists($item, 'info')) |
|
234 | - $item->info = new Info((array) $item->info); |
|
244 | + if (property_exists($item, 'info')) { |
|
245 | + $item->info = new Info((array) $item->info); |
|
246 | + } |
|
235 | 247 | |
236 | - if (property_exists($item, 'visitorInfo')) |
|
237 | - $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
248 | + if (property_exists($item, 'visitorInfo')) { |
|
249 | + $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
250 | + } |
|
238 | 251 | |
239 | - if (property_exists($item, 'campaign')) |
|
240 | - $item->campaign = new Campaign((array) $item->campaign); |
|
252 | + if (property_exists($item, 'campaign')) { |
|
253 | + $item->campaign = new Campaign((array) $item->campaign); |
|
254 | + } |
|
241 | 255 | |
242 | 256 | $history[] = new Engagement((array) $item); |
243 | 257 |