You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.2 KiB
66 lines
1.2 KiB
<?php
|
|
//垃圾分类
|
|
class Garbage implements JsonSerializable
|
|
{
|
|
private $name;
|
|
private $category;
|
|
private $create_at;
|
|
private $update_at;
|
|
|
|
/**
|
|
* Garbage constructor.
|
|
* @param $name
|
|
* @param $category
|
|
* @param $create_at
|
|
* @param $update_at
|
|
*/
|
|
public function __construct($name, $category, $create_at, $update_at)
|
|
{
|
|
$this->name = $name;
|
|
$this->category = $category;
|
|
$this->create_at = $create_at;
|
|
$this->update_at = $update_at;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getCategory()
|
|
{
|
|
return $this->category;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getCreateAt()
|
|
{
|
|
return $this->create_at;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getUpdateAt()
|
|
{
|
|
return $this->update_at;
|
|
}
|
|
|
|
public function jsonSerialize()
|
|
{
|
|
$data = [];
|
|
foreach ($this as $key => $val) {
|
|
if ($val !== null) $data[$key] = $val;
|
|
}
|
|
return $data;
|
|
}
|
|
|
|
} |