Conditions | 7 |
Paths | 8 |
Total Lines | 41 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
20 | public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ) { |
||
21 | |||
22 | $hooks = wordpoints_hooks(); |
||
23 | |||
24 | /** @var WordPoints_Hook_Reactor $reactor */ |
||
25 | foreach ( $hooks->reactors->get_all() as $reactor ) { |
||
26 | |||
27 | foreach ( $reactor->get_all_reactions_to_event( $event_slug ) as $reaction ) { |
||
28 | |||
29 | $validator = new WordPoints_Hook_Reaction_Validator( |
||
30 | $reaction |
||
31 | , $reactor |
||
32 | , true |
||
33 | ); |
||
34 | |||
35 | $validator->validate(); |
||
36 | |||
37 | if ( $validator->had_errors() ) { |
||
38 | continue; |
||
39 | } |
||
40 | |||
41 | $event_args->set_validator( $validator ); |
||
42 | $reaction = $validator; |
||
43 | |||
44 | /** @var WordPoints_Hook_Extension[] $extensions */ |
||
45 | $extensions = $hooks->extensions->get_all(); |
||
46 | |||
47 | foreach ( $extensions as $extension ) { |
||
48 | if ( ! $extension->should_hit( $reaction, $event_args ) ) { |
||
49 | continue 2; |
||
50 | } |
||
51 | } |
||
52 | |||
53 | $reactor->hit( $event_args, $reaction ); |
||
54 | |||
55 | foreach ( $extensions as $extension ) { |
||
56 | $extension->after_hit( $reaction, $event_args ); |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 | } |
||
61 | } |
||
64 |