Completed
Push — master ( 88991f...6ec29e )
by Jakub
01:26
created

PhpdbgEngine::collect()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 7
c 1
b 0
f 1
nc 4
nop 0
dl 0
loc 13
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace MyTester\CodeCoverage;
5
6
/**
7
 * Phpdbg engine for code coverage collector
8
 *
9
 * @author Jakub Konečný
10
 * @internal
11
 */
12
final class PhpdbgEngine implements \MyTester\ICodeCoverageEngine {
13
  public function getName(): string {
14
    return "phpdbg";
15
  }
16
17
  public function isAvailable(): bool {
18
    return PHP_SAPI === "phpdbg";
19
  }
20
21
  public function start(): void {
22
    phpdbg_start_oplog();
0 ignored issues
show
Bug introduced by
The function phpdbg_start_oplog was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
    /** @scrutinizer ignore-call */ 
23
    phpdbg_start_oplog();
Loading history...
23
  }
24
25
  public function collect(): array {
26
    $positive = phpdbg_end_oplog();
0 ignored issues
show
Bug introduced by
The function phpdbg_end_oplog was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
    $positive = /** @scrutinizer ignore-call */ phpdbg_end_oplog();
Loading history...
27
    $negative = phpdbg_get_executable();
0 ignored issues
show
Bug introduced by
The function phpdbg_get_executable was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
    $negative = /** @scrutinizer ignore-call */ phpdbg_get_executable();
Loading history...
28
29
    foreach($positive as $file => &$lines) {
30
      $lines = array_fill_keys(array_keys($lines), 1);
31
    }
32
33
    foreach($negative as $file => &$lines) {
34
      $lines = array_fill_keys(array_keys($lines), -1);
35
    }
36
37
    return [$positive, $negative];
38
  }
39
}
40
?>