final class CatalogCommand
Public API: explicitly declared with @visibility public.

The sql-catalog command.

Cataloguing a directory and reading the result from standard outputdoctest
$command = new \SqlCatalog\Cli\CatalogCommand();
    $result = $command->run(['--help']);
    $result->exitCode->value // => 0
    str_contains($result->output, 'sql-catalog') // => true

Methods§

public function __construct(
    Analyzer|null $analyzer = null,
    ReporterRegistry|null $reporters = null,
)

Parameters

$analyzerAnalyzer|nullThe analyzer to run, or null for one with the built-in extensions
$reportersReporterRegistry|nullThe reporters to render with, or null for the built-in ones
Calls 4
public function execute(CommandLine $command): CommandResult

Runs the command for an already parsed command line.

Parameters

$commandCommandLine

Throws

InvalidConfigurationException When the requested configuration cannot be loaded
InvalidCommandLineException When no path was given to analyze
SourceScanException When a path cannot be read
UnknownExtensionException When an extension is not registered
UnknownReporterException When the reporter is not registered
WriteFailureException When the report cannot be written
Test cases 2
Called from 1
Calls 5
public function configuredAnalyzer(Configuration $configuration): Analyzer

Loads the requested configuration, reporting failures as configuration errors.

Parameters

$configurationConfiguration

Returns

Throws

InvalidConfigurationException When loading or applying the configuration fails
Test cases 1
Called from 1
Calls 3
public function answerQuery(CommandLine $command): ?CommandResult

The answer to a command line that asks for information, or null when it does not.

Parameters

$commandCommandLine
Test cases 1
Called from 1
Calls 6
public function report(CommandLine $command, Catalog $catalog): CommandResult

Renders the catalog where the command line asked for it.

Parameters

$commandCommandLine
$catalogCatalog

Throws

UnknownReporterException When the reporter is not registered
WriteFailureException When the report cannot be written
Test cases 1
Called from 1
Calls 5
public function status(CommandLine $command, Catalog $catalog): ExitCode

What to tell the shell about the statements that were found.

Parameters

$commandCommandLine
$catalogCatalog

Returns

Test cases 1
Called from 1
Calls 2

Private surface 4§

Implementation details, listed for orientation only.

private Analyzer $analyzer
private ReporterRegistry $reporters
private CommandLineParser $parser
private ArtifactWriter $writer

Test cases 14§

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

Dedicated tests 14