Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Commands | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| get | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celema\Quma; |
| 6 | |
| 7 | use Celema\Console\Commands as BaseCommands; |
| 8 | use Celema\Quma\Commands\Add; |
| 9 | use Celema\Quma\Commands\CreateMigrationsTable; |
| 10 | use Celema\Quma\Commands\Migrations; |
| 11 | use Celema\Quma\Contract\MigrationFactory; |
| 12 | |
| 13 | /** @api */ |
| 14 | class 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 | } |
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.
| 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 | } |
| 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 | ), |