Conditions | 7 |
Paths | 8 |
Total Lines | 44 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
43 | public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ) { |
||
44 | |||
45 | $hooks = wordpoints_hooks(); |
||
46 | |||
47 | /** @var WordPoints_Hook_Reactor $reactor */ |
||
48 | foreach ( $hooks->reactors->get_all() as $reactor ) { |
||
49 | |||
50 | foreach ( $reactor->get_all_reactions_to_event( $event_slug ) as $reaction ) { |
||
51 | |||
52 | $validator = new WordPoints_Hook_Reaction_Validator( |
||
53 | $reaction |
||
54 | , $reactor |
||
55 | , true |
||
56 | ); |
||
57 | |||
58 | $validator->validate(); |
||
59 | |||
60 | if ( $validator->had_errors() ) { |
||
61 | continue; |
||
62 | } |
||
63 | |||
64 | unset( $validator ); |
||
65 | |||
66 | $fire = new WordPoints_Hook_Fire( $this, $event_args, $reaction ); |
||
67 | |||
68 | /** @var WordPoints_Hook_Extension[] $extensions */ |
||
69 | $extensions = $hooks->extensions->get_all(); |
||
70 | |||
71 | foreach ( $extensions as $extension ) { |
||
72 | if ( ! $extension->should_hit( $fire ) ) { |
||
73 | continue 2; |
||
74 | } |
||
75 | } |
||
76 | |||
77 | $fire->hit(); |
||
78 | |||
79 | $reactor->hit( $fire ); |
||
80 | |||
81 | foreach ( $extensions as $extension ) { |
||
82 | $extension->after_hit( $fire ); |
||
83 | } |
||
84 | } |
||
85 | } |
||
86 | } |
||
87 | } |
||
90 |