Пример #1
0
 /**
  * @param string $className
  * @return void
  */
 protected function initClassObject($className)
 {
     $this->classObject = new Tx_ExtensionBuilder_Domain_Model_Class_Class($className);
     $this->classReflection = new Tx_ExtensionBuilder_Reflection_ClassReflection($className);
     $propertiesToMap = array('FileName', 'Modifiers', 'Tags', 'ParentClass', 'DocComment');
     // map class variables from ClassReflection to classObject
     foreach ($propertiesToMap as $propertyToMap) {
         // these are all "value objects" so there is no need to parse them
         $getterMethod = 'get' . $propertyToMap;
         $setterMethod = 'set' . $propertyToMap;
         $this->classObject->{$setterMethod}($this->classReflection->{$getterMethod}());
     }
     $interfaceNames = $this->classReflection->getInterfaceNames();
     if (count($interfaceNames) > 0) {
         if ($this->classReflection->getParentClass() && count($this->classReflection->getParentClass()->getInterfaceNames()) > 0) {
             $interfaceNames = array_diff($interfaceNames, $this->classReflection->getParentClass()->getInterfaceNames());
         }
         $this->classObject->setInterfaceNames($interfaceNames);
     }
     // reset class properties
     $this->lines = array();
     $this->lastMatchedLineNumber = -1;
 }
 /**
  * compares the number of methods found by parsing with those retrieved from the reflection class
  * @param Tx_ExtensionBuilder_Domain_Model_Class $classObject
  * @param Tx_ExtensionBuilder_Reflection_ClassReflection $classReflection
  * @return void
  */
 public function ParserFindsAllConstants($classObject, $classReflection)
 {
     $reflectionConstantCount = count($classReflection->getConstants());
     if ($classReflection->getParentClass()) {
         $reflectionConstantCount -= count($classReflection->getParentClass()->getConstants());
     }
     $classObjectConstantCount = count($classObject->getConstants());
     $this->assertEquals($reflectionConstantCount, $classObjectConstantCount, 'Not all Constants were found: ' . $classObject->getName() . serialize($classReflection->getConstants()));
 }