Skip to content

Commit 7de8751

Browse files
author
Kevin Antoine
authored
Merge pull request #204 from shibby/master
refactoring
2 parents b27fb4f + e6b291d commit 7de8751

12 files changed

+93
-75
lines changed

src/IntercomAdmins.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Intercom;
44

5-
class IntercomAdmins {
5+
class IntercomAdmins
6+
{
67

78
/** @var IntercomClient */
89
private $client;
@@ -13,7 +14,7 @@ class IntercomAdmins {
1314
*/
1415
public function __construct($client)
1516
{
16-
$this->client = $client;
17+
$this->client = $client;
1718
}
1819

1920
/**
@@ -25,6 +26,6 @@ public function __construct($client)
2526
*/
2627
public function getAdmins($options = [])
2728
{
28-
return $this->client->get("admins", $options);
29+
return $this->client->get("admins", $options);
2930
}
3031
}

src/IntercomBulk.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Intercom;
44

5-
class IntercomBulk {
5+
class IntercomBulk
6+
{
67

78
/** @var IntercomClient */
89
private $client;
@@ -13,7 +14,7 @@ class IntercomBulk {
1314
*/
1415
public function __construct($client)
1516
{
16-
$this->client = $client;
17+
$this->client = $client;
1718
}
1819

1920
/**
@@ -25,7 +26,7 @@ public function __construct($client)
2526
*/
2627
public function users($options)
2728
{
28-
return $this->client->post("bulk/users", $options);
29+
return $this->client->post("bulk/users", $options);
2930
}
3031

3132
/**
@@ -37,6 +38,6 @@ public function users($options)
3738
*/
3839
public function events($options)
3940
{
40-
return $this->client->post("bulk/events", $options);
41+
return $this->client->post("bulk/events", $options);
4142
}
4243
}

src/IntercomCompanies.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Intercom;
44

5-
class IntercomCompanies {
5+
class IntercomCompanies
6+
{
67

78
/** @var IntercomClient */
89
private $client;
@@ -13,7 +14,7 @@ class IntercomCompanies {
1314
*/
1415
public function __construct($client)
1516
{
16-
$this->client = $client;
17+
$this->client = $client;
1718
}
1819

1920
/**
@@ -25,7 +26,7 @@ public function __construct($client)
2526
*/
2627
public function create($options)
2728
{
28-
return $this->client->post("companies", $options);
29+
return $this->client->post("companies", $options);
2930
}
3031

3132
/**
@@ -35,8 +36,9 @@ public function create($options)
3536
* @return mixed
3637
* @throws \GuzzleHttp\Exception\GuzzleException
3738
*/
38-
public function update($options) {
39-
return $this->create($options);
39+
public function update($options)
40+
{
41+
return $this->create($options);
4042
}
4143

4244
/**
@@ -48,6 +50,6 @@ public function update($options) {
4850
*/
4951
public function getCompanies($options)
5052
{
51-
return $this->client->get("companies", $options);
53+
return $this->client->get("companies", $options);
5254
}
5355
}

src/IntercomConversations.php

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Intercom;
44

5-
class IntercomConversations {
5+
class IntercomConversations
6+
{
67

78
/** @var IntercomClient */
89
private $client;
@@ -13,7 +14,7 @@ class IntercomConversations {
1314
*/
1415
public function __construct($client)
1516
{
16-
$this->client = $client;
17+
$this->client = $client;
1718
}
1819

1920
/**
@@ -25,7 +26,7 @@ public function __construct($client)
2526
*/
2627
public function getConversations($options)
2728
{
28-
return $this->client->get('conversations', $options);
29+
return $this->client->get('conversations', $options);
2930
}
3031

3132
/**
@@ -35,9 +36,10 @@ public function getConversations($options)
3536
* @return mixed
3637
* @throws \GuzzleHttp\Exception\GuzzleException
3738
*/
38-
public function getConversation($id) {
39-
$path = $this->conversationPath($id);
40-
return $this->client->get($path, []);
39+
public function getConversation($id)
40+
{
41+
$path = $this->conversationPath($id);
42+
return $this->client->get($path, []);
4143
}
4244

4345
/**
@@ -48,9 +50,10 @@ public function getConversation($id) {
4850
* @return mixed
4951
* @throws \GuzzleHttp\Exception\GuzzleException
5052
*/
51-
public function replyToConversation($id, $options) {
52-
$path = $this->conversationReplyPath($id);
53-
return $this->client->post($path, $options);
53+
public function replyToConversation($id, $options)
54+
{
55+
$path = $this->conversationReplyPath($id);
56+
return $this->client->post($path, $options);
5457
}
5558

5659
/**
@@ -60,9 +63,10 @@ public function replyToConversation($id, $options) {
6063
* @return mixed
6164
* @throws \GuzzleHttp\Exception\GuzzleException
6265
*/
63-
public function replyToLastConversation($options) {
64-
$path = 'conversations/last/reply';
65-
return $this->client->post($path, $options);
66+
public function replyToLastConversation($options)
67+
{
68+
$path = 'conversations/last/reply';
69+
return $this->client->post($path, $options);
6670
}
6771

6872
/**
@@ -72,10 +76,11 @@ public function replyToLastConversation($options) {
7276
* @return mixed
7377
* @throws \GuzzleHttp\Exception\GuzzleException
7478
*/
75-
public function markConversationAsRead($id) {
76-
$path = $this->conversationPath($id);
77-
$data = ['read' => true];
78-
return $this->client->put($path, $data);
79+
public function markConversationAsRead($id)
80+
{
81+
$path = $this->conversationPath($id);
82+
$data = ['read' => true];
83+
return $this->client->put($path, $data);
7984
}
8085

8186
/**
@@ -85,7 +90,7 @@ public function markConversationAsRead($id) {
8590
*/
8691
public function conversationPath($id)
8792
{
88-
return 'conversations/' . $id;
93+
return 'conversations/' . $id;
8994
}
9095

9196
/**
@@ -95,6 +100,6 @@ public function conversationPath($id)
95100
*/
96101
public function conversationReplyPath($id)
97102
{
98-
return 'conversations/' . $id . '/reply';
103+
return 'conversations/' . $id . '/reply';
99104
}
100105
}

src/IntercomCounts.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Intercom;
44

5-
class IntercomCounts {
5+
class IntercomCounts
6+
{
67

78
/** @var IntercomClient */
89
private $client;
@@ -13,7 +14,7 @@ class IntercomCounts {
1314
*/
1415
public function __construct($client)
1516
{
16-
$this->client = $client;
17+
$this->client = $client;
1718
}
1819

1920
/**
@@ -25,6 +26,6 @@ public function __construct($client)
2526
*/
2627
public function getCounts($options = [])
2728
{
28-
return $this->client->get("counts", $options);
29+
return $this->client->get("counts", $options);
2930
}
3031
}

src/IntercomEvents.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Intercom;
44

5-
class IntercomEvents {
5+
class IntercomEvents
6+
{
67

78
/** @var IntercomClient */
89
private $client;
@@ -13,7 +14,7 @@ class IntercomEvents {
1314
*/
1415
public function __construct($client)
1516
{
16-
$this->client = $client;
17+
$this->client = $client;
1718
}
1819

1920
/**
@@ -25,7 +26,7 @@ public function __construct($client)
2526
*/
2627
public function create($options)
2728
{
28-
return $this->client->post("events", $options);
29+
return $this->client->post("events", $options);
2930
}
3031

3132
/**
@@ -37,6 +38,6 @@ public function create($options)
3738
*/
3839
public function getEvents($options)
3940
{
40-
return $this->client->get("events", array_merge(["type" => "user"], $options));
41+
return $this->client->get("events", array_merge(["type" => "user"], $options));
4142
}
4243
}

src/IntercomLeads.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Intercom;
44

5-
class IntercomLeads {
5+
class IntercomLeads
6+
{
67

78
/** @var IntercomClient */
89
private $client;
@@ -13,7 +14,7 @@ class IntercomLeads {
1314
*/
1415
public function __construct($client)
1516
{
16-
$this->client = $client;
17+
$this->client = $client;
1718
}
1819

1920
/**
@@ -25,7 +26,7 @@ public function __construct($client)
2526
*/
2627
public function create($options)
2728
{
28-
return $this->client->post("contacts", $options);
29+
return $this->client->post("contacts", $options);
2930
}
3031

3132
/**
@@ -37,7 +38,7 @@ public function create($options)
3738
*/
3839
public function update($options)
3940
{
40-
return $this->create($options);
41+
return $this->create($options);
4142
}
4243

4344
/**
@@ -49,7 +50,7 @@ public function update($options)
4950
*/
5051
public function getLeads($options)
5152
{
52-
return $this->client->get("contacts", $options);
53+
return $this->client->get("contacts", $options);
5354
}
5455

5556
/**
@@ -62,8 +63,8 @@ public function getLeads($options)
6263
*/
6364
public function getLead($id, $options = [])
6465
{
65-
$path = $this->leadPath($id);
66-
return $this->client->get($path, $options);
66+
$path = $this->leadPath($id);
67+
return $this->client->get($path, $options);
6768
}
6869

6970
/**
@@ -76,8 +77,8 @@ public function getLead($id, $options = [])
7677
*/
7778
public function deleteLead($id, $options = [])
7879
{
79-
$path = $this->leadPath($id);
80-
return $this->client->delete($path, $options);
80+
$path = $this->leadPath($id);
81+
return $this->client->delete($path, $options);
8182
}
8283

8384
/**
@@ -89,7 +90,7 @@ public function deleteLead($id, $options = [])
8990
*/
9091
public function convertLead($options)
9192
{
92-
return $this->client->post("contacts/convert", $options);
93+
return $this->client->post("contacts/convert", $options);
9394
}
9495

9596
/**
@@ -99,6 +100,6 @@ public function convertLead($options)
99100
*/
100101
public function leadPath($id)
101102
{
102-
return "contacts/" . $id;
103+
return "contacts/" . $id;
103104
}
104105
}

src/IntercomMessages.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Intercom;
44

5-
class IntercomMessages {
5+
class IntercomMessages
6+
{
67

78
/** @var IntercomClient */
89
private $client;
@@ -13,7 +14,7 @@ class IntercomMessages {
1314
*/
1415
public function __construct($client)
1516
{
16-
$this->client = $client;
17+
$this->client = $client;
1718
}
1819

1920
/**
@@ -25,6 +26,6 @@ public function __construct($client)
2526
*/
2627
public function create($options)
2728
{
28-
return $this->client->post("messages", $options);
29+
return $this->client->post("messages", $options);
2930
}
3031
}

0 commit comments

Comments
 (0)