CommandProvider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the composer-link plugin.
7
 *
8
 * Copyright (c) 2021-2022 Sander Visser <[email protected]>.
9
 *
10
 * For the full copyright and license information, please view the LICENSE.md
11
 * file that was distributed with this source code.
12
 *
13
 * @link https://github.com/SanderSander/composer-link
14
 */
15
16
namespace ComposerLink;
17
18
use Composer\Command\BaseCommand;
19
use Composer\IO\IOInterface;
20
use Composer\Plugin\Capability\CommandProvider as ComposerCommandProvider;
21
use ComposerLink\Commands\LinkCommand;
22
use ComposerLink\Commands\LinkedCommand;
23
use ComposerLink\Commands\UnlinkCommand;
24
25
class CommandProvider implements ComposerCommandProvider
26
{
27
    protected IOInterface $io;
28
29
    protected Plugin $plugin;
30
31
    /**
32
     * @param array<string, mixed> $arguments
33
     */
34
    public function __construct(array $arguments)
35
    {
36
        $this->io = $arguments['io'];
37
        $this->plugin = $arguments['plugin'];
38
    }
39
40
    /**
41
     * @return BaseCommand[]
42
     */
43
    public function getCommands(): array
44
    {
45
        $this->io->debug("[ComposerLink]\tInitializing commands.");
46
47
        return [
48
            new LinkCommand($this->plugin),
49
            new UnlinkCommand($this->plugin),
50
            new LinkedCommand($this->plugin),
51
        ];
52
    }
53
}
54