final class Catalog
    implements IteratorAggregate<int, CatalogEntry>, Countable
Public API: explicitly declared with @visibility public.

Every statement the analyzed application can issue, and what stopped the analyzer.

Reading an empty catalogdoctest
$catalog = new \SqlCatalog\Core\Catalog\Catalog();
    $catalog->count() // => 0
    $catalog->entries() // => []

Methods§

public function __construct(
    list<CatalogEntry> $entries = [],
    list<AnalysisProblem> $problems = [],
    array<string, string> $sources = [],
)

Parameters

$entrieslist<CatalogEntry>The statements found, in reporting order
$problemslist<AnalysisProblem>The files that could not be analyzed
$sourcesarray<string, string>Source snapshots keyed by the reported file path
public function entries(): list<CatalogEntry>

The statements, in reporting order.

Returns

Test cases 1
public function source(string $file): ?string

The source as it was analyzed, or null when no snapshot was supplied.

Parameters

$filestring

Returns

?string
Test cases 1
Called from 1
public function find(string $id): ?CatalogEntry

The statement of that identifier, or null when the catalog has none.

Parameters

$idstring

Returns

Test cases 1
public function filter(callable(CatalogEntry): bool $keep): self

A catalog holding only the statements the given test keeps.

Parameters

$keepcallable(CatalogEntry): bool

Returns

self
Test cases 3
Called from 1
Calls 3
public function merge(self $other): self

A catalog holding these statements and the given ones.

Parameters

$otherself

Returns

self
Test cases 2
Calls 3
public function getIterator(): Traversable<int, CatalogEntry>

The statements, so a catalog can be walked directly.

Returns

Traversable<int, CatalogEntry>
Calls 1

Private surface 3§

Implementation details, listed for orientation only.

private list<CatalogEntry> $entries
private list<AnalysisProblem> $problems
private array<string, string> $sources

Test cases 161§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 9
Other tests reaching this symbol 152

Relations§

Instantiated in 2
Method calls 15
Type declarations 18