<?php /** * Created by PhpStorm. * User: robin * Date: 5/29/16 * Time: 2:41 PM */ namespace Luticate\Utils\Dbo; use Luticate\Utils\LuBusiness; use Luticate\Utils\LuDbo; class LuBoolDbo extends LuDbo { /** * @var $_value bool */ private $_value; /** * @return bool */ public function getBool() { return $this->_value; } /** * @param bool $value */ public function setBool($value) { $this->_value = $value; } function jsonSerialize() { return $this->_value; } public static function jsonDeserialize($json) { $bool = null; if (is_bool($json)) { $bool = $json; } else if (is_string($json)) { $json = strtolower($json); if ($json == "true" || $json == "false") { $bool = ($json == "true"); } } if (is_null($bool)) { throw new LuDboDeserializeException("Invalid bool value"); } $val = new self(); $val->setBool($bool); return $val; } public static function generateSample() { return true; } }