Completed
Branch FET-10486-add-timestamp-checki... (611b15)
by
unknown
136:24 queued 121:17
created

AddActionHook   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 13 1
1
<?php
2
3
namespace EventEspresso\core\services\commands\middleware;
4
5
use Closure;
6
use EventEspresso\core\services\commands\CommandInterface;
7
8
defined('EVENT_ESPRESSO_VERSION') || exit;
9
10
11
12
/**
13
 * Class AddActionHook
14
 * Triggers a WordPress do_action() hook before each Command is executed
15
 *
16
 * @package       Event Espresso
17
 * @author        Brent Christensen
18
 * @since         $VID:$
19
 */
20
class AddActionHook implements CommandBusMiddlewareInterface
21
{
22
23
    /**
24
     * @param CommandInterface $command
25
     * @param Closure         $next
26
     * @return mixed
27
     */
28
    public function handle(CommandInterface $command, Closure $next)
29
    {
30
        do_action(
31
            'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__before',
32
            $command
33
        );
34
        $results = $next($command);
35
        do_action(
36
            'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__after',
37
            $command
38
        );
39
        return $results;
40
    }
41
}
42
// End of file AddActionHook.php
43
// Location: EventEspresso\core\services\commands\middleware/AddActionHook.php