ShellPathCompletion   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 55
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getType() 0 4 1
A getCommandName() 0 4 1
A getTargetName() 0 4 1
A run() 0 4 1
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