functions and classes added.
This commit is contained in:
25
src/Post.php
Normal file
25
src/Post.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user