@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * Message of the user |
17 | 17 | * @param string $userName |
18 | 18 | * Name of the user who speak to the bot |
19 | - * @param long|\DateTime|string $dateTime |
|
19 | + * @param integer $dateTime |
|
20 | 20 | * Date when the message had been posted. Unix timestamp or \DateTime or string representing \DateTime are accepted. Current date by default. |
21 | 21 | * @return boolean |
22 | 22 | */ |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * Message of the user |
30 | 30 | * @param string $userName |
31 | 31 | * Name of the user who speak to the bot |
32 | - * @param long|\DateTime|string $dateTime |
|
32 | + * @param integer $dateTime |
|
33 | 33 | * Date when the message had been posted. Unix timestamp or \DateTime or string representing \DateTime are accepted. Current date by default. |
34 | 34 | * @return array($botName, $botMessage) |
35 | 35 | */ |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Monolog\Logger; |
5 | 5 | use Posibrain\Positron\Positron; |
6 | -use Posibrain\TchatBotConfig; |
|
7 | 6 | use Posibrain\AnalysedRequest; |
8 | 7 | use Posibrain\TchatMessage; |
9 | 8 |
@@ -128,6 +128,9 @@ |
||
128 | 128 | file_put_contents($filepath, $jsonData); |
129 | 129 | } |
130 | 130 | |
131 | + /** |
|
132 | + * @param string $synonymKey |
|
133 | + */ |
|
131 | 134 | private function getSynonyms($synonymKey, $synonymList) |
132 | 135 | { |
133 | 136 | foreach ($synonymList as $synonym) { |
@@ -141,6 +141,9 @@ discard block |
||
141 | 141 | return $currentAnswer; |
142 | 142 | } |
143 | 143 | |
144 | + /** |
|
145 | + * @param string $userName |
|
146 | + */ |
|
144 | 147 | private function findBestPriorityKeyword($userName, $message) |
145 | 148 | { |
146 | 149 | $bestPriority = - 1; |
@@ -160,6 +163,9 @@ discard block |
||
160 | 163 | return $matchingKeywordItem; |
161 | 164 | } |
162 | 165 | |
166 | + /** |
|
167 | + * @param string $userName |
|
168 | + */ |
|
163 | 169 | private function findBestVariance($userName, $message, $keyword) |
164 | 170 | { |
165 | 171 | // Verify |
@@ -192,6 +198,9 @@ discard block |
||
192 | 198 | return $matchingVarianceItem; |
193 | 199 | } |
194 | 200 | |
201 | + /** |
|
202 | + * @param string $userName |
|
203 | + */ |
|
195 | 204 | private function pickResponse($userName, $userMessage, $varianceItem) |
196 | 205 | { |
197 | 206 | // Verify |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Monolog\Logger; |
5 | 5 | use Posibrain\Positron\Positron; |
6 | -use Posibrain\TchatBotConfig; |
|
7 | 6 | use Posibrain\AnalysedRequest; |
8 | 7 | use Posibrain\TchatMessage; |
9 | 8 |
@@ -1,8 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Posibrain; |
3 | 3 | |
4 | -use Seld\JsonLint\JsonParser; |
|
5 | -use Seld\JsonLint\ParsingException; |
|
6 | 4 | use Monolog\Logger; |
7 | 5 | include_once (__DIR__ . '/../tools.php'); |
8 | 6 |
@@ -6,7 +6,6 @@ |
||
6 | 6 | use Monolog\Handler\RotatingFileHandler; |
7 | 7 | use Monolog\Logger; |
8 | 8 | use Symfony\Component\HttpFoundation\Request; |
9 | -use Symfony\Component\HttpFoundation\Response; |
|
10 | 9 | use Symfony\Component\HttpFoundation\JsonResponse; |
11 | 10 | |
12 | 11 | /** |
@@ -136,6 +136,9 @@ discard block |
||
136 | 136 | return $this->instinctPath . $this->id . '/identity.json'; |
137 | 137 | } |
138 | 138 | |
139 | + /** |
|
140 | + * @param string $identityPath |
|
141 | + */ |
|
139 | 142 | private function loadIdentity($identityPath) |
140 | 143 | { |
141 | 144 | if (! is_file($identityPath)) { |
@@ -289,7 +292,7 @@ discard block |
||
289 | 292 | |
290 | 293 | /** |
291 | 294 | * |
292 | - * @return DateTime |
|
295 | + * @return \DateTime |
|
293 | 296 | */ |
294 | 297 | public function getBirthday() |
295 | 298 | { |
@@ -307,7 +310,7 @@ discard block |
||
307 | 310 | |
308 | 311 | /** |
309 | 312 | * |
310 | - * @return DateTimeZone |
|
313 | + * @return \DateTimeZone |
|
311 | 314 | */ |
312 | 315 | public function getTimezone() |
313 | 316 | { |
@@ -2,7 +2,6 @@ |
||
2 | 2 | namespace Posibrain; |
3 | 3 | |
4 | 4 | use Monolog\Logger; |
5 | -use Monolog\Handler\StreamHandler; |
|
6 | 5 | use Posibrain\OutputDecorationEnum; |
7 | 6 | |
8 | 7 | /** |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param $email Email |
36 | 36 | * à tester |
37 | - * @return true si c'est un email |
|
38 | - * @return false sinon |
|
37 | + * @return integer si c'est un email |
|
38 | + * @return integer sinon |
|
39 | 39 | */ |
40 | 40 | function isEmailValide($email) |
41 | 41 | { |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param $tel tel |
49 | 49 | * à tester |
50 | - * @return true si c'est un tel |
|
51 | - * @return false sinon |
|
50 | + * @return integer si c'est un tel |
|
51 | + * @return integer sinon |
|
52 | 52 | */ |
53 | 53 | function isTelValide($tel) |
54 | 54 | { |
@@ -56,6 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | // Transforme le numéro du mois en son nom en français |
59 | +/** |
|
60 | + * @param string $numMois |
|
61 | + */ |
|
59 | 62 | function nomMois($numMois) |
60 | 63 | { |
61 | 64 | switch ($numMois) { |
@@ -160,6 +163,7 @@ discard block |
||
160 | 163 | |
161 | 164 | /** |
162 | 165 | * Formate une date en fonction de la date actuelle |
166 | + * @param integer $timestamp |
|
163 | 167 | */ |
164 | 168 | function dateFr($timestamp, $heure = false, $le = true) |
165 | 169 | { |
@@ -197,7 +201,7 @@ discard block |
||
197 | 201 | * Formate la date d'un événement |
198 | 202 | * |
199 | 203 | * @param $timestamp Timestamp |
200 | - * @return La date formatée |
|
204 | + * @return string date formatée |
|
201 | 205 | */ |
202 | 206 | function afficherDateEvenement($timestamp) |
203 | 207 | { |
@@ -334,7 +338,7 @@ discard block |
||
334 | 338 | * @param string $dossierOuChercher) |
335 | 339 | * @param string $nomImage |
336 | 340 | * (sans extension) |
337 | - * @return Url de l'image si elle existe, vide sinon |
|
341 | + * @return string de l'image si elle existe, vide sinon |
|
338 | 342 | */ |
339 | 343 | function isImage($dossierOuChercher, $nomImage) |
340 | 344 | { |
@@ -449,11 +453,18 @@ discard block |
||
449 | 453 | echo '</pre><br />'; |
450 | 454 | } |
451 | 455 | |
456 | +/** |
|
457 | + * @param string $needle |
|
458 | + * @param string $haystack |
|
459 | + */ |
|
452 | 460 | function startsWith($needle, $haystack) |
453 | 461 | { |
454 | 462 | return ! strncmp($haystack, $needle, strlen($needle)); |
455 | 463 | } |
456 | 464 | |
465 | +/** |
|
466 | + * @param string $needle |
|
467 | + */ |
|
457 | 468 | function endsWith($needle, $haystack) |
458 | 469 | { |
459 | 470 | $length = strlen($needle); |