Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Commands
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 get
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celema\Quma;
6
7use Celema\Console\Commands as BaseCommands;
8use Celema\Quma\Commands\Add;
9use Celema\Quma\Commands\CreateMigrationsTable;
10use Celema\Quma\Commands\Migrations;
11use Celema\Quma\Contract\MigrationFactory;
12
13/** @api */
14class Commands
15{
16    /** @param array<non-empty-string, Connection>|Connection $conn */
17    public static function get(
18        array|Connection $conn,
19        array $options = [],
20        ?MigrationFactory $migrationFactory = null,
21    ): BaseCommands {
22        // Factories keep registration cheap: no Environment is built unless
23        // the command actually runs.
24        return new BaseCommands([
25            Add::class => static fn(): Add => new Add($conn, $options),
26            CreateMigrationsTable::class => static fn(): CreateMigrationsTable => new CreateMigrationsTable(
27                $conn,
28                $options,
29            ),
30            Migrations::class => static fn(): Migrations => new Migrations(
31                $conn,
32                $options,
33                $migrationFactory,
34            ),
35        ]);
36    }
37}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

Commands->get
18        array|Connection $conn,
19        array $options = [],
20        ?MigrationFactory $migrationFactory = null,
21    ): BaseCommands {
22        // Factories keep registration cheap: no Environment is built unless
23        // the command actually runs.
24        return new BaseCommands([
25            Add::class => static fn(): Add => new Add($conn, $options),
26            CreateMigrationsTable::class => static fn(): CreateMigrationsTable => new CreateMigrationsTable(
27                $conn,
28                $options,
29            ),
30            Migrations::class => static fn(): Migrations => new Migrations(
31                $conn,
32                $options,
33                $migrationFactory,
34            ),
35        ]);
36    }
{closure:/workspace/celema/quma/src/Commands.php:25-25}
25            Add::class => static fn(): Add => new Add($conn, $options),
{closure:/workspace/celema/quma/src/Commands.php:26-29}
26            CreateMigrationsTable::class => static fn(): CreateMigrationsTable => new CreateMigrationsTable(
27                $conn,
28                $options,
29            ),
{closure:/workspace/celema/quma/src/Commands.php:30-34}
30            Migrations::class => static fn(): Migrations => new Migrations(
31                $conn,
32                $options,
33                $migrationFactory,
34            ),