コード例 #1
0
 /**
  * @param   object  $value
  * @param   int     $flag   A flag used by the `ValueType::getType()` method (not used here)
  */
 public function __construct($value, $flag = ValueType::MODE_STRICT)
 {
     parent::__construct($value, $flag);
     $this->setReadOnlyProperties($this::$_read_only);
     $this->type = ValueType::TYPE_OBJECT;
     $this->value = $value;
 }
コード例 #2
0
 /**
  * @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);
 }