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\Action; |
13
|
|
|
|
14
|
|
|
use CaptainHook\App\Config; |
15
|
|
|
use CaptainHook\App\Console\IO; |
16
|
|
|
use CaptainHook\App\Hook\Action as ActionInterface; |
17
|
|
|
use CaptainHook\App\Hook\Constrained as ConstrainInterface; |
18
|
|
|
use CaptainHook\App\Hook\Restriction; |
19
|
|
|
use SebastianFeldmann\Git\Repository; |
20
|
|
|
|
21
|
|
|
class DummyPHPConstraint implements ActionInterface, ConstrainInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Execute static action without errors or exceptions |
25
|
|
|
*/ |
26
|
|
|
public static function executeStatic() |
27
|
|
|
{ |
28
|
|
|
// do something fooish statically |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Execute action without errors or exceptions |
33
|
|
|
* |
34
|
|
|
* @param \CaptainHook\App\Config $config |
35
|
|
|
* @param \CaptainHook\App\Console\IO $io |
36
|
|
|
* @param \SebastianFeldmann\Git\Repository $repository |
37
|
|
|
* @param \CaptainHook\App\Config\Action $action |
38
|
|
|
* @return void |
39
|
|
|
*/ |
40
|
|
|
public function execute(Config $config, IO $io, Repository $repository, Config\Action $action): void |
41
|
|
|
{ |
42
|
|
|
// do something fooish |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Returns restriction value object |
47
|
|
|
* |
48
|
|
|
* @return \CaptainHook\App\Hook\Restriction |
49
|
|
|
*/ |
50
|
|
|
public static function getRestriction(): Restriction |
51
|
|
|
{ |
52
|
|
|
return Restriction::fromString('pre-commit'); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|