/** * Process the modified NSDR method */ public function processEditMethodAction() { $params = $this->_getParam('nsdrDefinitionMethod'); $nsdrDefinitionMethod = new NSDRDefinitionMethod(); $nsdrDefinitionMethod->populateWithArray($params); $nsdrDefinitionMethod->methodName = NSDRDefinitionMethod::normalizeMethodName($nsdrDefinitionMethod->methodName); $validCode = NSDRDefinitionMethod::isPHPCodeValid($nsdrDefinitionMethod->method, $nsdrDefinitionMethod->methodName); // check for method duplicates if ($nsdrDefinitionMethod->isMethodNameExists()) { $data = 'Method name "' . $nsdrDefinitionMethod->methodName . '" already exists.'; } else { if ($validCode !== true) { $data = $validCode; } else { $nsdrDefinitionMethod->persist(); $data = true; } } $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }