Пример #1
0
 public function testSetDefaultValue()
 {
     $nullable = null;
     rawr_set_default_value($nullable, 1);
     $this->assertNotNull($nullable);
     $this->assertEquals(rawr_get_primitive_type($nullable), rawr_integer);
     $this->assertEquals($nullable, 1);
 }
Пример #2
0
 public function __construct($value = NULL)
 {
     rawr_set_default_value($value, 0);
     if (!is_numeric($value)) {
         $type = rawr_get_primitive_type($value);
         throw new \Exception("[rawr-core] [{$type}] is not a number");
     }
     $this->value = (int) $value;
 }
Пример #3
0
 public function __construct($value = NULL)
 {
     rawr_set_default_value($value, function () {
     });
     if (!is_callable($value)) {
         $type = rawr_get_primitive_type($value);
         throw new \Exception("[rawr-core] [{$type}] is not callable");
     }
     $arguments = func_get_args();
     array_shift($arguments);
     $this->value = $value;
     $this->reflection = new ReflectionFunction($this->value);
     $this->length = $this->reflection->getNumberOfRequiredParameters();
     $this->args = $arguments;
     $this->remaining_size = $this->length - sizeof($arguments);
 }
Пример #4
0
 public function __construct($value = NULL)
 {
     rawr_set_default_value($value, false);
     $this->value = (bool) $value;
 }