Skip to content

Commit e07b6e2

Browse files
committed
Fix syntax
1 parent 40b578e commit e07b6e2

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

src/TgUtils/DummyStringFilter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<?php
22

3-
package TgUtils;
3+
namespace TgUtils;
44

55
/**
66
* An interface for not filtering string at all.
77
*/
8-
public class DummyStringFilter implements StringFilter {
8+
class DummyStringFilter implements StringFilter {
99

10-
public static $INSTANCE = new DummyStringFilter();
10+
public static $INSTANCE;
1111

12-
public __construct() {
12+
public function __construct() {
1313
}
1414

1515
/**
1616
* Filters the given string and returns sanitized value.
1717
* @param string $s - string to sanitize (can be null)
1818
* @return the sanitized string.
1919
*/
20-
public filter($s) {
20+
public function filter($s) {
2121
return $s;
2222
}
2323

2424
}
25-
25+
DummyStringFilter::$INSTANCE = new DummyStringFilter();

src/TgUtils/NoHtmlStringFilter.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
<?php
22

3-
package TgUtils;
3+
namespace TgUtils;
44

55
/**
66
* An interface for filter strings from any HTML tags.
77
*/
8-
public class NoHtmlStringFilter implements StringFilter {
8+
class NoHtmlStringFilter implements StringFilter {
99

10-
public static $INSTANCE = new NoHtmlStringFilter();
10+
public static $INSTANCE;
1111

12-
public __construct() {
12+
public function __construct() {
1313
}
1414

1515
/**
1616
* Filters the given string and returns sanitized value.
1717
* @param string $s - string to sanitize (can be null)
1818
* @return the sanitized string.
1919
*/
20-
public filter($s) {
20+
public function filter($s) {
2121
if ($s == NULL) return $s;
2222
return strip_tags($s);
2323
}
2424

2525
}
26+
NoHtmlStringFilter::$INSTANCE = new NoHtmlStringFilter();
2627

src/TgUtils/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function hasGetParam($key) {
193193
*/
194194
public function getGetParam($key, $default = NULL, $filter = NULL) {
195195
$params = $this->getParams;
196-
if ($filter == NULL) $filter = StringFilters::$NO_HTML;
196+
if ($filter == NULL) $filter = NoHtmlStringFilter::$INSTANCE;
197197
return isset($params[$key]) ? $filter->filter($params[$key]) : $default;
198198
}
199199

@@ -223,7 +223,7 @@ public function hasPostParam($key) {
223223
*/
224224
public function getPostParam($key, $default = NULL, $filter = NULL) {
225225
$params = $this->getPostParams();
226-
if ($filter == NULL) $filter = StringFilters::$NO_HTML;
226+
if ($filter == NULL) $filter = NoHtmlStringFilter::$INSTANCE;
227227
return isset($params[$key]) ? $filter->filter($params[$key]) : $default;
228228
}
229229

src/TgUtils/StringFilter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22

3-
package TgUtils;
3+
namespace TgUtils;
44

55
/**
66
* An interface for filter strings from evil input.
77
*/
8-
public interface StringFilter {
8+
interface StringFilter {
99

1010
/**
1111
* Filters the given string and returns sanitized value.
1212
* @param string $s - string to sanitize (can be null)
1313
* @return the sanitized string.
1414
*/
15-
public filter($s);
15+
public function filter($s);
1616

1717
}
1818

0 commit comments

Comments
 (0)