value = $value; if (empty($description)) { $this->description = $this->value; } else { $this->description = $description; } } /** * @return string */ public function getValue() { return $this->value; } /** * @return string */ public function getDescription() { return $this->description; } /** * @return string */ public function __toString() { return sprintf('%s:%s', $this->getDescription(), $this->getValue()); } /** * Specify data which should be serialized to JSON * * @return mixed data which can be serialized by json_encode, */ public function jsonSerialize() { return [$this->getDescription() => $this->getValue()]; } }