SimplePlugin   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A afterAction() 0 4 1
A afterHook() 0 4 1
A beforeAction() 0 4 1
A beforeHook() 0 4 1
1
<?php
2
3
namespace CaptainHook\App\Integration\Plugin;
4
5
use CaptainHook\App\Config;
6
use CaptainHook\App\Plugin\Hook as HookPlugin;
7
use CaptainHook\App\Plugin\Hook\Base;
8
use CaptainHook\App\Runner\Hook as RunnerHook;
9
10
class SimplePlugin extends Base implements HookPlugin
11
{
12
    public function beforeHook(RunnerHook $hook): void
13
    {
14
        $stuff = $this->plugin->getOptions()->get('stuff');
15
        $this->io->write("Do {$stuff} before {$hook->getName()} runs");
16
    }
17
18
    public function beforeAction(RunnerHook $hook, Config\Action $action): void
19
    {
20
        $stuff = $this->plugin->getOptions()->get('stuff');
21
        $this->io->write("Do {$stuff} before action {$action->getAction()} runs");
22
    }
23
24
    public function afterAction(RunnerHook $hook, Config\Action $action): void
25
    {
26
        $stuff = $this->plugin->getOptions()->get('stuff');
27
        $this->io->write("Do {$stuff} after action {$action->getAction()} runs");
28
    }
29
30
    public function afterHook(RunnerHook $hook): void
31
    {
32
        $stuff = $this->plugin->getOptions()->get('stuff');
33
        $this->io->write("Do {$stuff} after {$hook->getName()} runs");
34
    }
35
}
36