コード例 #1
0
ファイル: Email.php プロジェクト: cargomedia/cm
 /**
  * @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;
     }
 }
コード例 #2
0
ファイル: Email.php プロジェクト: NicolasSchmutz/cm
 /**
  * @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;
     }
 }
コード例 #3
0
ファイル: Abstract.php プロジェクト: cargomedia/cm
 /**
  * @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);
 }
コード例 #4
0
ファイル: Arguments.php プロジェクト: cargomedia/cm
 /**
  * @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;
 }
コード例 #5
0
ファイル: Command.php プロジェクト: cargomedia/cm
 /**
  * @return string
  */
 protected function _getMethodName()
 {
     return CM_Util::uncamelize($this->_method->getName());
 }
コード例 #6
0
ファイル: Abstract.php プロジェクト: NicolasSchmutz/cm
 /**
  * @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);
 }