Hook::config()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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\Event;
13
14
use CaptainHook\App\Config;
15
use CaptainHook\App\Console\IO;
16
use CaptainHook\App\Event;
17
use SebastianFeldmann\Git\Repository;
18
19
/**
20
 * Basic event class
21
 *
22
 * Makes sure the handler has access to the output the current app setup and the repository.
23
 *
24
 * @package CaptainHook
25
 * @author  Sebastian Feldmann <[email protected]>
26
 * @link    https://github.com/captainhook-git/captainhook
27
 * @since   Class available since Release 5.11.0
28
 */
29
abstract class Hook implements Event
30
{
31
    /**
32
     * @var string
33
     */
34
    protected $name;
35
36
    /**
37
     * @var \CaptainHook\App\Console\IO
38
     */
39
    protected $io;
40
41
    /**
42
     * @var \CaptainHook\App\Config
43
     */
44
    protected $config;
45
46
    /**
47
     * @var \SebastianFeldmann\Git\Repository
48
     */
49
    protected $repository;
50
51
    /**
52
     * Event
53
     *
54
     * @param \CaptainHook\App\Console\IO       $io
55
     * @param \CaptainHook\App\Config           $config
56
     * @param \SebastianFeldmann\Git\Repository $repository
57
     */
58 26
    public function __construct(IO $io, Config $config, Repository $repository)
59
    {
60 26
        $this->io         = $io;
61 26
        $this->config     = $config;
62 26
        $this->repository = $repository;
63
    }
64
65
    /**
66
     * @return string
67
     */
68 21
    public function name(): string
69
    {
70 21
        return $this->name;
71
    }
72
73
    /**
74
     * @return \CaptainHook\App\Config
75
     */
76 1
    public function config(): Config
77
    {
78 1
        return $this->config;
79
    }
80
81
    /**
82
     * @return \CaptainHook\App\Console\IO
83
     */
84 3
    public function io(): IO
85
    {
86 3
        return $this->io;
87
    }
88
89
    /**
90
     * @return \SebastianFeldmann\Git\Repository
91
     */
92 2
    public function repository(): Repository
93
    {
94 2
        return $this->repository;
95
    }
96
}
97