/** * @param string $verbName * @param CM_Model_User|int $actor * @param int $typeEmail */ public function __construct($verbName, $actor, $typeEmail) { parent::__construct($verbName, $actor); $typeEmail = (int) $typeEmail; try { $className = CM_Mail_Mailable::_getClassName($typeEmail); $this->_nameEmail = ucwords(CM_Util::uncamelize(str_replace('_', '', preg_replace('#\\A[^_]++_[^_]++_#', '', $className)), ' ')); } catch (CM_Class_Exception_TypeNotConfiguredException $exception) { CM_Service_Manager::getInstance()->getLogger()->warning('Unrecognized mail type when creating mail action', (new CM_Log_Context())->setException($exception)); $this->_nameEmail = (string) $typeEmail; } }
/** * @param string $verbName * @param CM_Model_User|int $actor * @param int $typeEmail */ public function __construct($verbName, $actor, $typeEmail) { parent::__construct($verbName, $actor); $typeEmail = (int) $typeEmail; try { $className = CM_Mail::_getClassName($typeEmail); $this->_nameEmail = ucwords(CM_Util::uncamelize(str_replace('_', '', preg_replace('#\\A[^_]++_[^_]++_#', '', $className)), ' ')); } catch (CM_Class_Exception_TypeNotConfiguredException $exception) { $exception->setSeverity(CM_Exception::WARN); CM_Bootloader::getInstance()->getExceptionHandler()->handleException($exception); $this->_nameEmail = (string) $typeEmail; } }
/** * @param array|null $params * @return string */ public static function getPath(array $params = null) { $pageClassName = get_called_class(); $list = explode('_', $pageClassName); // Remove first parts foreach ($list as $index => $entry) { unset($list[$index]); if ($entry == 'Page') { break; } } // Converts upper case letters to dashes: CodeOfHonor => code-of-honor foreach ($list as $index => $entry) { $list[$index] = CM_Util::uncamelize($entry); } $path = '/' . implode('/', $list); if ($path == '/index') { $path = '/'; } return CM_Util::link($path, $params); }
/** * @param ReflectionMethod $method * @return string[] */ public static function getNamedForMethod(ReflectionMethod $method) { $params = array(); $method->getDocComment(); foreach ($method->getParameters() as $param) { if ($param->isOptional()) { $paramName = $param->getName(); $paramString = '--' . CM_Util::uncamelize($paramName); $value = 'value'; if (preg_match('/\\*\\s+@param\\s+([^\\$]*)\\s*\\$' . preg_quote($paramName) . '\\s*([^@\\*]*)/', $method->getDocComment(), $matches)) { if ($commentValue = trim($matches[2])) { $value = $commentValue; } if (preg_match('/bool(ean)?/', $matches[1])) { $value = false; } } if ($value !== false) { $paramString .= '=<' . $value . '>'; } $params[] = $paramString; } } return $params; }
/** * @return string */ protected function _getMethodName() { return CM_Util::uncamelize($this->_method->getName()); }
/** * @return string */ public function getLabel() { $actionName = CM_Util::uncamelize(str_replace('_', '', preg_replace('#\\A[^_]++_[^_]++_#', '', get_called_class())), ' '); $verbName = strtolower(str_replace('_', ' ', $this->getVerbName())); return ucwords($actionName . ' ' . $verbName); }