test_class.file: php-frontend/src/test/java/org/sonar/php/metrics/CognitiveComplexityVisitorTest.java
test_class.identifier: CognitiveComplexityVisitorTest
test_class.superclass: extends PHPTreeModelTest
test_case.body: @Test
    public void jumps() throws Exception {
      assertThat(complexity(" return 42;")).isEqualTo(0);
      assertThat(complexity(" return;")).isEqualTo(0);
      assertThat(complexity(" break; ")).isEqualTo(0);
      assertThat(complexity(" continue; ")).isEqualTo(0);
  
      assertThat(complexity(" continue 42; ")).isEqualTo(1);
      assertThat(complexity(" break 42; ")).isEqualTo(1);
      assertThat(complexity(" goto a; ")).isEqualTo(1);
  
      assertThat(complexity(" if ($a) { continue 42; } ")).isEqualTo(2);
      assertThat(complexity(" if ($a) { break 42; } ")).isEqualTo(2);
      assertThat(complexity(" if ($a) { goto a; } ")).isEqualTo(2);
  
      assertThat(components(" continue 42; ")).containsExactly(cc("continue", 1));
      assertThat(components(" break 42; ")).containsExactly(cc("break", 1));
      assertThat(components(" goto a; ")).containsExactly(cc("goto", 1));
    }
test_case.class_method_signature: CognitiveComplexityVisitorTest.jumps()
test_case.full_signature: @Test public void jumps()
test_case.identifier: jumps
test_case.invocations: isEqualTo assertThat complexity isEqualTo assertThat complexity isEqualTo assertThat complexity isEqualTo assertThat complexity isEqualTo assertThat complexity isEqualTo assertThat complexity isEqualTo assertThat complexity isEqualTo assertThat complexity isEqualTo assertThat complexity isEqualTo assertThat complexity containsExactly assertThat components cc containsExactly assertThat components cc containsExactly assertThat components cc
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void jumps()
focal_class.declarator: complexity = new CognitiveComplexity()
focal_class.modifier: private
focal_class.original_string: private CognitiveComplexity complexity = new CognitiveComplexity();
focal_class.type: CognitiveComplexity
focal_class.var_name: complexity
focal_class.declarator: ifStatementWithoutNesting = new HashSet<>()
focal_class.modifier: private
focal_class.original_string: private Set<IfStatementTree> ifStatementWithoutNesting = new HashSet<>();
focal_class.type: Set<IfStatementTree>
focal_class.var_name: ifStatementWithoutNesting
focal_class.declarator: nestedLogicalExpressions = new HashSet<>()
focal_class.modifier: private
focal_class.original_string: private Set<ExpressionTree> nestedLogicalExpressions = new HashSet<>();
focal_class.type: Set<ExpressionTree>
focal_class.var_name: nestedLogicalExpressions
focal_class.file: php-frontend/src/main/java/org/sonar/php/metrics/CognitiveComplexityVisitor.java
focal_class.identifier: CognitiveComplexityVisitor
focal_class.class_method_signature: CognitiveComplexityVisitor.complexity(FunctionTree functionTree)
focal_class.full_signature: public static CognitiveComplexity complexity(FunctionTree functionTree)
focal_class.identifier: complexity
focal_class.modifiers: public static
focal_class.parameters: (FunctionTree functionTree)
focal_class.return: CognitiveComplexity
focal_class.signature: CognitiveComplexity complexity(FunctionTree functionTree)
focal_class.class_method_signature: CognitiveComplexityVisitor.complexity(CompilationUnitTree cut)
focal_class.full_signature: public static int complexity(CompilationUnitTree cut)
focal_class.identifier: complexity
focal_class.modifiers: public static
focal_class.parameters: (CompilationUnitTree cut)
focal_class.return: int
focal_class.signature: int complexity(CompilationUnitTree cut)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitIfStatement(IfStatementTree tree)
focal_class.full_signature: @Override public void visitIfStatement(IfStatementTree tree)
focal_class.identifier: visitIfStatement
focal_class.modifiers: @Override public
focal_class.parameters: (IfStatementTree tree)
focal_class.return: void
focal_class.signature: void visitIfStatement(IfStatementTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitElseifClause(ElseifClauseTree tree)
focal_class.full_signature: @Override public void visitElseifClause(ElseifClauseTree tree)
focal_class.identifier: visitElseifClause
focal_class.modifiers: @Override public
focal_class.parameters: (ElseifClauseTree tree)
focal_class.return: void
focal_class.signature: void visitElseifClause(ElseifClauseTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitElseClause(ElseClauseTree tree)
focal_class.full_signature: @Override public void visitElseClause(ElseClauseTree tree)
focal_class.identifier: visitElseClause
focal_class.modifiers: @Override public
focal_class.parameters: (ElseClauseTree tree)
focal_class.return: void
focal_class.signature: void visitElseClause(ElseClauseTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitSwitchStatement(SwitchStatementTree tree)
focal_class.full_signature: @Override public void visitSwitchStatement(SwitchStatementTree tree)
focal_class.identifier: visitSwitchStatement
focal_class.modifiers: @Override public
focal_class.parameters: (SwitchStatementTree tree)
focal_class.return: void
focal_class.signature: void visitSwitchStatement(SwitchStatementTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitWhileStatement(WhileStatementTree tree)
focal_class.full_signature: @Override public void visitWhileStatement(WhileStatementTree tree)
focal_class.identifier: visitWhileStatement
focal_class.modifiers: @Override public
focal_class.parameters: (WhileStatementTree tree)
focal_class.return: void
focal_class.signature: void visitWhileStatement(WhileStatementTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitDoWhileStatement(DoWhileStatementTree tree)
focal_class.full_signature: @Override public void visitDoWhileStatement(DoWhileStatementTree tree)
focal_class.identifier: visitDoWhileStatement
focal_class.modifiers: @Override public
focal_class.parameters: (DoWhileStatementTree tree)
focal_class.return: void
focal_class.signature: void visitDoWhileStatement(DoWhileStatementTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitForStatement(ForStatementTree tree)
focal_class.full_signature: @Override public void visitForStatement(ForStatementTree tree)
focal_class.identifier: visitForStatement
focal_class.modifiers: @Override public
focal_class.parameters: (ForStatementTree tree)
focal_class.return: void
focal_class.signature: void visitForStatement(ForStatementTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitForEachStatement(ForEachStatementTree tree)
focal_class.full_signature: @Override public void visitForEachStatement(ForEachStatementTree tree)
focal_class.identifier: visitForEachStatement
focal_class.modifiers: @Override public
focal_class.parameters: (ForEachStatementTree tree)
focal_class.return: void
focal_class.signature: void visitForEachStatement(ForEachStatementTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitCatchBlock(CatchBlockTree tree)
focal_class.full_signature: @Override public void visitCatchBlock(CatchBlockTree tree)
focal_class.identifier: visitCatchBlock
focal_class.modifiers: @Override public
focal_class.parameters: (CatchBlockTree tree)
focal_class.return: void
focal_class.signature: void visitCatchBlock(CatchBlockTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitFunctionDeclaration(FunctionDeclarationTree tree)
focal_class.full_signature: @Override public void visitFunctionDeclaration(FunctionDeclarationTree tree)
focal_class.identifier: visitFunctionDeclaration
focal_class.modifiers: @Override public
focal_class.parameters: (FunctionDeclarationTree tree)
focal_class.return: void
focal_class.signature: void visitFunctionDeclaration(FunctionDeclarationTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitFunctionExpression(FunctionExpressionTree tree)
focal_class.full_signature: @Override public void visitFunctionExpression(FunctionExpressionTree tree)
focal_class.identifier: visitFunctionExpression
focal_class.modifiers: @Override public
focal_class.parameters: (FunctionExpressionTree tree)
focal_class.return: void
focal_class.signature: void visitFunctionExpression(FunctionExpressionTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitArrowFunctionExpression(ArrowFunctionExpressionTree tree)
focal_class.full_signature: @Override public void visitArrowFunctionExpression(ArrowFunctionExpressionTree tree)
focal_class.identifier: visitArrowFunctionExpression
focal_class.modifiers: @Override public
focal_class.parameters: (ArrowFunctionExpressionTree tree)
focal_class.return: void
focal_class.signature: void visitArrowFunctionExpression(ArrowFunctionExpressionTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitMethodDeclaration(MethodDeclarationTree tree)
focal_class.full_signature: @Override public void visitMethodDeclaration(MethodDeclarationTree tree)
focal_class.identifier: visitMethodDeclaration
focal_class.modifiers: @Override public
focal_class.parameters: (MethodDeclarationTree tree)
focal_class.return: void
focal_class.signature: void visitMethodDeclaration(MethodDeclarationTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitConditionalExpression(ConditionalExpressionTree tree)
focal_class.full_signature: @Override public void visitConditionalExpression(ConditionalExpressionTree tree)
focal_class.identifier: visitConditionalExpression
focal_class.modifiers: @Override public
focal_class.parameters: (ConditionalExpressionTree tree)
focal_class.return: void
focal_class.signature: void visitConditionalExpression(ConditionalExpressionTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitBreakStatement(BreakStatementTree tree)
focal_class.full_signature: @Override public void visitBreakStatement(BreakStatementTree tree)
focal_class.identifier: visitBreakStatement
focal_class.modifiers: @Override public
focal_class.parameters: (BreakStatementTree tree)
focal_class.return: void
focal_class.signature: void visitBreakStatement(BreakStatementTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitContinueStatement(ContinueStatementTree tree)
focal_class.full_signature: @Override public void visitContinueStatement(ContinueStatementTree tree)
focal_class.identifier: visitContinueStatement
focal_class.modifiers: @Override public
focal_class.parameters: (ContinueStatementTree tree)
focal_class.return: void
focal_class.signature: void visitContinueStatement(ContinueStatementTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitGotoStatement(GotoStatementTree tree)
focal_class.full_signature: @Override public void visitGotoStatement(GotoStatementTree tree)
focal_class.identifier: visitGotoStatement
focal_class.modifiers: @Override public
focal_class.parameters: (GotoStatementTree tree)
focal_class.return: void
focal_class.signature: void visitGotoStatement(GotoStatementTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitBinaryExpression(BinaryExpressionTree tree)
focal_class.full_signature: @Override public void visitBinaryExpression(BinaryExpressionTree tree)
focal_class.identifier: visitBinaryExpression
focal_class.modifiers: @Override public
focal_class.parameters: (BinaryExpressionTree tree)
focal_class.return: void
focal_class.signature: void visitBinaryExpression(BinaryExpressionTree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.flattenLogicalExpression(int i, List<SyntaxToken> operators, ExpressionTree expression)
focal_class.full_signature: private void flattenLogicalExpression(int i, List<SyntaxToken> operators, ExpressionTree expression)
focal_class.identifier: flattenLogicalExpression
focal_class.modifiers: private
focal_class.parameters: (int i, List<SyntaxToken> operators, ExpressionTree expression)
focal_class.return: void
focal_class.signature: void flattenLogicalExpression(int i, List<SyntaxToken> operators, ExpressionTree expression)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitWithNesting(@Nullable Tree tree)
focal_class.full_signature: private void visitWithNesting(@Nullable Tree tree)
focal_class.identifier: visitWithNesting
focal_class.modifiers: private
focal_class.parameters: (@Nullable Tree tree)
focal_class.return: void
focal_class.signature: void visitWithNesting(@Nullable Tree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitWithNesting(List<StatementTree> statements)
focal_class.full_signature: private void visitWithNesting(List<StatementTree> statements)
focal_class.identifier: visitWithNesting
focal_class.modifiers: private
focal_class.parameters: (List<StatementTree> statements)
focal_class.return: void
focal_class.signature: void visitWithNesting(List<StatementTree> statements)
focal_class.class_method_signature: CognitiveComplexityVisitor.visitWithNesting(Runnable action)
focal_class.full_signature: private void visitWithNesting(Runnable action)
focal_class.identifier: visitWithNesting
focal_class.modifiers: private
focal_class.parameters: (Runnable action)
focal_class.return: void
focal_class.signature: void visitWithNesting(Runnable action)
focal_class.class_method_signature: CognitiveComplexityVisitor.visit(@Nullable Tree tree)
focal_class.full_signature: private void visit(@Nullable Tree tree)
focal_class.identifier: visit
focal_class.modifiers: private
focal_class.parameters: (@Nullable Tree tree)
focal_class.return: void
focal_class.signature: void visit(@Nullable Tree tree)
focal_class.class_method_signature: CognitiveComplexityVisitor.removeParenthesis(ExpressionTree expressionTree)
focal_class.full_signature: private static ExpressionTree removeParenthesis(ExpressionTree expressionTree)
focal_class.identifier: removeParenthesis
focal_class.modifiers: private static
focal_class.parameters: (ExpressionTree expressionTree)
focal_class.return: ExpressionTree
focal_class.signature: ExpressionTree removeParenthesis(ExpressionTree expressionTree)
focal_class.superclass: extends PHPVisitorCheck
focal_method.body: public static CognitiveComplexity complexity(FunctionTree functionTree) {
      CognitiveComplexityVisitor cognitiveComplexityVisitor = new CognitiveComplexityVisitor();
      cognitiveComplexityVisitor.scan(functionTree);
      return cognitiveComplexityVisitor.complexity;
    }
focal_method.class_method_signature: CognitiveComplexityVisitor.complexity(FunctionTree functionTree)
focal_method.full_signature: public static CognitiveComplexity complexity(FunctionTree functionTree)
focal_method.identifier: complexity
focal_method.invocations: scan
focal_method.modifiers: public static
focal_method.parameters: (FunctionTree functionTree)
focal_method.return: CognitiveComplexity
focal_method.signature: CognitiveComplexity complexity(FunctionTree functionTree)