@@ -7,25 +7,25 @@ |
||
7 | 7 | |
8 | 8 | class Conversation extends Model |
9 | 9 | { |
10 | - protected $guarded = []; |
|
10 | + protected $guarded = []; |
|
11 | 11 | |
12 | - public function getMessageRecordsAttribute() |
|
13 | - { |
|
14 | - $messages = []; |
|
15 | - foreach ($this->attributes['messageRecords'] as $line) { |
|
16 | - $messages[] = new Message((array) $line); |
|
17 | - } |
|
12 | + public function getMessageRecordsAttribute() |
|
13 | + { |
|
14 | + $messages = []; |
|
15 | + foreach ($this->attributes['messageRecords'] as $line) { |
|
16 | + $messages[] = new Message((array) $line); |
|
17 | + } |
|
18 | 18 | |
19 | - return collect($messages); |
|
20 | - } |
|
19 | + return collect($messages); |
|
20 | + } |
|
21 | 21 | |
22 | - public function getAgentParticipantsAttribute() |
|
23 | - { |
|
24 | - $agents = []; |
|
25 | - foreach ($this->attributes['agentParticipants'] as $agent) { |
|
26 | - $agents[] = new MessagingAgent((array) $agent); |
|
27 | - } |
|
22 | + public function getAgentParticipantsAttribute() |
|
23 | + { |
|
24 | + $agents = []; |
|
25 | + foreach ($this->attributes['agentParticipants'] as $agent) { |
|
26 | + $agents[] = new MessagingAgent((array) $agent); |
|
27 | + } |
|
28 | 28 | |
29 | - return new AgentParticipants($agents); |
|
30 | - } |
|
29 | + return new AgentParticipants($agents); |
|
30 | + } |
|
31 | 31 | } |
@@ -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 | - { |
|
17 | - return __CLASS__.": [{$this->code}]: {$this->message}\n"; |
|
18 | - } |
|
14 | + // custom string representation of object |
|
15 | + public function __toString() |
|
16 | + { |
|
17 | + return __CLASS__.": [{$this->code}]: {$this->message}\n"; |
|
18 | + } |
|
19 | 19 | } |
@@ -14,6 +14,6 @@ |
||
14 | 14 | // custom string representation of object |
15 | 15 | public function __toString() |
16 | 16 | { |
17 | - return __CLASS__.": [{$this->code}]: {$this->message}\n"; |
|
17 | + return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; |
|
18 | 18 | } |
19 | 19 | } |
@@ -7,33 +7,33 @@ |
||
7 | 7 | |
8 | 8 | class Info extends Model |
9 | 9 | { |
10 | - protected $guarded = []; |
|
11 | - protected $appends = [ |
|
12 | - 'startTime', |
|
13 | - ]; |
|
14 | - |
|
15 | - public function getStartTimeAttribute() |
|
16 | - { |
|
17 | - return new Carbon($this->attributes['startTime']); |
|
18 | - } |
|
19 | - |
|
20 | - public function getSessionIdAttribute() |
|
21 | - { |
|
22 | - return str_replace($this->accountId, '', $this->engagementId); |
|
23 | - } |
|
24 | - |
|
25 | - public function getMinutesAttribute() |
|
26 | - { |
|
27 | - return round($this->attributes['duration'] / 60, 2); |
|
28 | - } |
|
29 | - |
|
30 | - public function getSecondsAttribute() |
|
31 | - { |
|
32 | - return $this->attributes['duration']; |
|
33 | - } |
|
34 | - |
|
35 | - public function getHoursAttribute() |
|
36 | - { |
|
37 | - return round($this->minutes / 60, 2); |
|
38 | - } |
|
10 | + protected $guarded = []; |
|
11 | + protected $appends = [ |
|
12 | + 'startTime', |
|
13 | + ]; |
|
14 | + |
|
15 | + public function getStartTimeAttribute() |
|
16 | + { |
|
17 | + return new Carbon($this->attributes['startTime']); |
|
18 | + } |
|
19 | + |
|
20 | + public function getSessionIdAttribute() |
|
21 | + { |
|
22 | + return str_replace($this->accountId, '', $this->engagementId); |
|
23 | + } |
|
24 | + |
|
25 | + public function getMinutesAttribute() |
|
26 | + { |
|
27 | + return round($this->attributes['duration'] / 60, 2); |
|
28 | + } |
|
29 | + |
|
30 | + public function getSecondsAttribute() |
|
31 | + { |
|
32 | + return $this->attributes['duration']; |
|
33 | + } |
|
34 | + |
|
35 | + public function getHoursAttribute() |
|
36 | + { |
|
37 | + return round($this->minutes / 60, 2); |
|
38 | + } |
|
39 | 39 | } |
@@ -8,67 +8,67 @@ |
||
8 | 8 | |
9 | 9 | class EngagementHistory extends Collection |
10 | 10 | { |
11 | - private $instance; |
|
11 | + private $instance; |
|
12 | 12 | |
13 | - public function __construct(array $models = [], LiveEngageLaravel $instance = null) |
|
14 | - { |
|
15 | - $this->instance = $instance; |
|
13 | + public function __construct(array $models = [], LiveEngageLaravel $instance = null) |
|
14 | + { |
|
15 | + $this->instance = $instance; |
|
16 | 16 | |
17 | - parent::__construct($models); |
|
18 | - } |
|
17 | + parent::__construct($models); |
|
18 | + } |
|
19 | 19 | |
20 | - public function find($engagementID) |
|
21 | - { |
|
22 | - $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
23 | - return $value->info->sessionId == $engagementID; |
|
24 | - }); |
|
20 | + public function find($engagementID) |
|
21 | + { |
|
22 | + $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
23 | + return $value->info->sessionId == $engagementID; |
|
24 | + }); |
|
25 | 25 | |
26 | - return $result->first(); |
|
27 | - } |
|
26 | + return $result->first(); |
|
27 | + } |
|
28 | 28 | |
29 | - public function next() |
|
30 | - { |
|
31 | - if (! $this->instance) { |
|
32 | - return false; |
|
33 | - } |
|
29 | + public function next() |
|
30 | + { |
|
31 | + if (! $this->instance) { |
|
32 | + return false; |
|
33 | + } |
|
34 | 34 | |
35 | - $instance = $this->instance; |
|
35 | + $instance = $this->instance; |
|
36 | 36 | |
37 | - $next = $instance->retrieveHistory($instance->start, $instance->end, $instance->next); |
|
38 | - if (property_exists($next->_metadata, 'next')) { |
|
39 | - $instance->next = $next->_metadata->next->href; |
|
37 | + $next = $instance->retrieveHistory($instance->start, $instance->end, $instance->next); |
|
38 | + if (property_exists($next->_metadata, 'next')) { |
|
39 | + $instance->next = $next->_metadata->next->href; |
|
40 | 40 | |
41 | - $history = []; |
|
42 | - foreach ($next->interactionHistoryRecords as $item) { |
|
43 | - $history[] = new Engagement((array) $item); |
|
44 | - } |
|
41 | + $history = []; |
|
42 | + foreach ($next->interactionHistoryRecords as $item) { |
|
43 | + $history[] = new Engagement((array) $item); |
|
44 | + } |
|
45 | 45 | |
46 | - return $this->merge(new self($history)); |
|
47 | - } else { |
|
48 | - return false; |
|
49 | - } |
|
50 | - } |
|
46 | + return $this->merge(new self($history)); |
|
47 | + } else { |
|
48 | + return false; |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - public function prev() |
|
53 | - { |
|
54 | - if (! $this->instance) { |
|
55 | - return false; |
|
56 | - } |
|
52 | + public function prev() |
|
53 | + { |
|
54 | + if (! $this->instance) { |
|
55 | + return false; |
|
56 | + } |
|
57 | 57 | |
58 | - $instance = $this->instance; |
|
58 | + $instance = $this->instance; |
|
59 | 59 | |
60 | - $prev = $instance->retrieveHistory($instance->start, $instance->end, $instance->prev); |
|
61 | - if (property_exists($prev->_metadata, 'prev')) { |
|
62 | - $instance->prev = $prev->_metadata->prev->href; |
|
60 | + $prev = $instance->retrieveHistory($instance->start, $instance->end, $instance->prev); |
|
61 | + if (property_exists($prev->_metadata, 'prev')) { |
|
62 | + $instance->prev = $prev->_metadata->prev->href; |
|
63 | 63 | |
64 | - $history = []; |
|
65 | - foreach ($next->interactionHistoryRecords as $item) { |
|
66 | - $history[] = new Engagement((array) $item); |
|
67 | - } |
|
64 | + $history = []; |
|
65 | + foreach ($next->interactionHistoryRecords as $item) { |
|
66 | + $history[] = new Engagement((array) $item); |
|
67 | + } |
|
68 | 68 | |
69 | - return $this->merge(new self($history)); |
|
70 | - } else { |
|
71 | - return false; |
|
72 | - } |
|
73 | - } |
|
69 | + return $this->merge(new self($history)); |
|
70 | + } else { |
|
71 | + return false; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function find($engagementID) |
21 | 21 | { |
22 | - $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
22 | + $result = $this->filter(function($value, $key) use ($engagementID) { |
|
23 | 23 | return $value->info->sessionId == $engagementID; |
24 | 24 | }); |
25 | 25 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function next() |
30 | 30 | { |
31 | - if (! $this->instance) { |
|
31 | + if (!$this->instance) { |
|
32 | 32 | return false; |
33 | 33 | } |
34 | 34 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function prev() |
53 | 53 | { |
54 | - if (! $this->instance) { |
|
54 | + if (!$this->instance) { |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 |
@@ -8,67 +8,67 @@ |
||
8 | 8 | |
9 | 9 | class ConversationHistory extends Collection |
10 | 10 | { |
11 | - private $instance; |
|
11 | + private $instance; |
|
12 | 12 | |
13 | - public function __construct(array $models = [], LiveEngageLaravel $instance = null) |
|
14 | - { |
|
15 | - $this->instance = $instance; |
|
13 | + public function __construct(array $models = [], LiveEngageLaravel $instance = null) |
|
14 | + { |
|
15 | + $this->instance = $instance; |
|
16 | 16 | |
17 | - parent::__construct($models); |
|
18 | - } |
|
17 | + parent::__construct($models); |
|
18 | + } |
|
19 | 19 | |
20 | - public function find($engagementID) |
|
21 | - { |
|
22 | - $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
23 | - return $value->info->conversationId == $engagementID; |
|
24 | - }); |
|
20 | + public function find($engagementID) |
|
21 | + { |
|
22 | + $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
23 | + return $value->info->conversationId == $engagementID; |
|
24 | + }); |
|
25 | 25 | |
26 | - return $result->first(); |
|
27 | - } |
|
26 | + return $result->first(); |
|
27 | + } |
|
28 | 28 | |
29 | - public function next() |
|
30 | - { |
|
31 | - if (! $this->instance) { |
|
32 | - return false; |
|
33 | - } |
|
29 | + public function next() |
|
30 | + { |
|
31 | + if (! $this->instance) { |
|
32 | + return false; |
|
33 | + } |
|
34 | 34 | |
35 | - $instance = $this->instance; |
|
35 | + $instance = $this->instance; |
|
36 | 36 | |
37 | - $next = $instance->retrieveMsgHistory($instance->start, $instance->end, $instance->next); |
|
38 | - if (property_exists($next->_metadata, 'next')) { |
|
39 | - $instance->next = $next->_metadata->next->href; |
|
37 | + $next = $instance->retrieveMsgHistory($instance->start, $instance->end, $instance->next); |
|
38 | + if (property_exists($next->_metadata, 'next')) { |
|
39 | + $instance->next = $next->_metadata->next->href; |
|
40 | 40 | |
41 | - $history = []; |
|
42 | - foreach ($next->conversationHistoryRecords as $item) { |
|
43 | - $history[] = new Conversation((array) $item); |
|
44 | - } |
|
41 | + $history = []; |
|
42 | + foreach ($next->conversationHistoryRecords as $item) { |
|
43 | + $history[] = new Conversation((array) $item); |
|
44 | + } |
|
45 | 45 | |
46 | - return $this->merge(new self($history)); |
|
47 | - } else { |
|
48 | - return false; |
|
49 | - } |
|
50 | - } |
|
46 | + return $this->merge(new self($history)); |
|
47 | + } else { |
|
48 | + return false; |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - public function prev() |
|
53 | - { |
|
54 | - if (! $this->instance) { |
|
55 | - return false; |
|
56 | - } |
|
52 | + public function prev() |
|
53 | + { |
|
54 | + if (! $this->instance) { |
|
55 | + return false; |
|
56 | + } |
|
57 | 57 | |
58 | - $instance = $this->instance; |
|
58 | + $instance = $this->instance; |
|
59 | 59 | |
60 | - $prev = $instance->retrieveMsgHistory($instance->start, $instance->end, $instance->prev); |
|
61 | - if (property_exists($prev->_metadata, 'prev')) { |
|
62 | - $instance->prev = $prev->_metadata->prev->href; |
|
60 | + $prev = $instance->retrieveMsgHistory($instance->start, $instance->end, $instance->prev); |
|
61 | + if (property_exists($prev->_metadata, 'prev')) { |
|
62 | + $instance->prev = $prev->_metadata->prev->href; |
|
63 | 63 | |
64 | - $history = []; |
|
65 | - foreach ($next->conversationHistoryRecords as $item) { |
|
66 | - $history[] = new Conversation((array) $item); |
|
67 | - } |
|
64 | + $history = []; |
|
65 | + foreach ($next->conversationHistoryRecords as $item) { |
|
66 | + $history[] = new Conversation((array) $item); |
|
67 | + } |
|
68 | 68 | |
69 | - return $this->merge(new self($history)); |
|
70 | - } else { |
|
71 | - return false; |
|
72 | - } |
|
73 | - } |
|
69 | + return $this->merge(new self($history)); |
|
70 | + } else { |
|
71 | + return false; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function find($engagementID) |
21 | 21 | { |
22 | - $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
22 | + $result = $this->filter(function($value, $key) use ($engagementID) { |
|
23 | 23 | return $value->info->conversationId == $engagementID; |
24 | 24 | }); |
25 | 25 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function next() |
30 | 30 | { |
31 | - if (! $this->instance) { |
|
31 | + if (!$this->instance) { |
|
32 | 32 | return false; |
33 | 33 | } |
34 | 34 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function prev() |
53 | 53 | { |
54 | - if (! $this->instance) { |
|
54 | + if (!$this->instance) { |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 |