@@ -16,85 +16,85 @@ |
||
| 16 | 16 | class NestingLevelSniff implements Sniff |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * A nesting level higher than this value will throw a warning. |
|
| 21 | - * |
|
| 22 | - * @var integer |
|
| 23 | - */ |
|
| 24 | - public $nestingLevel = 5; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * A nesting level higher than this value will throw an error. |
|
| 28 | - * |
|
| 29 | - * @var integer |
|
| 30 | - */ |
|
| 31 | - public $absoluteNestingLevel = 10; |
|
| 32 | - |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Returns an array of tokens this test wants to listen for. |
|
| 36 | - * |
|
| 37 | - * @return array |
|
| 38 | - */ |
|
| 39 | - public function register() |
|
| 40 | - { |
|
| 41 | - return [T_FUNCTION]; |
|
| 42 | - |
|
| 43 | - }//end register() |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Processes this test, when one of its tokens is encountered. |
|
| 48 | - * |
|
| 49 | - * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. |
|
| 50 | - * @param int $stackPtr The position of the current token |
|
| 51 | - * in the stack passed in $tokens. |
|
| 52 | - * |
|
| 53 | - * @return void |
|
| 54 | - */ |
|
| 55 | - public function process(File $phpcsFile, $stackPtr) |
|
| 56 | - { |
|
| 57 | - $tokens = $phpcsFile->getTokens(); |
|
| 58 | - |
|
| 59 | - // Ignore abstract methods. |
|
| 60 | - if (isset($tokens[$stackPtr]['scope_opener']) === false) { |
|
| 61 | - return; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - // Detect start and end of this function definition. |
|
| 65 | - $start = $tokens[$stackPtr]['scope_opener']; |
|
| 66 | - $end = $tokens[$stackPtr]['scope_closer']; |
|
| 67 | - |
|
| 68 | - $nestingLevel = 0; |
|
| 69 | - |
|
| 70 | - // Find the maximum nesting level of any token in the function. |
|
| 71 | - for ($i = ($start + 1); $i < $end; $i++) { |
|
| 72 | - $level = $tokens[$i]['level']; |
|
| 73 | - if ($nestingLevel < $level) { |
|
| 74 | - $nestingLevel = $level; |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - // We subtract the nesting level of the function itself. |
|
| 79 | - $nestingLevel = ($nestingLevel - $tokens[$stackPtr]['level'] - 1); |
|
| 80 | - |
|
| 81 | - if ($nestingLevel > $this->absoluteNestingLevel) { |
|
| 82 | - $error = 'Function\'s nesting level (%s) exceeds allowed maximum of %s'; |
|
| 83 | - $data = [ |
|
| 84 | - $nestingLevel, |
|
| 85 | - $this->absoluteNestingLevel, |
|
| 86 | - ]; |
|
| 87 | - $phpcsFile->addError($error, $stackPtr, 'MaxExceeded', $data); |
|
| 88 | - } else if ($nestingLevel > $this->nestingLevel) { |
|
| 89 | - $warning = 'Function\'s nesting level (%s) exceeds %s; consider refactoring the function'; |
|
| 90 | - $data = [ |
|
| 91 | - $nestingLevel, |
|
| 92 | - $this->nestingLevel, |
|
| 93 | - ]; |
|
| 94 | - $phpcsFile->addWarning($warning, $stackPtr, 'TooHigh', $data); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - }//end process() |
|
| 19 | + /** |
|
| 20 | + * A nesting level higher than this value will throw a warning. |
|
| 21 | + * |
|
| 22 | + * @var integer |
|
| 23 | + */ |
|
| 24 | + public $nestingLevel = 5; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * A nesting level higher than this value will throw an error. |
|
| 28 | + * |
|
| 29 | + * @var integer |
|
| 30 | + */ |
|
| 31 | + public $absoluteNestingLevel = 10; |
|
| 32 | + |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Returns an array of tokens this test wants to listen for. |
|
| 36 | + * |
|
| 37 | + * @return array |
|
| 38 | + */ |
|
| 39 | + public function register() |
|
| 40 | + { |
|
| 41 | + return [T_FUNCTION]; |
|
| 42 | + |
|
| 43 | + }//end register() |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Processes this test, when one of its tokens is encountered. |
|
| 48 | + * |
|
| 49 | + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. |
|
| 50 | + * @param int $stackPtr The position of the current token |
|
| 51 | + * in the stack passed in $tokens. |
|
| 52 | + * |
|
| 53 | + * @return void |
|
| 54 | + */ |
|
| 55 | + public function process(File $phpcsFile, $stackPtr) |
|
| 56 | + { |
|
| 57 | + $tokens = $phpcsFile->getTokens(); |
|
| 58 | + |
|
| 59 | + // Ignore abstract methods. |
|
| 60 | + if (isset($tokens[$stackPtr]['scope_opener']) === false) { |
|
| 61 | + return; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + // Detect start and end of this function definition. |
|
| 65 | + $start = $tokens[$stackPtr]['scope_opener']; |
|
| 66 | + $end = $tokens[$stackPtr]['scope_closer']; |
|
| 67 | + |
|
| 68 | + $nestingLevel = 0; |
|
| 69 | + |
|
| 70 | + // Find the maximum nesting level of any token in the function. |
|
| 71 | + for ($i = ($start + 1); $i < $end; $i++) { |
|
| 72 | + $level = $tokens[$i]['level']; |
|
| 73 | + if ($nestingLevel < $level) { |
|
| 74 | + $nestingLevel = $level; |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + // We subtract the nesting level of the function itself. |
|
| 79 | + $nestingLevel = ($nestingLevel - $tokens[$stackPtr]['level'] - 1); |
|
| 80 | + |
|
| 81 | + if ($nestingLevel > $this->absoluteNestingLevel) { |
|
| 82 | + $error = 'Function\'s nesting level (%s) exceeds allowed maximum of %s'; |
|
| 83 | + $data = [ |
|
| 84 | + $nestingLevel, |
|
| 85 | + $this->absoluteNestingLevel, |
|
| 86 | + ]; |
|
| 87 | + $phpcsFile->addError($error, $stackPtr, 'MaxExceeded', $data); |
|
| 88 | + } else if ($nestingLevel > $this->nestingLevel) { |
|
| 89 | + $warning = 'Function\'s nesting level (%s) exceeds %s; consider refactoring the function'; |
|
| 90 | + $data = [ |
|
| 91 | + $nestingLevel, |
|
| 92 | + $this->nestingLevel, |
|
| 93 | + ]; |
|
| 94 | + $phpcsFile->addWarning($warning, $stackPtr, 'TooHigh', $data); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + }//end process() |
|
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | }//end class |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | public static function addIssue( |
| 26 | 26 | $title, |
| 27 | 27 | $description, |
| 28 | - $reporter=NULL, |
|
| 29 | - $projectid=NULL, |
|
| 30 | - array $tags=array(), |
|
| 31 | - $status=NULL, |
|
| 32 | - $assignedTo=NULL, |
|
| 33 | - $reportedDate=NULL, |
|
| 34 | - $reportedMilestone=NULL |
|
| 28 | + $reporter = NULL, |
|
| 29 | + $projectid = NULL, |
|
| 30 | + array $tags = array(), |
|
| 31 | + $status = NULL, |
|
| 32 | + $assignedTo = NULL, |
|
| 33 | + $reportedDate = NULL, |
|
| 34 | + $reportedMilestone = NULL |
|
| 35 | 35 | ) { |
| 36 | 36 | // Get current projectid if not specified. |
| 37 | 37 | if ($projectid === NULL) { |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | public static function addIssue( |
| 161 | 161 | $title, |
| 162 | 162 | $description, |
| 163 | - $reporter=NULL, |
|
| 164 | - $projectid=NULL, |
|
| 165 | - array $tags=array(), |
|
| 166 | - $status=NULL, |
|
| 167 | - $assignedTo=NULL, |
|
| 168 | - $reportedDate=NULL, |
|
| 169 | - $reportedMilestone=NULL |
|
| 163 | + $reporter = NULL, |
|
| 164 | + $projectid = NULL, |
|
| 165 | + array $tags = array(), |
|
| 166 | + $status = NULL, |
|
| 167 | + $assignedTo = NULL, |
|
| 168 | + $reportedDate = NULL, |
|
| 169 | + $reportedMilestone = NULL |
|
| 170 | 170 | ) { |
| 171 | 171 | // Get current projectid if not specified. |
| 172 | 172 | if ($projectid === NULL) { |
@@ -27,116 +27,116 @@ discard block |
||
| 27 | 27 | * @api-permission public |
| 28 | 28 | */ |
| 29 | 29 | public static function addIssue( |
| 30 | - $title, |
|
| 31 | - $description, |
|
| 32 | - $reporter=NULL, |
|
| 33 | - $projectid=NULL, |
|
| 34 | - array $tags=array(), |
|
| 35 | - $status=NULL, |
|
| 36 | - $assignedTo=NULL, |
|
| 37 | - $reportedDate=NULL, |
|
| 38 | - $reportedMilestone=NULL |
|
| 30 | + $title, |
|
| 31 | + $description, |
|
| 32 | + $reporter=NULL, |
|
| 33 | + $projectid=NULL, |
|
| 34 | + array $tags=array(), |
|
| 35 | + $status=NULL, |
|
| 36 | + $assignedTo=NULL, |
|
| 37 | + $reportedDate=NULL, |
|
| 38 | + $reportedMilestone=NULL |
|
| 39 | 39 | ) { |
| 40 | - // Get current projectid if not specified. |
|
| 41 | - if ($projectid === NULL) { |
|
| 42 | - Channels::includeSystem('Project'); |
|
| 43 | - $projectid = Project::getCurrentProjectId(); |
|
| 44 | - Channels::modifyBasket('project', $projectid); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - Channels::includeSystem('SquizRoadmap'); |
|
| 48 | - Channels::includeSystem('Permission'); |
|
| 49 | - if (Permission::hasPermission($projectid, 'ideas.contribute') === FALSE) { |
|
| 50 | - throw new ChannelException(_('You do not have permission to contribute idea')); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - if ($assignedTo !== NULL) { |
|
| 54 | - if (Permission::hasPermission($projectid, 'ideas.edit.details') === FALSE) { |
|
| 55 | - throw new ChannelException(_('You do not have permission to assign user to idea')); |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - if (SquizRoadmap::isVisibleProject($projectid, $assignedTo) === FALSE) { |
|
| 59 | - throw new ChannelException(_('Assigned to user does not have access to issue project.')); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - // Get current user id if not specified. |
|
| 64 | - if ($reporter === NULL) { |
|
| 65 | - Channels::includeSystem('User'); |
|
| 66 | - $reporter = User::getCurrentUserid(); |
|
| 67 | - Channels::modifyBasket('reporter', $reporter); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - if (SquizRoadmap::isVisibleProject($projectid, $reporter) === FALSE) { |
|
| 71 | - throw new ChannelException(_('Contributed by user does not have access to issue project.')); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - // Make sure status is valid. |
|
| 75 | - Channels::includeSystem('SquizRoadmap'); |
|
| 76 | - Channels::includeSystem('SquizRoadmapStatus'); |
|
| 77 | - if ($status === NULL) { |
|
| 78 | - $statuses = SquizRoadmapStatus::getStatus($projectid); |
|
| 79 | - if (empty($statuses) === TRUE) { |
|
| 80 | - throw new ChannelException(_('No defined statuses in project')); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - $status = $statuses[0]['status']; |
|
| 84 | - Channels::modifyBasket('status', $status); |
|
| 85 | - } else if (SquizRoadmapStatus::isValidStatus($projectid, $status) === FALSE) { |
|
| 86 | - throw new ChannelException(sprintf(_('Invalid status: %s'), $status)); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $issueid = DAL::seqNextVal('sq_rdm_issue_seq'); |
|
| 90 | - Channels::addToBasket('issueid', $issueid); |
|
| 91 | - |
|
| 92 | - if ($reportedDate === NULL) { |
|
| 93 | - include_once 'Libs/String/String.inc'; |
|
| 94 | - $reportedDate = String::tsIso8601(time()); |
|
| 95 | - Channels::modifyBasket('reportedDate', $reportedDate); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - $title = trim($title); |
|
| 99 | - Channels::modifyBasket('title', $title); |
|
| 100 | - if (empty($title) === TRUE) { |
|
| 101 | - throw new ChannelException(_('Title cannot be empty')); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - $description = SquizRoadmap::stripTags(trim($description)); |
|
| 105 | - Channels::modifyBasket('description', $description); |
|
| 106 | - if (empty($description) === TRUE) { |
|
| 107 | - throw new ChannelException(_('Description cannot be empty')); |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - try { |
|
| 111 | - DAL::beginTransaction(); |
|
| 112 | - |
|
| 113 | - $query = DAL::getDALQuery('SquizRoadmapIssue', 'addIssue'); |
|
| 114 | - DAL::executeQuery($query); |
|
| 115 | - |
|
| 116 | - // Add tags for the new issue. |
|
| 117 | - SquizRoadmapIssue::addIssueTags($issueid, $tags); |
|
| 118 | - |
|
| 119 | - // Add reporter and assignee to watch list. |
|
| 120 | - SquizRoadmapIssue::addIssueWatch($issueid, $reporter); |
|
| 121 | - |
|
| 122 | - if ($assignedTo !== NULL) { |
|
| 123 | - SquizRoadmapIssue::addIssueWatch($issueid, $assignedTo); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - SquizRoadmapIssue::clearIssueCache($issueid); |
|
| 127 | - |
|
| 128 | - DAL::commit(); |
|
| 129 | - } catch (Exception $e) { |
|
| 130 | - DAL::rollBack(); |
|
| 131 | - throw new ChannelException($e->getMessage()); |
|
| 132 | - }//end try |
|
| 133 | - |
|
| 134 | - if ($something === NULL) { |
|
| 135 | - if ($bar !== NULL) { |
|
| 136 | - } |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - return $issueid; |
|
| 40 | + // Get current projectid if not specified. |
|
| 41 | + if ($projectid === NULL) { |
|
| 42 | + Channels::includeSystem('Project'); |
|
| 43 | + $projectid = Project::getCurrentProjectId(); |
|
| 44 | + Channels::modifyBasket('project', $projectid); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + Channels::includeSystem('SquizRoadmap'); |
|
| 48 | + Channels::includeSystem('Permission'); |
|
| 49 | + if (Permission::hasPermission($projectid, 'ideas.contribute') === FALSE) { |
|
| 50 | + throw new ChannelException(_('You do not have permission to contribute idea')); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + if ($assignedTo !== NULL) { |
|
| 54 | + if (Permission::hasPermission($projectid, 'ideas.edit.details') === FALSE) { |
|
| 55 | + throw new ChannelException(_('You do not have permission to assign user to idea')); |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + if (SquizRoadmap::isVisibleProject($projectid, $assignedTo) === FALSE) { |
|
| 59 | + throw new ChannelException(_('Assigned to user does not have access to issue project.')); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + // Get current user id if not specified. |
|
| 64 | + if ($reporter === NULL) { |
|
| 65 | + Channels::includeSystem('User'); |
|
| 66 | + $reporter = User::getCurrentUserid(); |
|
| 67 | + Channels::modifyBasket('reporter', $reporter); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + if (SquizRoadmap::isVisibleProject($projectid, $reporter) === FALSE) { |
|
| 71 | + throw new ChannelException(_('Contributed by user does not have access to issue project.')); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + // Make sure status is valid. |
|
| 75 | + Channels::includeSystem('SquizRoadmap'); |
|
| 76 | + Channels::includeSystem('SquizRoadmapStatus'); |
|
| 77 | + if ($status === NULL) { |
|
| 78 | + $statuses = SquizRoadmapStatus::getStatus($projectid); |
|
| 79 | + if (empty($statuses) === TRUE) { |
|
| 80 | + throw new ChannelException(_('No defined statuses in project')); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + $status = $statuses[0]['status']; |
|
| 84 | + Channels::modifyBasket('status', $status); |
|
| 85 | + } else if (SquizRoadmapStatus::isValidStatus($projectid, $status) === FALSE) { |
|
| 86 | + throw new ChannelException(sprintf(_('Invalid status: %s'), $status)); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $issueid = DAL::seqNextVal('sq_rdm_issue_seq'); |
|
| 90 | + Channels::addToBasket('issueid', $issueid); |
|
| 91 | + |
|
| 92 | + if ($reportedDate === NULL) { |
|
| 93 | + include_once 'Libs/String/String.inc'; |
|
| 94 | + $reportedDate = String::tsIso8601(time()); |
|
| 95 | + Channels::modifyBasket('reportedDate', $reportedDate); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + $title = trim($title); |
|
| 99 | + Channels::modifyBasket('title', $title); |
|
| 100 | + if (empty($title) === TRUE) { |
|
| 101 | + throw new ChannelException(_('Title cannot be empty')); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + $description = SquizRoadmap::stripTags(trim($description)); |
|
| 105 | + Channels::modifyBasket('description', $description); |
|
| 106 | + if (empty($description) === TRUE) { |
|
| 107 | + throw new ChannelException(_('Description cannot be empty')); |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + try { |
|
| 111 | + DAL::beginTransaction(); |
|
| 112 | + |
|
| 113 | + $query = DAL::getDALQuery('SquizRoadmapIssue', 'addIssue'); |
|
| 114 | + DAL::executeQuery($query); |
|
| 115 | + |
|
| 116 | + // Add tags for the new issue. |
|
| 117 | + SquizRoadmapIssue::addIssueTags($issueid, $tags); |
|
| 118 | + |
|
| 119 | + // Add reporter and assignee to watch list. |
|
| 120 | + SquizRoadmapIssue::addIssueWatch($issueid, $reporter); |
|
| 121 | + |
|
| 122 | + if ($assignedTo !== NULL) { |
|
| 123 | + SquizRoadmapIssue::addIssueWatch($issueid, $assignedTo); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + SquizRoadmapIssue::clearIssueCache($issueid); |
|
| 127 | + |
|
| 128 | + DAL::commit(); |
|
| 129 | + } catch (Exception $e) { |
|
| 130 | + DAL::rollBack(); |
|
| 131 | + throw new ChannelException($e->getMessage()); |
|
| 132 | + }//end try |
|
| 133 | + |
|
| 134 | + if ($something === NULL) { |
|
| 135 | + if ($bar !== NULL) { |
|
| 136 | + } |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + return $issueid; |
|
| 140 | 140 | |
| 141 | 141 | }//end addIssue() |
| 142 | 142 | |
@@ -162,21 +162,21 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | */ |
| 164 | 164 | public static function addIssue( |
| 165 | - $title, |
|
| 166 | - $description, |
|
| 167 | - $reporter=NULL, |
|
| 168 | - $projectid=NULL, |
|
| 169 | - array $tags=array(), |
|
| 170 | - $status=NULL, |
|
| 171 | - $assignedTo=NULL, |
|
| 172 | - $reportedDate=NULL, |
|
| 173 | - $reportedMilestone=NULL |
|
| 165 | + $title, |
|
| 166 | + $description, |
|
| 167 | + $reporter=NULL, |
|
| 168 | + $projectid=NULL, |
|
| 169 | + array $tags=array(), |
|
| 170 | + $status=NULL, |
|
| 171 | + $assignedTo=NULL, |
|
| 172 | + $reportedDate=NULL, |
|
| 173 | + $reportedMilestone=NULL |
|
| 174 | 174 | ) { |
| 175 | - // Get current projectid if not specified. |
|
| 176 | - if ($projectid === NULL) { |
|
| 177 | - Channels::includeSystem('Project'); |
|
| 178 | - $projectid = Project::getCurrentProjectId(); |
|
| 179 | - Channels::modifyBasket('project', $projectid); |
|
| 180 | - } |
|
| 175 | + // Get current projectid if not specified. |
|
| 176 | + if ($projectid === NULL) { |
|
| 177 | + Channels::includeSystem('Project'); |
|
| 178 | + $projectid = Project::getCurrentProjectId(); |
|
| 179 | + Channels::modifyBasket('project', $projectid); |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | 182 | }//end addIssue() |
@@ -15,38 +15,38 @@ |
||
| 15 | 15 | { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Returns the lines where errors should occur. |
|
| 20 | - * |
|
| 21 | - * The key of the array should represent the line number and the value |
|
| 22 | - * should represent the number of errors that should occur on that line. |
|
| 23 | - * |
|
| 24 | - * @return array<int, int> |
|
| 25 | - */ |
|
| 26 | - public function getErrorList() |
|
| 27 | - { |
|
| 28 | - return []; |
|
| 29 | - |
|
| 30 | - }//end getErrorList() |
|
| 31 | - |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Returns the lines where warnings should occur. |
|
| 35 | - * |
|
| 36 | - * The key of the array should represent the line number and the value |
|
| 37 | - * should represent the number of warnings that should occur on that line. |
|
| 38 | - * |
|
| 39 | - * @return array<int, int> |
|
| 40 | - */ |
|
| 41 | - public function getWarningList() |
|
| 42 | - { |
|
| 43 | - return [ |
|
| 44 | - 4 => 1, |
|
| 45 | - 12 => 1, |
|
| 46 | - 21 => 1, |
|
| 47 | - ]; |
|
| 48 | - |
|
| 49 | - }//end getWarningList() |
|
| 18 | + /** |
|
| 19 | + * Returns the lines where errors should occur. |
|
| 20 | + * |
|
| 21 | + * The key of the array should represent the line number and the value |
|
| 22 | + * should represent the number of errors that should occur on that line. |
|
| 23 | + * |
|
| 24 | + * @return array<int, int> |
|
| 25 | + */ |
|
| 26 | + public function getErrorList() |
|
| 27 | + { |
|
| 28 | + return []; |
|
| 29 | + |
|
| 30 | + }//end getErrorList() |
|
| 31 | + |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Returns the lines where warnings should occur. |
|
| 35 | + * |
|
| 36 | + * The key of the array should represent the line number and the value |
|
| 37 | + * should represent the number of warnings that should occur on that line. |
|
| 38 | + * |
|
| 39 | + * @return array<int, int> |
|
| 40 | + */ |
|
| 41 | + public function getWarningList() |
|
| 42 | + { |
|
| 43 | + return [ |
|
| 44 | + 4 => 1, |
|
| 45 | + 12 => 1, |
|
| 46 | + 21 => 1, |
|
| 47 | + ]; |
|
| 48 | + |
|
| 49 | + }//end getWarningList() |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | }//end class |
@@ -1,25 +1,25 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | function getWidget($type) |
| 3 | 3 | { |
| 4 | - eval('$obj = new '.$type.'();'); |
|
| 5 | - return $obj; |
|
| 4 | + eval('$obj = new '.$type.'();'); |
|
| 5 | + return $obj; |
|
| 6 | 6 | |
| 7 | 7 | }//end getWidget() |
| 8 | 8 | |
| 9 | 9 | function getWidget2($type) |
| 10 | 10 | { |
| 11 | - $string = '$obj = new '.$type.'();'; |
|
| 12 | - eval($string); |
|
| 13 | - eval('$string = "";'); |
|
| 14 | - return $obj; |
|
| 11 | + $string = '$obj = new '.$type.'();'; |
|
| 12 | + eval($string); |
|
| 13 | + eval('$string = "";'); |
|
| 14 | + return $obj; |
|
| 15 | 15 | |
| 16 | 16 | }//end getWidget2() |
| 17 | 17 | |
| 18 | 18 | function getWidget3($type) |
| 19 | 19 | { |
| 20 | - $string = '$obj = new '; |
|
| 21 | - eval($string.$type.'();'); |
|
| 22 | - return $obj; |
|
| 20 | + $string = '$obj = new '; |
|
| 21 | + eval($string.$type.'();'); |
|
| 22 | + return $obj; |
|
| 23 | 23 | |
| 24 | 24 | }//end getWidget3() |
| 25 | 25 | |
@@ -15,42 +15,42 @@ |
||
| 15 | 15 | { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Returns the lines where errors should occur. |
|
| 20 | - * |
|
| 21 | - * The key of the array should represent the line number and the value |
|
| 22 | - * should represent the number of errors that should occur on that line. |
|
| 23 | - * |
|
| 24 | - * @return array<int, int> |
|
| 25 | - */ |
|
| 26 | - public function getErrorList() |
|
| 27 | - { |
|
| 28 | - return [ |
|
| 29 | - 2 => 1, |
|
| 30 | - 5 => 1, |
|
| 31 | - 8 => 1, |
|
| 32 | - 21 => 1, |
|
| 33 | - 26 => 1, |
|
| 34 | - 27 => 1, |
|
| 35 | - 28 => 1, |
|
| 36 | - ]; |
|
| 37 | - |
|
| 38 | - }//end getErrorList() |
|
| 39 | - |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Returns the lines where warnings should occur. |
|
| 43 | - * |
|
| 44 | - * The key of the array should represent the line number and the value |
|
| 45 | - * should represent the number of warnings that should occur on that line. |
|
| 46 | - * |
|
| 47 | - * @return array<int, int> |
|
| 48 | - */ |
|
| 49 | - public function getWarningList() |
|
| 50 | - { |
|
| 51 | - return []; |
|
| 52 | - |
|
| 53 | - }//end getWarningList() |
|
| 18 | + /** |
|
| 19 | + * Returns the lines where errors should occur. |
|
| 20 | + * |
|
| 21 | + * The key of the array should represent the line number and the value |
|
| 22 | + * should represent the number of errors that should occur on that line. |
|
| 23 | + * |
|
| 24 | + * @return array<int, int> |
|
| 25 | + */ |
|
| 26 | + public function getErrorList() |
|
| 27 | + { |
|
| 28 | + return [ |
|
| 29 | + 2 => 1, |
|
| 30 | + 5 => 1, |
|
| 31 | + 8 => 1, |
|
| 32 | + 21 => 1, |
|
| 33 | + 26 => 1, |
|
| 34 | + 27 => 1, |
|
| 35 | + 28 => 1, |
|
| 36 | + ]; |
|
| 37 | + |
|
| 38 | + }//end getErrorList() |
|
| 39 | + |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Returns the lines where warnings should occur. |
|
| 43 | + * |
|
| 44 | + * The key of the array should represent the line number and the value |
|
| 45 | + * should represent the number of warnings that should occur on that line. |
|
| 46 | + * |
|
| 47 | + * @return array<int, int> |
|
| 48 | + */ |
|
| 49 | + public function getWarningList() |
|
| 50 | + { |
|
| 51 | + return []; |
|
| 52 | + |
|
| 53 | + }//end getWarningList() |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | }//end class |
@@ -10,17 +10,17 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Security |
| 12 | 12 | { |
| 13 | - function getRequestData($var) { |
|
| 14 | - echo $_REQUEST[$var]; |
|
| 15 | - } |
|
| 13 | + function getRequestData($var) { |
|
| 14 | + echo $_REQUEST[$var]; |
|
| 15 | + } |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | class Insecurity |
| 19 | 19 | { |
| 20 | - function getRequestData($var) { |
|
| 21 | - unset($_REQUEST[$var]); |
|
| 22 | - echo 'OMGHAX!'; |
|
| 23 | - } |
|
| 20 | + function getRequestData($var) { |
|
| 21 | + unset($_REQUEST[$var]); |
|
| 22 | + echo 'OMGHAX!'; |
|
| 23 | + } |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $sample = Util::getArrayIndex($_REQUEST, 'sample', ''); |
@@ -15,48 +15,48 @@ |
||
| 15 | 15 | { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Returns the lines where errors should occur. |
|
| 20 | - * |
|
| 21 | - * The key of the array should represent the line number and the value |
|
| 22 | - * should represent the number of errors that should occur on that line. |
|
| 23 | - * |
|
| 24 | - * @param string $testFile The name of the file being tested. |
|
| 25 | - * |
|
| 26 | - * @return array<int, int> |
|
| 27 | - */ |
|
| 28 | - public function getErrorList($testFile='JoinStringsUnitTest.js') |
|
| 29 | - { |
|
| 30 | - if ($testFile !== 'JoinStringsUnitTest.js') { |
|
| 31 | - return []; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - return [ |
|
| 35 | - 6 => 1, |
|
| 36 | - 7 => 1, |
|
| 37 | - 8 => 2, |
|
| 38 | - 9 => 2, |
|
| 39 | - 10 => 2, |
|
| 40 | - 12 => 2, |
|
| 41 | - 15 => 1, |
|
| 42 | - ]; |
|
| 43 | - |
|
| 44 | - }//end getErrorList() |
|
| 45 | - |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Returns the lines where warnings should occur. |
|
| 49 | - * |
|
| 50 | - * The key of the array should represent the line number and the value |
|
| 51 | - * should represent the number of warnings that should occur on that line. |
|
| 52 | - * |
|
| 53 | - * @return array<int, int> |
|
| 54 | - */ |
|
| 55 | - public function getWarningList() |
|
| 56 | - { |
|
| 57 | - return []; |
|
| 58 | - |
|
| 59 | - }//end getWarningList() |
|
| 18 | + /** |
|
| 19 | + * Returns the lines where errors should occur. |
|
| 20 | + * |
|
| 21 | + * The key of the array should represent the line number and the value |
|
| 22 | + * should represent the number of errors that should occur on that line. |
|
| 23 | + * |
|
| 24 | + * @param string $testFile The name of the file being tested. |
|
| 25 | + * |
|
| 26 | + * @return array<int, int> |
|
| 27 | + */ |
|
| 28 | + public function getErrorList($testFile='JoinStringsUnitTest.js') |
|
| 29 | + { |
|
| 30 | + if ($testFile !== 'JoinStringsUnitTest.js') { |
|
| 31 | + return []; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + return [ |
|
| 35 | + 6 => 1, |
|
| 36 | + 7 => 1, |
|
| 37 | + 8 => 2, |
|
| 38 | + 9 => 2, |
|
| 39 | + 10 => 2, |
|
| 40 | + 12 => 2, |
|
| 41 | + 15 => 1, |
|
| 42 | + ]; |
|
| 43 | + |
|
| 44 | + }//end getErrorList() |
|
| 45 | + |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Returns the lines where warnings should occur. |
|
| 49 | + * |
|
| 50 | + * The key of the array should represent the line number and the value |
|
| 51 | + * should represent the number of warnings that should occur on that line. |
|
| 52 | + * |
|
| 53 | + * @return array<int, int> |
|
| 54 | + */ |
|
| 55 | + public function getWarningList() |
|
| 56 | + { |
|
| 57 | + return []; |
|
| 58 | + |
|
| 59 | + }//end getWarningList() |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | }//end class |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @return array<int, int> |
| 27 | 27 | */ |
| 28 | - public function getErrorList($testFile='JoinStringsUnitTest.js') |
|
| 28 | + public function getErrorList($testFile = 'JoinStringsUnitTest.js') |
|
| 29 | 29 | { |
| 30 | 30 | if ($testFile !== 'JoinStringsUnitTest.js') { |
| 31 | 31 | return []; |
@@ -15,47 +15,47 @@ |
||
| 15 | 15 | { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Returns the lines where errors should occur. |
|
| 20 | - * |
|
| 21 | - * The key of the array should represent the line number and the value |
|
| 22 | - * should represent the number of errors that should occur on that line. |
|
| 23 | - * |
|
| 24 | - * @param string $testFile The name of the file being tested. |
|
| 25 | - * |
|
| 26 | - * @return array<int, int> |
|
| 27 | - */ |
|
| 28 | - public function getErrorList($testFile='FirebugConsoleUnitTest.js') |
|
| 29 | - { |
|
| 30 | - if ($testFile !== 'FirebugConsoleUnitTest.js') { |
|
| 31 | - return []; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - return [ |
|
| 35 | - 1 => 1, |
|
| 36 | - 2 => 1, |
|
| 37 | - 3 => 1, |
|
| 38 | - 5 => 1, |
|
| 39 | - 6 => 1, |
|
| 40 | - 8 => 1, |
|
| 41 | - ]; |
|
| 42 | - |
|
| 43 | - }//end getErrorList() |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Returns the lines where warnings should occur. |
|
| 48 | - * |
|
| 49 | - * The key of the array should represent the line number and the value |
|
| 50 | - * should represent the number of warnings that should occur on that line. |
|
| 51 | - * |
|
| 52 | - * @return array<int, int> |
|
| 53 | - */ |
|
| 54 | - public function getWarningList() |
|
| 55 | - { |
|
| 56 | - return []; |
|
| 57 | - |
|
| 58 | - }//end getWarningList() |
|
| 18 | + /** |
|
| 19 | + * Returns the lines where errors should occur. |
|
| 20 | + * |
|
| 21 | + * The key of the array should represent the line number and the value |
|
| 22 | + * should represent the number of errors that should occur on that line. |
|
| 23 | + * |
|
| 24 | + * @param string $testFile The name of the file being tested. |
|
| 25 | + * |
|
| 26 | + * @return array<int, int> |
|
| 27 | + */ |
|
| 28 | + public function getErrorList($testFile='FirebugConsoleUnitTest.js') |
|
| 29 | + { |
|
| 30 | + if ($testFile !== 'FirebugConsoleUnitTest.js') { |
|
| 31 | + return []; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + return [ |
|
| 35 | + 1 => 1, |
|
| 36 | + 2 => 1, |
|
| 37 | + 3 => 1, |
|
| 38 | + 5 => 1, |
|
| 39 | + 6 => 1, |
|
| 40 | + 8 => 1, |
|
| 41 | + ]; |
|
| 42 | + |
|
| 43 | + }//end getErrorList() |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Returns the lines where warnings should occur. |
|
| 48 | + * |
|
| 49 | + * The key of the array should represent the line number and the value |
|
| 50 | + * should represent the number of warnings that should occur on that line. |
|
| 51 | + * |
|
| 52 | + * @return array<int, int> |
|
| 53 | + */ |
|
| 54 | + public function getWarningList() |
|
| 55 | + { |
|
| 56 | + return []; |
|
| 57 | + |
|
| 58 | + }//end getWarningList() |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | }//end class |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @return array<int, int> |
| 27 | 27 | */ |
| 28 | - public function getErrorList($testFile='FirebugConsoleUnitTest.js') |
|
| 28 | + public function getErrorList($testFile = 'FirebugConsoleUnitTest.js') |
|
| 29 | 29 | { |
| 30 | 30 | if ($testFile !== 'FirebugConsoleUnitTest.js') { |
| 31 | 31 | return []; |
@@ -15,37 +15,37 @@ |
||
| 15 | 15 | { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Returns the lines where errors should occur. |
|
| 20 | - * |
|
| 21 | - * The key of the array should represent the line number and the value |
|
| 22 | - * should represent the number of errors that should occur on that line. |
|
| 23 | - * |
|
| 24 | - * @return array<int, int> |
|
| 25 | - */ |
|
| 26 | - public function getErrorList() |
|
| 27 | - { |
|
| 28 | - return [ |
|
| 29 | - 2 => 1, |
|
| 30 | - 3 => 1, |
|
| 31 | - ]; |
|
| 32 | - |
|
| 33 | - }//end getErrorList() |
|
| 34 | - |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Returns the lines where warnings should occur. |
|
| 38 | - * |
|
| 39 | - * The key of the array should represent the line number and the value |
|
| 40 | - * should represent the number of warnings that should occur on that line. |
|
| 41 | - * |
|
| 42 | - * @return array<int, int> |
|
| 43 | - */ |
|
| 44 | - public function getWarningList() |
|
| 45 | - { |
|
| 46 | - return []; |
|
| 47 | - |
|
| 48 | - }//end getWarningList() |
|
| 18 | + /** |
|
| 19 | + * Returns the lines where errors should occur. |
|
| 20 | + * |
|
| 21 | + * The key of the array should represent the line number and the value |
|
| 22 | + * should represent the number of errors that should occur on that line. |
|
| 23 | + * |
|
| 24 | + * @return array<int, int> |
|
| 25 | + */ |
|
| 26 | + public function getErrorList() |
|
| 27 | + { |
|
| 28 | + return [ |
|
| 29 | + 2 => 1, |
|
| 30 | + 3 => 1, |
|
| 31 | + ]; |
|
| 32 | + |
|
| 33 | + }//end getErrorList() |
|
| 34 | + |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Returns the lines where warnings should occur. |
|
| 38 | + * |
|
| 39 | + * The key of the array should represent the line number and the value |
|
| 40 | + * should represent the number of warnings that should occur on that line. |
|
| 41 | + * |
|
| 42 | + * @return array<int, int> |
|
| 43 | + */ |
|
| 44 | + public function getWarningList() |
|
| 45 | + { |
|
| 46 | + return []; |
|
| 47 | + |
|
| 48 | + }//end getWarningList() |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | }//end class |