Skip to content
This repository was archived by the owner on Aug 12, 2022. It is now read-only.

Commit 615eaea

Browse files
author
Bruno
committed
[UPD]: modif for pull request
1 parent 2dd46ec commit 615eaea

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

src/client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function textRequest($text, $options=null)
3333
{
3434
if ($options === null) {
3535
$token = $this->token;
36-
} else if ($options['token']) {
36+
} else if (array_key_exists($options, 'token')) {
3737
$token = $options['token'];
3838
}
3939

@@ -96,7 +96,7 @@ public function fileRequest($file, $options=null)
9696
{
9797
if ($options === null) {
9898
$token = $this->token;
99-
} else if ($options['token']) {
99+
} else if (array_key_exists($options, 'token')) {
100100
$token = $options['token'];
101101
}
102102

src/conversation.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,43 +39,31 @@ public function replies() {
3939
* @return {String}: the concatenation of the replies
4040
*/
4141
public function joinedReplies($separator=' ') {
42-
if ($this->replies) {
43-
return (join($separator, $this->replies));
44-
}
45-
46-
return (null);
42+
return ($this->replies ? join($separator, $this->replies) : null)
4743
}
4844

4945
/**
5046
* Returns all the action whose name matches the parameter
5147
* @return {Array}: returns an array of action, or null
5248
*/
5349
public function action() {
54-
if ($this->action) {
55-
return ($this->action || null);
56-
}
50+
return ($this->action || null);
5751
}
5852

5953
/**
6054
* Returns the first nextActions whose name matches the parameter
6155
* @return {Array}: returns an array of first nextActions, or null
6256
*/
6357
public function nextAction() {
64-
if ($this->nextActions) {
65-
return ($this->nextActions[0]);
66-
}
67-
68-
return (null);
58+
return (count($this->nextAction) > 0 ? $this->nextAction[0] : []);
6959
}
7060

7161
/**
7262
* Returns all nextActions
7363
* @return {Array}: returns an array of nextActions, or null
7464
*/
7565
public function nextActions() {
76-
if ($this->nextActions) {
77-
return ($this->nextActions || $res = []);
78-
}
66+
return ($this->nextActions || []);
7967
}
8068

8169
/**
@@ -86,7 +74,7 @@ public function nextActions() {
8674
public function memory($name=null) {
8775
if ($name === null) {
8876
return ($this->memory);
89-
} else if ($this->memory->$name) {
77+
} else if (array_key_exists($this->memory, $name)) {
9078
return ($this->memory->$name);
9179
} else {
9280
return (null);

0 commit comments

Comments
 (0)