Skip to content

Commit 23104e2

Browse files
authored
Merge pull request #42 from crowdsecurity/improve-php-doc2
improve php doc
2 parents abdb266 + a1c58c1 commit 23104e2

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

docs/api/Bouncer.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The main Class of this package. This is the first entry point of any PHP Bouncer
1212
|------|-------------|
1313
|[__construct](#bouncer__construct)||
1414
|[buildCaptchaCouple](#bouncerbuildcaptchacouple)|Build a captcha couple.|
15-
|[checkCaptcha](#bouncercheckcaptcha)||
15+
|[checkCaptcha](#bouncercheckcaptcha)|Check if the captcha filled by the user is correct or not.|
1616
|[clearCache](#bouncerclearcache)|This method clear the full data in cache.|
1717
|[configure](#bouncerconfigure)|Configure this instance.|
1818
|[getAccessForbiddenHtmlTemplate](#bouncergetaccessforbiddenhtmltemplate)|Returns a default "CrowdSec 403" HTML template to display to a web browser using a banned IP.|
@@ -82,20 +82,27 @@ Build a captcha couple.
8282
**Description**
8383

8484
```php
85-
checkCaptcha (void)
85+
public checkCaptcha (string $expected, string $expected, string $ip)
8686
```
8787

88-
88+
Check if the captcha filled by the user is correct or not.
8989

90-
90+
We are premissive with the user (0 is interpreted as "o" and 1 in interpretted as "l").
9191

9292
**Parameters**
9393

94-
`This function has no parameters.`
94+
* `(string) $expected`
95+
: The expected phrase
96+
* `(string) $expected`
97+
: The phrase to check (the user input)
98+
* `(string) $ip`
99+
: Th IP of the use (for logging purpose)
95100

96101
**Return Values**
97102

98-
`void`
103+
`bool`
104+
105+
> If the captcha input was correct or not
99106
100107

101108
<hr />

src/Bouncer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,14 @@ public static function buildCaptchaCouple()
227227
}
228228

229229
/**
230+
* Check if the captcha filled by the user is correct or not.
231+
* We are premissive with the user (0 is interpreted as "o" and 1 in interpretted as "l").
232+
*
230233
* @param string $expected The expected phrase
231234
* @param string $expected The phrase to check (the user input)
232235
* @param string $ip Th IP of the use (for logging purpose)
236+
*
237+
* @return bool If the captcha input was correct or not
233238
*/
234239
public function checkCaptcha(string $expected, string $try, string $ip)
235240
{

0 commit comments

Comments
 (0)