Пример #1
0
 private function setValue(&$val)
 {
     yTest_debugCC('setValue ' . $this->className . '::' . $this->propertyName . ' = ' . var_export($val, true));
     if ($this->isPublic) {
         $refl = new ReflectionClass($this->className);
         $refl->setStaticPropertyValue($this->propertyName, $val);
     } else {
         call_user_func(array($this->className, yTest_AddPublicAccessors::getSetterName($this->className, $this->propertyName)), $val);
     }
 }
Пример #2
0
 public final function getStaticProperty($className, $propertyName)
 {
     if (!yTest_Reflection::isStaticProperty($className, $propertyName)) {
         throw yTest_Exception::noSuch("static property", "{$className}::{$propertyName}");
     }
     $isPublic = yTest_Reflection::isPropertyPublic($className, $propertyName);
     if ($isPublic) {
         $ref = new ReflectionClass($className);
         return $ref->getStaticPropertyValue($propertyName);
     } else {
         $this->letMeAccess($className, $propertyName);
         return call_user_func(array($className, yTest_AddPublicAccessors::getGetterName($className, $propertyName)));
     }
     // [RS] PHP >= 5.3 :
     //~ $ref = new ReflectionProperty($className, $propertyName);
     //~ return $ref->getValue(null);
 }