Skip to content

Commit 707cfae

Browse files
authored
Merge pull request #189 from line/minor_fixes
Add and fix comments, variable names, typos and coding styles
2 parents e151509 + 9a444fc commit 707cfae

File tree

69 files changed

+328
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+328
-214
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"require": {
3030
"php": ">=5.5",
3131
"ext-curl": "*",
32-
"ext-json": "*"
32+
"ext-json": "*",
33+
"ext-sockets": "*",
34+
"ext-posix": "*"
3335
},
3436
"require-dev": {
3537
"phpunit/phpunit": "^4.8.24||^5||^6",

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/AccountLinkEventHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class AccountLinkEventHandler
3232

3333
/**
3434
* BeaconEventHandler constructor.
35+
*
3536
* @param LINEBot $bot
3637
* @param \Monolog\Logger $logger
3738
* @param AccountLinkEvent $accountLinkEvent
@@ -43,6 +44,9 @@ public function __construct($bot, $logger, AccountLinkEvent $accountLinkEvent)
4344
$this->accountLinkEvent = $accountLinkEvent;
4445
}
4546

47+
/**
48+
* @throws \ReflectionException
49+
*/
4650
public function handle()
4751
{
4852
$this->bot->replyText(

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/BeaconEventHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public function __construct($bot, $logger, BeaconDetectionEvent $beaconEvent)
4444
$this->beaconEvent = $beaconEvent;
4545
}
4646

47+
/**
48+
* @throws \ReflectionException
49+
*/
4750
public function handle()
4851
{
4952
$this->bot->replyText(

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/FollowEventHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public function __construct($bot, $logger, FollowEvent $followEvent)
4444
$this->followEvent = $followEvent;
4545
}
4646

47+
/**
48+
* @throws \ReflectionException
49+
*/
4750
public function handle()
4851
{
4952
$this->bot->replyText($this->followEvent->getReplyToken(), 'Got followed event');

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/JoinEventHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public function __construct($bot, $logger, JoinEvent $joinEvent)
4444
$this->joinEvent = $joinEvent;
4545
}
4646

47+
/**
48+
* @throws LINEBot\Exception\InvalidEventSourceException
49+
* @throws \ReflectionException
50+
*/
4751
public function handle()
4852
{
4953
if ($this->joinEvent->isGroupEvent()) {

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/MessageHandler/AudioMessageHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public function handle()
5555
$contentId = $this->audioMessage->getMessageId();
5656
$audio = $this->bot->getMessageContent($contentId)->getRawBody();
5757

58-
$tmpfilePath = tempnam($_SERVER['DOCUMENT_ROOT'] . '/static/tmpdir', 'audio-');
59-
unlink($tmpfilePath);
60-
$filePath = $tmpfilePath . '.mp4';
58+
$tempFilePath = tempnam($_SERVER['DOCUMENT_ROOT'] . '/static/tmpdir', 'audio-');
59+
unlink($tempFilePath);
60+
$filePath = $tempFilePath . '.mp4';
6161
$filename = basename($filePath);
6262

6363
$fh = fopen($filePath, 'x');

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/MessageHandler/Flex/FlexSampleRestaurant.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
use LINE\LINEBot\MessageBuilder\Flex\ComponentBuilder\TextComponentBuilder;
4141
use LINE\LINEBot\MessageBuilder\Flex\ContainerBuilder\BubbleContainerBuilder;
4242

43+
/**
44+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
45+
*/
4346
class FlexSampleRestaurant
4447
{
4548
/**

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/MessageHandler/Flex/FlexSampleShopping.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
use LINE\LINEBot\MessageBuilder\Flex\ContainerBuilder\BubbleContainerBuilder;
3838
use LINE\LINEBot\MessageBuilder\Flex\ContainerBuilder\CarouselContainerBuilder;
3939

40+
/**
41+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
42+
*/
4043
class FlexSampleShopping
4144
{
4245
private static $items = [

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/MessageHandler/ImageMessageHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public function handle()
5555
$contentId = $this->imageMessage->getMessageId();
5656
$image = $this->bot->getMessageContent($contentId)->getRawBody();
5757

58-
$tmpfilePath = tempnam($_SERVER['DOCUMENT_ROOT'] . '/static/tmpdir', 'image-');
59-
unlink($tmpfilePath);
60-
$filePath = $tmpfilePath . '.jpg';
58+
$tempFilePath = tempnam($_SERVER['DOCUMENT_ROOT'] . '/static/tmpdir', 'image-');
59+
unlink($tempFilePath);
60+
$filePath = $tempFilePath . '.jpg';
6161
$filename = basename($filePath);
6262

6363
$fh = fopen($filePath, 'x');

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/MessageHandler/TextMessageHandler.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
use LINE\LINEBot\MessageBuilder\TemplateBuilder\CarouselTemplateBuilder;
4646
use LINE\LINEBot\MessageBuilder\TemplateBuilder\ConfirmTemplateBuilder;
4747

48+
/**
49+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
50+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
51+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
52+
*/
4853
class TextMessageHandler implements EventHandler
4954
{
5055
/** @var LINEBot $bot */
@@ -71,6 +76,10 @@ public function __construct($bot, $logger, \Slim\Http\Request $req, TextMessage
7176
$this->textMessage = $textMessage;
7277
}
7378

79+
/**
80+
* @throws LINEBot\Exception\InvalidEventSourceException
81+
* @throws \ReflectionException
82+
*/
7483
public function handle()
7584
{
7685
$text = $this->textMessage->getText();
@@ -204,13 +213,19 @@ public function handle()
204213
/**
205214
* @param string $replyToken
206215
* @param string $text
216+
* @throws \ReflectionException
207217
*/
208218
private function echoBack($replyToken, $text)
209219
{
210220
$this->logger->info("Returns echo message $replyToken: $text");
211221
$this->bot->replyText($replyToken, $text);
212222
}
213223

224+
/**
225+
* @param $replyToken
226+
* @param $userId
227+
* @throws \ReflectionException
228+
*/
214229
private function sendProfile($replyToken, $userId)
215230
{
216231
if (!isset($userId)) {

0 commit comments

Comments
 (0)