Skip to content

Commit 2e88f1a

Browse files
authored
Apply fixes from StyleCI (#1)
1 parent 7fc051a commit 2e88f1a

File tree

3 files changed

+38
-31
lines changed

3 files changed

+38
-31
lines changed

src/HangoutsDriver.php

+29-22
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
namespace BotMan\Drivers\Hangouts;
44

5-
use BotMan\BotMan\Users\User;
6-
use Illuminate\Support\Collection;
5+
use BotMan\BotMan\Drivers\Events\GenericEvent;
76
use BotMan\BotMan\Drivers\HttpDriver;
7+
use BotMan\BotMan\Messages\Attachments\Image;
88
use BotMan\BotMan\Messages\Incoming\Answer;
9+
use BotMan\BotMan\Messages\Incoming\IncomingMessage;
10+
use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;
911
use BotMan\BotMan\Messages\Outgoing\Question;
12+
use BotMan\BotMan\Users\User;
13+
use Illuminate\Support\Collection;
14+
use Symfony\Component\HttpFoundation\JsonResponse;
15+
use Symfony\Component\HttpFoundation\ParameterBag;
1016
use Symfony\Component\HttpFoundation\Request;
11-
use BotMan\BotMan\Messages\Attachments\Image;
1217
use Symfony\Component\HttpFoundation\Response;
13-
use BotMan\BotMan\Drivers\Events\GenericEvent;
14-
use Symfony\Component\HttpFoundation\ParameterBag;
15-
use Symfony\Component\HttpFoundation\JsonResponse;
16-
use BotMan\BotMan\Messages\Incoming\IncomingMessage;
17-
use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;
1818

1919
class HangoutsDriver extends HttpDriver
2020
{
@@ -24,6 +24,7 @@ class HangoutsDriver extends HttpDriver
2424

2525
/**
2626
* @param Request $request
27+
*
2728
* @return void
2829
*/
2930
public function buildPayload(Request $request)
@@ -96,12 +97,14 @@ protected function loadMessages()
9697
*/
9798
public function isConfigured()
9899
{
99-
return ! empty($this->config->get('token'));
100+
return !empty($this->config->get('token'));
100101
}
101102

102103
/**
103104
* Retrieve User information.
105+
*
104106
* @param \BotMan\BotMan\Messages\Incoming\IncomingMessage $matchingMessage
107+
*
105108
* @return User
106109
*/
107110
public function getUser(IncomingMessage $matchingMessage)
@@ -115,6 +118,7 @@ public function getUser(IncomingMessage $matchingMessage)
115118

116119
/**
117120
* @param \BotMan\BotMan\Messages\Incoming\IncomingMessage $message
121+
*
118122
* @return Answer
119123
*/
120124
public function getConversationAnswer(IncomingMessage $message)
@@ -124,35 +128,36 @@ public function getConversationAnswer(IncomingMessage $message)
124128

125129
/**
126130
* @param OutgoingMessage|\BotMan\BotMan\Messages\Outgoing\Question $message
127-
* @param \BotMan\BotMan\Messages\Incoming\IncomingMessage $matchingMessage
128-
* @param array $additionalParameters
131+
* @param \BotMan\BotMan\Messages\Incoming\IncomingMessage $matchingMessage
132+
* @param array $additionalParameters
133+
*
129134
* @return array
130135
*/
131136
public function buildServicePayload($message, $matchingMessage, $additionalParameters = [])
132137
{
133138
$payload = [
134-
'text' => '',
139+
'text' => '',
135140
'cards' => [
136141
[
137142
'sections' => [
138143
[
139-
'widgets' => []
140-
]
141-
]
142-
]
143-
]
144+
'widgets' => [],
145+
],
146+
],
147+
],
148+
],
144149
];
145150
if ($message instanceof OutgoingMessage) {
146151
$text = $message->getText();
147152

148153
$payload['text'] = $text;
149154

150155
$attachment = $message->getAttachment();
151-
if (! is_null($attachment) && $attachment instanceof Image) {
156+
if (!is_null($attachment) && $attachment instanceof Image) {
152157
$payload['cards'][0]['sections'][0]['widgets'][] = [
153158
'image' => [
154-
'imageUrl' => $attachment->getUrl()
155-
]
159+
'imageUrl' => $attachment->getUrl(),
160+
],
156161
];
157162
}
158163
} elseif ($message instanceof Question) {
@@ -164,6 +169,7 @@ public function buildServicePayload($message, $matchingMessage, $additionalParam
164169

165170
/**
166171
* @param mixed $payload
172+
*
167173
* @return Response
168174
*/
169175
public function sendPayload($payload)
@@ -174,9 +180,10 @@ public function sendPayload($payload)
174180
/**
175181
* Low-level method to perform driver specific API requests.
176182
*
177-
* @param string $endpoint
178-
* @param array $parameters
183+
* @param string $endpoint
184+
* @param array $parameters
179185
* @param \BotMan\BotMan\Messages\Incoming\IncomingMessage $matchingMessage
186+
*
180187
* @return void
181188
*/
182189
public function sendRequest($endpoint, array $parameters, IncomingMessage $matchingMessage)

src/Providers/HangoutsServiceProvider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace BotMan\Drivers\Hangouts\Providers;
44

5-
use Illuminate\Support\ServiceProvider;
65
use BotMan\BotMan\Drivers\DriverManager;
76
use BotMan\Drivers\Hangouts\HangoutsDriver;
87
use BotMan\Studio\Providers\StudioServiceProvider;
8+
use Illuminate\Support\ServiceProvider;
99

1010
class HangoutsServiceProvider extends ServiceProvider
1111
{
@@ -16,7 +16,7 @@ class HangoutsServiceProvider extends ServiceProvider
1616
*/
1717
public function boot()
1818
{
19-
if (! $this->isRunningInBotManStudio()) {
19+
if (!$this->isRunningInBotManStudio()) {
2020
$this->loadDrivers();
2121

2222
$this->publishes([

tests/HangoutsDriverTest.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace Tests;
44

5+
use BotMan\BotMan\Http\Curl;
56
use BotMan\BotMan\Messages\Attachments\Image;
67
use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;
8+
use BotMan\Drivers\Hangouts\HangoutsDriver;
79
use Mockery as m;
8-
use BotMan\BotMan\Http\Curl;
910
use PHPUnit_Framework_TestCase;
10-
use BotMan\Drivers\Hangouts\HangoutsDriver;
1111
use Symfony\Component\HttpFoundation\Request;
1212

1313
class HangoutsDriverTest extends PHPUnit_Framework_TestCase
@@ -22,7 +22,7 @@ public function tearDown()
2222
private function getValidDriver($fixture = 'dm', $config = null)
2323
{
2424
$config = $config ?? [
25-
'token' => self::TEST_TOKEN
25+
'token' => self::TEST_TOKEN,
2626
];
2727

2828
$request = m::mock(Request::class.'[getContent]');
@@ -87,15 +87,15 @@ public function it_returns_the_message_text()
8787
public function it_strips_annotations()
8888
{
8989
$driver = $this->getValidDriver('annotation', [
90-
'token' => self::TEST_TOKEN,
91-
'strip_annotations' => false
90+
'token' => self::TEST_TOKEN,
91+
'strip_annotations' => false,
9292
]);
9393

9494
$this->assertSame('hey @botman hi', $driver->getMessages()[0]->getText());
9595

9696
$driver = $this->getValidDriver('annotation', [
97-
'token' => self::TEST_TOKEN,
98-
'strip_annotations' => true
97+
'token' => self::TEST_TOKEN,
98+
'strip_annotations' => true,
9999
]);
100100

101101
$this->assertSame('hi', $driver->getMessages()[0]->getText());

0 commit comments

Comments
 (0)