ShellPathCompletion::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
4
namespace Stecman\Component\Symfony\Console\BashCompletion\Completion;
5
6
/**
7
 * Shell Path Completion
8
 *
9
 * Defers completion to the calling shell's built-in path completion functionality.
10
 */
11
class ShellPathCompletion implements CompletionInterface
12
{
13
    /**
14
     * Exit code set up to trigger path completion in the completion hooks
15
     * @see Stecman\Component\Symfony\Console\BashCompletion\HookFactory
16
     */
17
    const PATH_COMPLETION_EXIT_CODE = 200;
18
19
    protected $type;
20
21
    protected $commandName;
22
23
    protected $targetName;
24
25
    public function __construct($commandName, $targetName, $type)
26
    {
27
        $this->commandName = $commandName;
28
        $this->targetName = $targetName;
29
        $this->type = $type;
30
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function getType()
36
    {
37
        return $this->type;
38
    }
39
40
    /**
41
     * @inheritdoc
42
     */
43
    public function getCommandName()
44
    {
45
        return $this->commandName;
46
    }
47
48
    /**
49
     * @inheritdoc
50
     */
51
    public function getTargetName()
52
    {
53
        return $this->targetName;
54
    }
55
56
    /**
57
     * Exit with a status code configured to defer completion to the shell
58
     *
59
     * @see \Stecman\Component\Symfony\Console\BashCompletion\HookFactory::$hooks
60
     */
61
    public function run()
62
    {
63
        exit(self::PATH_COMPLETION_EXIT_CODE);
64
    }
65
}
66