Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| CreateMigrationsTable | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __invoke | |
100.00% |
2 / 2 |
|
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\Commands; |
| 6 | |
| 7 | use Celema\Console\Command; |
| 8 | use Celema\Console\Io; |
| 9 | use Celema\Console\Opt; |
| 10 | use Celema\Quma\Connection; |
| 11 | use Celema\Quma\Environment; |
| 12 | use Celema\Quma\Migrations\MetadataTable; |
| 13 | |
| 14 | #[Command('db:create-migrations-table', 'Creates a migrations table', group: 'Database')] |
| 15 | #[Opt('--conn', 'Connection to use', value: 'name')] |
| 16 | #[Opt('--stacktrace', 'Show stack traces for failing table creation')] |
| 17 | final class CreateMigrationsTable |
| 18 | { |
| 19 | private readonly Environment $env; |
| 20 | |
| 21 | /** @param array<non-empty-string, Connection>|Connection $conn */ |
| 22 | public function __construct(array|Connection $conn, array $options = []) |
| 23 | { |
| 24 | $this->env = new Environment($conn, $options); |
| 25 | } |
| 26 | |
| 27 | public function __invoke(Io $io): int |
| 28 | { |
| 29 | $env = $this->env; |
| 30 | |
| 31 | return new MetadataTable($env, $io)->create($env->db); |
| 32 | } |
| 33 | } |
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.
| 22 | public function __construct(array|Connection $conn, array $options = []) |
| 23 | { |
| 24 | $this->env = new Environment($conn, $options); |
| 25 | } |
| 27 | public function __invoke(Io $io): int |
| 28 | { |
| 29 | $env = $this->env; |
| 30 | |
| 31 | return new MetadataTable($env, $io)->create($env->db); |
| 32 | } |