Пример #1
0
 private function getValue()
 {
     if ($this->isPublic) {
         $refl = new ReflectionClass($this->className);
         $val = $refl->getStaticPropertyValue($this->propertyName);
     } else {
         $val = call_user_func(array($this->className, yTest_AddPublicAccessors::getGetterName($this->className, $this->propertyName)));
     }
     yTest_debugCC('getValue ' . $this->className . '::' . $this->propertyName . ' = ' . var_export($val, true));
     return $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);
 }