/** * Use the `ValueType::BINARY_AS_BOOLEAN` flag to allow binaries `0` and `1` as boolean values * * @param bool $value * @param int $flag A flag used by the `ValueType::getType()` method * @throws \ReflectionException if the parameter is not a boolean */ public function __construct($value, $flag = ValueType::MODE_STRICT) { if (!ValueType::isBoolean($value, $flag)) { throw new \ReflectionException(sprintf(__METHOD__ . ' expects parameter one to be boolean, %s given', gettype($value))); } $this->setReadOnlyProperties($this::$_read_only); $this->type = ValueType::TYPE_BOOLEAN; $this->value = (bool) $value; }