Completed
Push — master ( 344091...41b0ff )
by Pablo
04:39
created

PreCommitExecutor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 1
cbo 1
dl 0
loc 26
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isEnabled() 0 4 1
A getMessages() 0 4 1
commandName() 0 1 ?
1
<?php
2
3
namespace PhpGitHooks\Infrastructure\Common;
4
5
use PhpGitHooks\Application\Config\HookConfigInterface;
6
7
/**
8
 * Class PreCommitExecutor.
9
 */
10
abstract class PreCommitExecutor
11
{
12
    /** @var HookConfigInterface  */
13
    protected $preCommitConfig;
14
15
    /**
16
     * @return bool
17
     */
18
    protected function isEnabled()
19
    {
20
        return $this->preCommitConfig->isEnabled($this->commandName());
21
    }
22
23
    /**
24
     * @return array
25
     */
26
    protected function getMessages()
27
    {
28
        return $this->preCommitConfig->getMessages();
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    abstract protected function commandName();
35
}
36