WhitespaceFinder::findNextEmptyLinePosition()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of Zenify
7
 * Copyright (c) 2012 Tomas Votruba (http://tomasvotruba.cz)
8
 */
9
10
namespace ZenifyCodingStandard\Helper\Whitespace;
11
12
use PHP_CodeSniffer_File;
13
14
15
final class WhitespaceFinder
16
{
17
18 1
	public static function findNextEmptyLinePosition(PHP_CodeSniffer_File $file, int $position) : int
19
	{
20 1
		$tokens = $file->getTokens();
21
22 1
		$currentLine = $tokens[$position]['line'];
23 1
		$nextLinePosition = $position;
24
		do {
25 1
			++$nextLinePosition;
26 1
			$nextLine = $tokens[$nextLinePosition]['line'];
27 1
		} while ($currentLine === $nextLine);
28
29 1
		return $nextLinePosition;
30
	}
31
32
}
33