@@ -17,55 +17,55 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @since 1.0.0 |
19 | 19 | */ |
20 | - public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ) { |
|
20 | + public function do_event($event_slug, WordPoints_Hook_Event_Args $event_args) { |
|
21 | 21 | |
22 | 22 | $hooks = wordpoints_hooks(); |
23 | 23 | |
24 | - $hits = $this->get_hits( $event_slug, $event_args ); |
|
24 | + $hits = $this->get_hits($event_slug, $event_args); |
|
25 | 25 | $reverse_hit_ids = array(); |
26 | 26 | |
27 | - foreach ( $hits as $hit ) { |
|
27 | + foreach ($hits as $hit) { |
|
28 | 28 | |
29 | 29 | /** @var WordPoints_Hook_Reactor $reactor */ |
30 | - $reactor = $hooks->reactors->get( $hit->reactor ); |
|
30 | + $reactor = $hooks->reactors->get($hit->reactor); |
|
31 | 31 | |
32 | - if ( ! $reactor instanceof WordPoints_Hook_Reactor_ReverseI ) { |
|
32 | + if ( ! $reactor instanceof WordPoints_Hook_Reactor_ReverseI) { |
|
33 | 33 | continue; |
34 | 34 | } |
35 | 35 | |
36 | - $reactions = $reactor->get_reaction_store( $hit->reaction_store ); |
|
36 | + $reactions = $reactor->get_reaction_store($hit->reaction_store); |
|
37 | 37 | |
38 | 38 | if ( |
39 | 39 | ! $reactions |
40 | - || wp_json_encode( $reactions->get_context_id() ) !== $hit->reaction_context_id |
|
40 | + || wp_json_encode($reactions->get_context_id()) !== $hit->reaction_context_id |
|
41 | 41 | ) { |
42 | 42 | continue; |
43 | 43 | } |
44 | 44 | |
45 | - $reaction = $reactions->get_reaction( $hit->reaction_id ); |
|
45 | + $reaction = $reactions->get_reaction($hit->reaction_id); |
|
46 | 46 | |
47 | - if ( ! $reaction ) { |
|
47 | + if ( ! $reaction) { |
|
48 | 48 | continue; |
49 | 49 | } |
50 | 50 | |
51 | - $fire = new WordPoints_Hook_Fire( $this, $event_args, $reaction ); |
|
51 | + $fire = new WordPoints_Hook_Fire($this, $event_args, $reaction); |
|
52 | 52 | |
53 | - $reverse_hit_ids[ $hit->id ] = $fire->hit(); |
|
53 | + $reverse_hit_ids[$hit->id] = $fire->hit(); |
|
54 | 54 | |
55 | - $reactor->reverse_hit( $fire ); |
|
55 | + $reactor->reverse_hit($fire); |
|
56 | 56 | |
57 | 57 | /** @var WordPoints_Hook_Extension $extension */ |
58 | - foreach ( $hooks->extensions->get_all() as $extension ) { |
|
59 | - $extension->after_reverse( $fire ); |
|
58 | + foreach ($hooks->extensions->get_all() as $extension) { |
|
59 | + $extension->after_reverse($fire); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Set the reversed_by meta key for all hits so that we know that they have |
64 | 64 | // been reverse fired, even if they didn't hit. |
65 | - foreach ( $hits as $hit ) { |
|
65 | + foreach ($hits as $hit) { |
|
66 | 66 | |
67 | - if ( isset( $reverse_hit_ids[ $hit->id ] ) ) { |
|
68 | - $reversed_by = $reverse_hit_ids[ $hit->id ]; |
|
67 | + if (isset($reverse_hit_ids[$hit->id])) { |
|
68 | + $reversed_by = $reverse_hit_ids[$hit->id]; |
|
69 | 69 | } else { |
70 | 70 | $reversed_by = 0; |
71 | 71 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return object[] The data for each hit from the hit logs database table. |
92 | 92 | */ |
93 | - protected function get_hits( $event_slug, WordPoints_Hook_Event_Args $event_args ) { |
|
93 | + protected function get_hits($event_slug, WordPoints_Hook_Event_Args $event_args) { |
|
94 | 94 | |
95 | 95 | $query = new WordPoints_Hook_Hit_Query( |
96 | 96 | array( |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $hits = $query->get(); |
108 | 108 | |
109 | - if ( ! is_array( $hits ) ) { |
|
109 | + if ( ! is_array($hits)) { |
|
110 | 110 | return array(); |
111 | 111 | } |
112 | 112 |