/** * * @return void */ protected function debugInfo() { if (count($this->classObject->getMethods()) != count($this->classReflection->getNotInheritedMethods())) { debug('Errorr: method count does not match: ' . count($this->classObject->getMethods()) . ' methods found, should be ' . count($this->classReflection->getNotInheritedMethods())); debug($this->classObject->getMethods()); debug($this->classReflection->getNotInheritedMethods()); } if (count($this->classObject->getProperties()) != count($this->classReflection->getNotInheritedProperties())) { debug('Error: property count does not match:' . count($this->classObject->getProperties()) . ' properties found, should be ' . count($this->classReflection->getNotInheritedProperties())); debug($this->classObject->getProperties()); debug($this->classReflection->getNotInheritedProperties()); } $info = $this->classObject->getInfo(); $endtime = microtime(TRUE); $totaltime = $endtime - $this->starttime; $totaltime = round($totaltime, 5); $info['Parsetime:'] = $totaltime . ' s'; debug($info); }
/** * Not used right now * TODO: Needs better implementation * @param Tx_ExtensionBuilder_Domain_Model_DomainObject $domainObject * @return void */ public function sortMethods($domainObject) { $objectProperties = $domainObject->getProperties(); $sortedProperties = array(); $propertyRelatedMethods = array(); $customMethods = array(); // sort all properties and methods according to domainObject sort order foreach ($objectProperties as $objectProperty) { if ($this->classObject->propertyExists($objectProperty->getName())) { $sortedProperties[$objectProperty->getName()] = $this->classObject->getProperty($objectProperty->getName()); $methodPrefixes = array('get', 'set', 'add', 'remove', 'is'); foreach ($methodPrefixes as $methodPrefix) { $methodName = $this->getMethodName($objectProperty, $methodPrefix); if ($this->classObject->methodExists($methodName)) { $propertyRelatedMethods[$methodName] = $this->classObject->getMethod($methodName); } } } } // add the properties that were not in the domainObject $classProperties = $this->classObject->getProperties(); $sortedPropertyNames = array_keys($sortedProperties); foreach ($classProperties as $classProperty) { if (!in_array($classProperty->getName(), $sortedProperties)) { $sortedProperties[$classProperty->getName()] = $classProperty; } } // add custom methods that were manually added to the class $classMethods = $this->classObject->getMethods(); $propertyRelatedMethodNames = array_keys($propertyRelatedMethods); foreach ($classMethods as $classMethod) { if (!in_array($classMethod->getName(), $propertyRelatedMethodNames)) { $customMethods[$classMethod->getName()] = $classMethod; } } $sortedMethods = array_merge($customMethods, $propertyRelatedMethods); //t3lib_div::devlog('Methods after sorting', 'extension_builder', 0, array_keys($sortedMethods)); $this->classObject->setProperties($sortedProperties); $this->classObject->setMethods($sortedMethods); }