public function testConstructInterfaceHierarchy() { return $this->assertTrue(true, 'einkommentieren zum compilieren'); $avaibleInterfaces = array('ComboDropBoxable', 'DropBoxButtonable', 'SelectComboBoxable', 'GridRowable', 'RightContentLinkable', 'Searchable', 'AutoCompletable', 'Patchable', 'NewButtonable', 'NewTabButtonable', 'DeleteButtonable', 'EditButtonable', 'TabButtonable', 'TabLinkable', 'TabOpenable', 'Buttonable', 'Deleteable', 'Identifyable'); $hierarchy = array(); foreach ($avaibleInterfaces as $avaibleInterface) { $hierarchy[$avaibleInterface] = array(); foreach (GClass::factory('Psc\\CMS\\Item\\' . $avaibleInterface)->getAllInterfaces() as $interface) { if ($interface->getNamespace() === '\\Psc\\CMS\\Item') { $hierarchy[$avaibleInterface][] = $interface->getFQN(); } } } $codeWriter = new \Psc\Code\Generate\CodeWriter(); $code = ' $avaibleInterfaces = Array(' . "\n"; foreach ($hierarchy as $trait => $interfaces) { $code .= sprintf(" '%s' => %s,\n", $trait, $codeWriter->exportList($interfaces)); } $code .= ' );' . "\n"; print "\n\n"; print $code; print "\n"; }
public function csHelp() { extract($this->help()); $phpWriter = new \Psc\Code\Generate\CodeWriter(); $csSerialize = function (array $fields, $data = array()) use($method, $phpWriter) { return $method('serialize', array(new GParameter('context'), new GParameter('serializeEntry', new GClass('Closure'))), array("return \$this->doSerialize(array(" . $phpWriter->exportFunctionParameters($fields) . "), \$serializeEntry, " . $phpWriter->exportFunctionParameter($data) . ", \$context);")); }; $csLabel = function ($label) use($method) { return $method('getLabel', array(), array(sprintf("return '%s';", $label))); }; $csHTMLTemplate = function ($template) use($method) { return $method('html', array(), array("return '" . $template . "';")); }; return compact('csSerialize', 'csLabel', 'csHTMLTemplate'); }