getTimestamp() == 0) { $field = null; } } } public function __construct($data) { $class = get_class($this); foreach($data as $key => $val) { if(property_exists($class, $key)) { $this->$key = $val; } } } public function url_slug($text) { $text = strtolower($text); $text = preg_replace('/\b([a-z]{1,3})\b/u', '', $text); $text = preg_replace('/[^\w_\+\s]/', '', $text); $text = preg_replace('/\s+/', '-', $text); return trim(strtolower($text), '-'); } }