functions and classes added.

This commit is contained in:
2025-03-20 18:27:17 -07:00
parent 0c41ca9b65
commit 28513d367d
8 changed files with 250 additions and 72 deletions

25
src/Post.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
class Post {
private $data = [];
public function __construct($post) {
$this->sanitize($post);
}
private function sanitize($post) {
foreach ($post as $key => $value) {
$this->data[$key] = is_array($value)
? filter_var_array($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS)
: filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
}
}
public function get($key, $default = null) {
return $this->data[$key] ?? $default;
}
public function all() {
return $this->data;
}
}