/** * Process the category tag. * * @param int $errorPos The line number where the error occurs. * * @return void */ protected function processCategory($errorPos) { $category = $this->commentParser->getCategory(); if ($category !== null) { $content = $category->getContent(); if ($content !== '') { if (PHP_CodeSniffer::isUnderscoreName($content) !== true) { $newContent = str_replace(' ', '_', $content); $nameBits = explode('_', $newContent); $firstBit = array_shift($nameBits); $newName = ucfirst($firstBit) . '_'; foreach ($nameBits as $bit) { $newName .= ucfirst($bit) . '_'; } $error = 'Category name "%s" is not valid; consider "%s" instead'; $validName = trim($newName, '_'); $data = array($content, $validName); $this->currentFile->addError($error, $errorPos, 'InvalidCategory', $data); } } else { $error = '@category tag must contain a name'; $this->currentFile->addError($error, $errorPos, 'EmptyCategory'); } } }
/** * Process the category tag. * * @param int $errorPos The line number where the error occurs. * * @return void */ protected function processCategory($errorPos) { $category = $this->commentParser->getCategory(); if ($category !== null) { $content = $category->getContent(); $content = ucfirst($content); // @ruflin: hack to allow useKit as category if ($content !== '') { if (PHP_CodeSniffer::isUnderscoreName($content) !== true) { $newContent = str_replace(' ', '_', $content); $nameBits = explode('_', $newContent); $firstBit = array_shift($nameBits); $newName = ucfirst($firstBit).'_'; foreach ($nameBits as $bit) { $newName .= ucfirst($bit).'_'; } $validName = trim($newName, '_'); $error = "Category name \"$content\" is not valid; consider \"$validName\" instead"; $this->currentFile->addError($error, $errorPos); } } else { $error = '@category tag must contain a name'; $this->currentFile->addError($error, $errorPos); } } }//end processCategory()
/** * Process the category tag * * @param integer $errorPos The line number where the error occurs * @return void */ protected function _processCategory($errorPos) { $category = $this->_commentParser->getCategory(); if ($category !== null) { $content = $category->getContent(); if ($content !== 'Zend') { $error = "Category name \"{$content}\" is not valid; consider \"Zend\" instead"; $this->_currentFile->addError($error, $errorPos, 'CategorieNameFileComment'); } } }
/** * Process the category tag. * * @param int $errorPos The line number where the error occurs. * * @return void */ protected function processCategory($errorPos) { $tag = $this->commentParser->getCategory(); if ($tag !== null) { $content = $tag->getContent(); if ($content !== '') { list($isValid, $validName) = $this->checkCategory($content); if (!$isValid) { $error = "Category name \"{$content}\" is not valid; consider \"{$validName}\" instead"; $this->currentFile->addError($this->getReqPrefix($this->getReqCode($this->reqCodesWrongFormat, 'category')) . $error, $errorPos); } } else { $error = '@category tag must contain a name'; $this->currentFile->addError($this->getReqPrefix($this->reqCodeEmpty) . $error, $errorPos); } } }
/** * Process the category tag. * * @param int $errorPos The line number where the error occurs. * * @return void */ private function _processCategory($errorPos) { $category = $this->commentParser->getCategory(); if ($category !== null) { $content = $category->getContent(); if ($content !== '') { if (PHP_CodeSniffer::isUnderscoreName($content) !== true) { $nameBits = explode('_', $content); $firstBit = array_shift($nameBits); $newName = ucfirst($firstBit) . '_'; foreach ($nameBits as $bit) { $newName .= ucfirst($bit) . '_'; } $validName = trim($newName, '_'); $error = "Category name \"{$content}\" is not valid; Consider \"{$validName}\" instead."; $this->currentFile->addError($error, $errorPos); } } else { $error = '@category tag must contain a name'; $this->currentFile->addError($error, $errorPos); } } }
/** * Process the category tag. * * @param int $errorpos The line number where the error occurs. * * @return void */ protected function processcategory($errorpos) { $category = $this->commentparser->getCategory(); if ($category !== null) { $content = $category->getcontent(); if ($content !== '') { if (PHP_CodeSniffer::isUnderscorename($content) !== true) { $newcontent = str_replace(' ', '_', $content); $namebits = explode('_', $newcontent); $firstbit = array_shift($namebits); $newname = ucfirst($firstbit) . '_'; foreach ($namebits as $bit) { $newname .= ucfirst($bit) . '_'; } $validname = trim($newname, '_'); $error = "Category name \"{$content}\" is not valid; consider \"{$validname}\" instead"; // $this->currentfile->adderror($error, $errorpos); } } else { $error = '@category tag must contain a name'; $this->currentfile->adderror($error, $errorpos); } } }