aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Parsers/IntegerParser.php6
-rw-r--r--src/Parsers/StringParser.php10
2 files changed, 6 insertions, 10 deletions
diff --git a/src/Parsers/IntegerParser.php b/src/Parsers/IntegerParser.php
index 95df2dd..3eb4ea1 100644
--- a/src/Parsers/IntegerParser.php
+++ b/src/Parsers/IntegerParser.php
@@ -28,9 +28,9 @@ final class IntegerParser {
/**
* @param mixed $value
*
- * @return int|null
+ * @return int
*/
- public static function get($value): ?int {
- return filter_var($value, FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
+ public static function get($value): int {
+ return filter_var($value, FILTER_VALIDATE_INT);
}
}
diff --git a/src/Parsers/StringParser.php b/src/Parsers/StringParser.php
index 1bc7a60..c22d8f1 100644
--- a/src/Parsers/StringParser.php
+++ b/src/Parsers/StringParser.php
@@ -19,8 +19,6 @@ declare(strict_types = 1);
namespace EPGService\Parsers;
-use function is_string;
-
/**
* @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link>
* @license http://www.apache.org/licenses/LICENSE-2.0
@@ -30,11 +28,9 @@ final class StringParser {
/**
* @param $value
*
- * @return string|null
+ * @return string
*/
- public static function get($value): ?string {
- $result = filter_var($value, FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE);
-
- return is_string($result) ? trim($result) : null;
+ public static function get($value): string {
+ return filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
}
}