Menu

## LineCountingVisitor extends NodeVisitorAbstract
in package

LineCountingVisitor.php : 20

### Table of Contents

$comments : array<string|int, Comment>
$linesOfCode : int
$linesWithStatements : array<string|int, int>
__construct() : mixed
afterTraverse() : null|array<string|int, Node>
  Called once after traversal.
beforeTraverse() : null|array<string|int, Node>
  Called once before traversal.
enterNode() : null|int|Node
  Called when entering a node.
leaveNode() : null|int|Node|array<string|int, Node>
  Called when leaving a node.
result() : LinesOfCode
comments() : array<string|int, Comment>

### Properties

#### $comments

LineCountingVisitor.php : 30
`private array<string|int, Comment> $comments = []`

#### $linesOfCode

LineCountingVisitor.php : 25
`private int $linesOfCode`

#### $linesWithStatements

LineCountingVisitor.php : 35
`private array<string|int, int> $linesWithStatements = []`

### Methods

#### __construct()

LineCountingVisitor.php : 37
`public __construct(int $linesOfCode) : mixed`

##### Parameters

$linesOfCode : int

##### Return values

mixed —

#### afterTraverse()

NodeVisitorAbstract.php : 22

Called once after traversal.

`public afterTraverse(array<string|int, mixed> $nodes) : null|array<string|int, Node>`

Return value semantics:

- null: $nodes stays as-is
- otherwise: $nodes is set to the return value

##### Parameters

$nodes : array<string|int, mixed>

  Array of nodes

##### Return values

null|array<string|int, Node> —

Array of nodes

#### beforeTraverse()

NodeVisitorAbstract.php : 10

Called once before traversal.

`public beforeTraverse(array<string|int, mixed> $nodes) : null|array<string|int, Node>`

Return value semantics:

- null: $nodes stays as-is
- otherwise: $nodes is set to the return value

##### Parameters

$nodes : array<string|int, mixed>

  Array of nodes

##### Return values

null|array<string|int, Node> —

Array of nodes

#### enterNode()

LineCountingVisitor.php : 42

Called when entering a node.

`public enterNode(Node $node) : null|int|Node`

Return value semantics:

- null => $node stays as-is
- NodeTraverser::DONT_TRAVERSE_CHILDREN => Children of $node are not traversed. $node stays as-is
- NodeTraverser::STOP_TRAVERSAL => Traversal is aborted. $node stays as-is
- otherwise => $node is set to the return value

##### Parameters

$node : Node

  Node

##### Return values

null|int|Node —

Replacement node (or special return value)

#### leaveNode()

NodeVisitorAbstract.php : 18

Called when leaving a node.

`public leaveNode(Node $node) : null|int|Node|array<string|int, Node>`

Return value semantics:

- null => $node stays as-is
- NodeTraverser::REMOVE_NODE => $node is removed from the parent array
- NodeTraverser::STOP_TRAVERSAL => Traversal is aborted. $node stays as-is
- array (of Nodes) => The return value is merged into the parent array (at the position of the $node)
- otherwise => $node is set to the return value

##### Parameters

$node : Node

  Node

##### Return values

null|int|Node|array<string|int, Node> —

Replacement node (or special return value)

#### result()

LineCountingVisitor.php : 53
`public result() : LinesOfCode`

##### Return values

LinesOfCode —

#### comments()

LineCountingVisitor.php : 72
`private comments() : array<string|int, Comment>`

##### Return values

array<string|int, Comment> —

## Search results