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}