Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
DevToolsCommandProvider
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getCommands
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5/**
6 * Fast Forward Development Tools for PHP projects.
7 *
8 * This file is part of fast-forward/dev-tools project.
9 *
10 * @author   Felipe SayĆ£o Lobato Abreu <github@mentordosnerds.com>
11 * @license  https://opensource.org/licenses/MIT MIT License
12 *
13 * @see      https://github.com/php-fast-forward/
14 * @see      https://github.com/php-fast-forward/dev-tools
15 * @see      https://github.com/php-fast-forward/dev-tools/issues
16 * @see      https://php-fast-forward.github.io/dev-tools/
17 * @see      https://datatracker.ietf.org/doc/html/rfc2119
18 */
19
20namespace FastForward\DevTools\Composer\Capability;
21
22use Composer\Command\BaseCommand;
23use Composer\Plugin\Capability\CommandProvider;
24use FastForward\DevTools\Console\DevTools;
25
26/**
27 * Provides a registry of custom dev-tools commands mapped for Composer integration.
28 * This capability struct MUST implement the defined `CommandProvider`.
29 */
30 class DevToolsCommandProvider implements CommandProvider
31{
32    /**
33     * {@inheritDoc}
34     */
35    public function getCommands()
36    {
37        return array_values(array_filter(
38            DevTools::create()->all(),
39            static fn(object $command): bool => $command instanceof BaseCommand,
40        ));
41    }
42}