Skip to content

Commit 2f09bd7

Browse files
committed
Update PHPDoc
1 parent fe990a6 commit 2f09bd7

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

src/BaseFilter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@
99
abstract class BaseFilter
1010
{
1111
/**
12+
* Payloads
13+
*
1214
* @var array
1315
*/
1416
protected $payloads = array();
1517

1618
/**
19+
* Payload filename
20+
*
1721
* @var string
1822
*/
1923
protected $payloads_file = "";

src/Filter/CRLF.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
class CRLF extends BaseFilter
1212
{
1313
/**
14+
* Payload filename
15+
*
1416
* @var string
1517
*/
1618
protected $payloads_file = "crlf.txt";

src/Filter/SQL.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
class SQL extends BaseFilter
1212
{
1313
/**
14+
* Payload filename
15+
*
1416
* @var string
1517
*/
1618
protected $payloads_file = "sql.txt";

src/Filter/XML.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
class XML extends BaseFilter
1212
{
1313
/**
14+
* Payload filename
15+
*
1416
* @var string
1517
*/
1618
protected $payloads_file = "xml.txt";

src/Filter/XSS.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
class XSS extends BaseFilter
1212
{
1313
/**
14+
* Payload filename
15+
*
1416
* @var string
1517
*/
1618
protected $payloads_file = "xss.txt";

src/Firewall.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ public function disable(string $filter): Firewall
186186
* @param string $value
187187
* @param string $filter
188188
* @return Firewall
189+
* @throws \Exception
189190
*/
190191
public function handle(string $value, string $filter): Firewall
191192
{
@@ -212,21 +213,34 @@ public function handle(string $value, string $filter): Firewall
212213
}
213214

214215
/**
215-
* Runs a given filter
216+
* Get filter's instance
216217
*
217218
* @param string $filter
218-
* @return Firewall
219+
* @return BaseFilter
219220
* @throws \Exception
220221
*/
221-
public function runFilter(string $filter): Firewall
222+
public function getFilterInstance(string $filter): BaseFilter
222223
{
223224
if (!array_key_exists($filter, $this->getFilters()))
224225
{
225226
throw new \Exception("Unknown filter {$filter}.");
226227
}
227228

228229
$class = "PhpWaf\\Filter\\$filter";
229-
$instance = new $class;
230+
231+
return new $class;
232+
}
233+
234+
/**
235+
* Runs a given filter
236+
*
237+
* @param string $filter
238+
* @return Firewall
239+
* @throws \Exception
240+
*/
241+
public function runFilter(string $filter): Firewall
242+
{
243+
$instance = $this->getFilterInstance($filter);
230244

231245
foreach ($_GET as $key => $val)
232246
{

0 commit comments

Comments
 (0)