Passed
Push — main ( 799be8...9a05b8 )
by Sebastian
04:00
created

PrepareCommitMsg::afterAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
/**
4
 * This file is part of CaptainHook
5
 *
6
 * (c) Sebastian Feldmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CaptainHook\App\Runner\Hook;
13
14
use CaptainHook\App\Hooks;
15
16
/**
17
 *  Hook
18
 *
19
 * @package CaptainHook
20
 * @author  Sebastian Feldmann <[email protected]>
21
 * @link    https://github.com/captainhook-git/captainhook
22
 * @since   Class available since Release 3.1.0
23
 */
24
class PrepareCommitMsg extends MessageAware
25
{
26
    /**
27
     * Hook to execute
28
     *
29
     * @var string
30
     */
31
    protected string $hook = Hooks::PREPARE_COMMIT_MSG;
32
33
    /**
34
     * Commit mode, empty or [message|template|merge|squash|commit]
35
     *
36
     * @var string
37
     */
38
    protected string $mode;
39
40
    /**
41
     * Commit hash if mode is commit during -c or --amend
42
     *
43
     * @var string
44
     */
45
    protected string $hash;
46
47
    /**
48
     * Fetch the original hook arguments and message related config settings
49
     *
50
     * @return void
51
     */
52 3
    public function beforeHook(): void
53
    {
54 3
        $this->mode = $this->io->getArgument(Hooks::ARG_MODE);
55 3
        $this->hash = $this->io->getArgument(Hooks::ARG_HASH);
56
57 3
        parent::beforeHook();
58
    }
59
}
60