Skip to content

Commit

Permalink
Merge pull request #9 from botman/analysis-zeoGEA
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
mpociot authored Oct 29, 2017
2 parents 430de1a + 70f6d75 commit dc88896
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Commands/Tinker.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ public function handle()

$loop->run();
}
}
}
10 changes: 6 additions & 4 deletions src/Drivers/ConsoleDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ConsoleDriver implements DriverInterface
/** @var string */
protected $bot_id;

/** @var boolean */
/** @var bool */
protected $hasQuestion = false;

/** @var array */
Expand Down Expand Up @@ -75,15 +75,17 @@ public function matchesRequest()
*/
public function getConversationAnswer(IncomingMessage $message)
{
$index = (int)$message->getText() - 1;
$index = (int) $message->getText() - 1;

if ($this->hasQuestion && isset($this->lastQuestions[$index])) {
$question = $this->lastQuestions[$index];

return Answer::create($question['name'])
->setInteractiveReply(true)
->setValue($question['value'])
->setMessage($message);
}

return Answer::create($this->message)->setMessage($message);
}

Expand Down Expand Up @@ -163,9 +165,9 @@ public function sendPayload($payload)
$questionData = $payload['questionData'];
$this->client->writeln(self::BOT_NAME.': '.$payload['text']);

if (!is_null($questionData)) {
if (! is_null($questionData)) {
foreach ($questionData['actions'] as $key => $action) {
$this->client->writeln(($key+1).') '.$action['text']);
$this->client->writeln(($key + 1).') '.$action['text']);
}
$this->hasQuestion = true;
$this->lastQuestions = $questionData['actions'];
Expand Down
7 changes: 3 additions & 4 deletions src/TinkerServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<?php

namespace BotMan\Tinker;

use BotMan\Tinker\Commands\Tinker;
use Illuminate\Support\ServiceProvider;

class TinkerServiceProvider extends ServiceProvider
{

public function register()
{
$this->commands([
Tinker::class
Tinker::class,
]);
}

}
}

0 comments on commit dc88896

Please sign in to comment.