Completed
Branch code-coverage (571de7)
by Jakub
02:21
created

PhpdbgEngine::start()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace MyTester\CodeCoverage;
5
6
final class PhpdbgEngine implements \MyTester\ICodeCoverageEngine {
7
  public function getName(): string {
8
    return "phpdbg";
9
  }
10
11
  public function isAvailable(): bool {
12
    return PHP_SAPI === "phpdbg";
13
  }
14
15
  public function start(): void {
16
    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

16
    /** @scrutinizer ignore-call */ 
17
    phpdbg_start_oplog();
Loading history...
17
  }
18
19
  public function collect(): array {
20
    $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

20
    $positive = /** @scrutinizer ignore-call */ phpdbg_end_oplog();
Loading history...
21
    $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

21
    $negative = /** @scrutinizer ignore-call */ phpdbg_get_executable();
Loading history...
22
23
    foreach($positive as $file => &$lines) {
24
      $lines = array_fill_keys(array_keys($lines), 1);
25
    }
26
27
    foreach($negative as $file => &$lines) {
28
      $lines = array_fill_keys(array_keys($lines), -1);
29
    }
30
31
    return [$positive, $negative];
32
  }
33
}
34
?>