コード例 #1
0
ファイル: CommentParser.php プロジェクト: codex73/LampCMS
 /**
  * Enforce min and max length of comment
  *
  *
  * @param Utf8String $Body
  *
  * @throws AlertException
  * @return \Lampcms\CommentParser
  */
 protected function validateBody(Utf8String $Body)
 {
     $minChars = $this->Registry->Ini->MIN_COMMENT_CHARS;
     $maxChars = $this->Registry->Ini->MAX_COMMENT_CHARS;
     $len = $Body->length();
     if ($len < $minChars) {
         throw new AlertException('@@Comment is too short. Minimal length is@@' . ' ' . $minChars);
     }
     if ($len > $maxChars) {
         throw new AlertException('@@Comment is too long. Maximum number of characters is@@ ' . $maxChars);
     }
     return $this;
 }
コード例 #2
0
 /**
  * Enforce min and max length of comment
  *
  * @todo Translate string
  *
  * @throws \Lampcms\Exception
  */
 protected function validateBody(Utf8String $Body)
 {
     $len = $Body->length();
     if ($len < 10) {
         /**
          * @todo
          * Translate String
          */
         throw new Exception('Ooopsy... Comment must be at least 10 characters long');
     }
     if ($len > 600) {
         throw new Exception('Oopsy... Comment must be at limited to 600 characters. Your comment is ' . $len . ' characters-long');
     }
     return $this;
 }