Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final public function __construct($default = self::__default)
- {
- $this->__reflectionBase = new ReflectionClass(__CLASS__);
- //$this->__reflectionClass = new ReflectionClass($this->getQualifiedName());
- $this->__reflectionClass = new ReflectionClass(get_class($this));
- $this->__constantsBase = $this->__reflectionBase->getConstants();
- $this->__constantsClass = $this->__reflectionClass->getConstants();
- var_dump($this->__constantsBase);
- var_dump($this->__constantsClass);
- /*
- array(5) {
- ["__default"]=>
- NULL
- ["__STRICT_INTEGER"]=>
- int(1)
- ["__STRICT_STRING"]=>
- int(2)
- ["__STRICT_FLOAT"]=>
- int(4)
- ["__STRICT_SCALAR"]=>
- int(7)
- }
- array(7) {
- ["APPLE"]=>
- int(1)
- ["ORANGE"]=>
- int(2)
- ["__default"]=>
- NULL
- ["__STRICT_INTEGER"]=>
- int(1)
- ["__STRICT_STRING"]=>
- int(2)
- ["__STRICT_FLOAT"]=>
- int(4)
- ["__STRICT_SCALAR"]=>
- int(7)
- }
- */
- // remove private constants from child
- $diff = array_intersect_assoc($this->__constantsBase, $this->__constantsClass);
- foreach($diff as $const => $val)
- {
- if($const == '__default')
- continue;
- unset($this->__constantsClass[$const]);
- }
- var_dump($this->__constantsBase);
- var_dump($this->__constantsClass);
- /*
- array(5) {
- ["__default"]=>
- NULL
- ["__STRICT_INTEGER"]=>
- int(1)
- ["__STRICT_STRING"]=>
- int(2)
- ["__STRICT_FLOAT"]=>
- int(4)
- ["__STRICT_SCALAR"]=>
- int(7)
- }
- array(3) {
- ["APPLE"]=>
- int(1)
- ["ORANGE"]=>
- int(2)
- ["__default"]=>
- NULL
- }
- */
- die();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement