/**
  * 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;
 }
 /**
  * Use the `ValueType::NUMERIC_AS_STRING` flag to allow numeric values as strings
  *
  * @param   string  $value
  * @param   int     $flag   A flag used by the `ValueType::getType()` method
  * @throws  \ReflectionException if the parameter is not a string
  */
 public function __construct($value, $flag = ValueType::MODE_STRICT)
 {
     if (!ValueType::isString($value) && !is_numeric($value)) {
         throw new \ReflectionException(sprintf(__METHOD__ . ' expects parameter one to be string, %s given', gettype($value)));
     }
     $this->setReadOnlyProperties($this::$_read_only);
     $this->type = ValueType::TYPE_STRING;
     $this->value = (string) $value;
     $this->length = strlen($value);
 }
 /**
  * @param   callable   $value
  * @param   int         $flag   A flag used by the `ValueType::getType()` method (not used here)
  * @throws  \ReflectionException if the parameter is not a closure
  */
 public function __construct($value, $flag = ValueType::MODE_STRICT)
 {
     if (!ValueType::isCallable($value)) {
         throw new \ReflectionException(sprintf(__METHOD__ . ' expects parameter one to be callable, %s given', gettype($value)));
     }
     parent::__construct($value, $flag);
     $this->value_type = ValueType::TYPE_CALLBACK;
     $this->callback = $this->value;
     $this->callback_type = ValueType::getCallbackType($this->callback);
 }
 /**
  * @param   array   $value
  * @param   int         $flag   A flag used by the `ValueType::getType()` method (not used here)
  * @throws  \ReflectionException if the parameter is not an array
  */
 public function __construct($value, $flag = ValueType::MODE_STRICT)
 {
     if (!ValueType::isArray($value)) {
         throw new \ReflectionException(sprintf(__METHOD__ . ' expects parameter one to be array, %s given', gettype($value)));
     }
     $this->setReadOnlyProperties($this::$_read_only);
     $this->type = ValueType::TYPE_ARRAY;
     $this->value = $value;
     $this->length = count($value);
 }
 /**
  * @param   resource $value
  * @param   int      $flag   A flag used by the `ValueType::getType()` method (not used here)
  * @throws  \ReflectionException if the parameter is not a resource
  */
 public function __construct($value, $flag = ValueType::MODE_STRICT)
 {
     if (!ValueType::isResource($value)) {
         throw new \ReflectionException(sprintf(__METHOD__ . ' expects parameter one to be resource, %s given', gettype($value)));
     }
     $this->setReadOnlyProperties($this::$_read_only);
     $this->type = ValueType::TYPE_RESOURCE;
     $this->value = $value;
     $this->resource_type = get_resource_type($value);
 }