Passed
Push — master ( 5487ff...589728 )
by Paul
03:51
created
helpers.php 1 patch
Braces   +30 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 		'glsr_log',
21 21
 		'glsr_star_rating',
22 22
 	);
23
-	if( !in_array( $hook, $hooks ) || !function_exists( $hook ))return;
23
+	if( !in_array( $hook, $hooks ) || !function_exists( $hook )) {
24
+		return;
25
+	}
24 26
 	add_filter( $hook, function() use( $hook, $args ) {
25 27
 		array_shift( $args ); // remove the fallback value
26 28
 		return call_user_func_array( $hook, $args );
@@ -30,7 +32,8 @@  discard block
 block discarded – undo
30 32
 /**
31 33
  * @return mixed
32 34
  */
33
-function glsr( $alias = null ) {
35
+function glsr( $alias = null )
36
+{
34 37
 	$app = \GeminiLabs\SiteReviews\Application::load();
35 38
 	return !empty( $alias )
36 39
 		? $app->make( $alias )
@@ -42,11 +45,14 @@  discard block
 block discarded – undo
42 45
  * @param $column string
43 46
  * @return array
44 47
  */
45
-function glsr_array_column( array $array, $column ) {
48
+function glsr_array_column( array $array, $column )
49
+{
46 50
 	$result = array();
47 51
 	foreach( $array as $subarray ) {
48 52
 		$subarray = (array)$subarray;
49
-		if( !isset( $subarray[$column] ))continue;
53
+		if( !isset( $subarray[$column] )) {
54
+			continue;
55
+		}
50 56
 		$result[] = $subarray[$column];
51 57
 	}
52 58
 	return $result;
@@ -55,7 +61,8 @@  discard block
 block discarded – undo
55 61
 /**
56 62
  * @return void
57 63
  */
58
-function glsr_calculate_ratings() {
64
+function glsr_calculate_ratings()
65
+{
59 66
 	glsr( 'Controllers\AdminController' )->routerCountReviews( false );
60 67
 	glsr_log()->info( __( 'Recalculated rating counts.', 'site-reviews' ));
61 68
 }
@@ -63,7 +70,8 @@  discard block
 block discarded – undo
63 70
 /**
64 71
  * @return \GeminiLabs\SiteReviews\Review|false
65 72
  */
66
-function glsr_create_review( $reviewValues = array() ) {
73
+function glsr_create_review( $reviewValues = array() )
74
+{
67 75
 	if( !is_array( $reviewValues )) {
68 76
 		$reviewValues = array();
69 77
 	}
@@ -74,7 +82,8 @@  discard block
 block discarded – undo
74 82
 /**
75 83
  * @return \WP_Screen|object
76 84
  */
77
-function glsr_current_screen() {
85
+function glsr_current_screen()
86
+{
78 87
 	if( function_exists( 'get_current_screen' )) {
79 88
 		$screen = get_current_screen();
80 89
 	}
@@ -87,7 +96,8 @@  discard block
 block discarded – undo
87 96
  * @param mixed ...$vars
88 97
  * @return void
89 98
  */
90
-function glsr_debug( ...$vars ) {
99
+function glsr_debug( ...$vars )
100
+{
91 101
 	if( count( $vars ) == 1 ) {
92 102
 		$value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
93 103
 		printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
@@ -106,7 +116,8 @@  discard block
 block discarded – undo
106 116
  * @param mixed $fallback
107 117
  * @return string|array
108 118
  */
109
-function glsr_get_option( $path = '', $fallback = '' ) {
119
+function glsr_get_option( $path = '', $fallback = '' )
120
+{
110 121
 	return is_string( $path )
111 122
 		? glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback )
112 123
 		: $fallback;
@@ -115,7 +126,8 @@  discard block
 block discarded – undo
115 126
 /**
116 127
  * @return array
117 128
  */
118
-function glsr_get_options() {
129
+function glsr_get_options()
130
+{
119 131
 	return glsr( 'Database\OptionManager' )->get( 'settings' );
120 132
 }
121 133
 
@@ -123,7 +135,8 @@  discard block
 block discarded – undo
123 135
  * @param int $post_id
124 136
  * @return \GeminiLabs\SiteReviews\Review
125 137
  */
126
-function glsr_get_review( $post_id ) {
138
+function glsr_get_review( $post_id )
139
+{
127 140
 	$post = null;
128 141
 	if( is_numeric( $post_id )) {
129 142
 		$post = get_post( $post_id );
@@ -137,7 +150,8 @@  discard block
 block discarded – undo
137 150
 /**
138 151
  * @return array
139 152
  */
140
-function glsr_get_reviews( $args = array() ) {
153
+function glsr_get_reviews( $args = array() )
154
+{
141 155
 	if( !is_array( $args )) {
142 156
 		$args = [];
143 157
 	}
@@ -147,7 +161,8 @@  discard block
 block discarded – undo
147 161
 /**
148 162
  * @return \GeminiLabs\SiteReviews\Modules\Console
149 163
  */
150
-function glsr_log() {
164
+function glsr_log()
165
+{
151 166
 	$args = func_get_args();
152 167
 	$context = isset( $args[1] )
153 168
 		? $args[1]
@@ -161,6 +176,7 @@  discard block
 block discarded – undo
161 176
 /**
162 177
  * @return string
163 178
  */
164
-function glsr_star_rating( $rating ) {
179
+function glsr_star_rating( $rating )
180
+{
165 181
 	return glsr( 'Modules\Html\Partial' )->build( 'star-rating', ['rating' => $rating] );
166 182
 }
Please login to merge, or discard this patch.