Passed
Push — master ( 8a0962...507d84 )
by Paul
03:52
created
helpers.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,7 +4,8 @@  discard block
 block discarded – undo
4 4
 /**
5 5
  * @return mixed
6 6
  */
7
-function glsr( $alias = null ) {
7
+function glsr( $alias = null )
8
+{
8 9
 	$app = \GeminiLabs\SiteReviews\Application::load();
9 10
 	return !empty( $alias )
10 11
 		? $app->make( $alias )
@@ -14,7 +15,8 @@  discard block
 block discarded – undo
14 15
 /**
15 16
  * @return \WP_Screen|object
16 17
  */
17
-function glsr_current_screen() {
18
+function glsr_current_screen()
19
+{
18 20
 	if( function_exists( 'get_current_screen' )) {
19 21
 		$screen = get_current_screen();
20 22
 	}
@@ -26,7 +28,8 @@  discard block
 block discarded – undo
26 28
 /**
27 29
  * @return \GeminiLabs\SiteReviews\Database
28 30
  */
29
-function glsr_db() {
31
+function glsr_db()
32
+{
30 33
 	return glsr( 'Database' );
31 34
 }
32 35
 
@@ -34,7 +37,8 @@  discard block
 block discarded – undo
34 37
  * @param mixed ...$vars
35 38
  * @return void
36 39
  */
37
-function glsr_debug( ...$vars ) {
40
+function glsr_debug( ...$vars )
41
+{
38 42
 	if( count( $vars ) == 1 ) {
39 43
 		$value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
40 44
 		printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
@@ -51,7 +55,8 @@  discard block
 block discarded – undo
51 55
 /**
52 56
  * @return \GeminiLabs\SiteReviews\Modules\Console
53 57
  */
54
-function glsr_log() {
58
+function glsr_log()
59
+{
55 60
 	$args = func_get_args();
56 61
 	$context = isset( $args[1] )
57 62
 		? $args[1]
@@ -67,14 +72,16 @@  discard block
 block discarded – undo
67 72
  * @param mixed $fallback
68 73
  * @return string|array
69 74
  */
70
-function glsr_get_option( $path = '', $fallback = '' ) {
75
+function glsr_get_option( $path = '', $fallback = '' )
76
+{
71 77
 	return glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback );
72 78
 }
73 79
 
74 80
 /**
75 81
  * @return array
76 82
  */
77
-function glsr_get_options() {
83
+function glsr_get_options()
84
+{
78 85
 	return glsr( 'Database\OptionManager' )->get( 'settings' );
79 86
 }
80 87
 
@@ -82,7 +89,8 @@  discard block
 block discarded – undo
82 89
  * @param int $post_id
83 90
  * @return void|\GeminiLabs\SiteReviews\Review
84 91
  */
85
-function glsr_get_review( $post_id ) {
92
+function glsr_get_review( $post_id )
93
+{
86 94
 	$post = get_post( $post_id );
87 95
 	if( $post instanceof WP_Post ) {
88 96
 		return glsr( 'Database\ReviewManager' )->single( $post );
@@ -93,6 +101,7 @@  discard block
 block discarded – undo
93 101
  * @return array
94 102
  * @todo document change of $reviews->reviews to $reviews->results
95 103
  */
96
-function glsr_get_reviews( array $args = array() ) {
104
+function glsr_get_reviews( array $args = array() )
105
+{
97 106
 	return glsr( 'Database\ReviewManager' )->get( $args );
98 107
 }
Please login to merge, or discard this patch.
plugin/Modules/Rating.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,9 @@
 block discarded – undo
90 90
 	{
91 91
 		$total = array_sum( $ratingCounts );
92 92
 		foreach( $ratingCounts as $index => $count ) {
93
-			if( empty( $count ))continue;
93
+			if( empty( $count )) {
94
+				continue;
95
+			}
94 96
 			$ratingCounts[$index] = $count / $total * 100;
95 97
 		}
96 98
 		return $this->getRoundedPercentages( $ratingCounts );
Please login to merge, or discard this patch.
plugin/Database/QueryBuilder.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,9 +16,13 @@  discard block
 block discarded – undo
16 16
 	{
17 17
 		$queries = [];
18 18
 		foreach( $keys as $key ) {
19
-			if( !array_key_exists( $key, $values ))continue;
19
+			if( !array_key_exists( $key, $values )) {
20
+				continue;
21
+			}
20 22
 			$methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ );
21
-			if( !method_exists( $this, $methodName ))continue;
23
+			if( !method_exists( $this, $methodName )) {
24
+				continue;
25
+			}
22 26
 			$query = call_user_func( [$this, $methodName], $values[$key] );
23 27
 			if( is_array( $query )) {
24 28
 				$queries[] = $query;
@@ -35,7 +39,9 @@  discard block
 block discarded – undo
35 39
 		$string = '';
36 40
 		$values = array_filter( $values );
37 41
 		foreach( $conditions as $key => $value ) {
38
-			if( !isset( $values[$key] ))continue;
42
+			if( !isset( $values[$key] )) {
43
+				continue;
44
+			}
39 45
 			$values[$key] = implode( ',', (array)$values[$key] );
40 46
 			$string .= strpos( $value, '%s' ) !== false
41 47
 				? sprintf( $value, strval( $values[$key] ))
@@ -109,7 +115,9 @@  discard block
 block discarded – undo
109 115
 	 */
110 116
 	protected function buildQueryAssignedTo( $value )
111 117
 	{
112
-		if( empty( $value ))return;
118
+		if( empty( $value )) {
119
+			return;
120
+		}
113 121
 		return [
114 122
 			'compare' => 'IN',
115 123
 			'key' => 'assigned_to',
@@ -123,7 +131,9 @@  discard block
 block discarded – undo
123 131
 	 */
124 132
 	protected function buildQueryCategory( $value )
125 133
 	{
126
-		if( empty( $value ))return;
134
+		if( empty( $value )) {
135
+			return;
136
+		}
127 137
 		return [
128 138
 			'field' => 'term_id',
129 139
 			'taxonomy' => Application::TAXONOMY,
@@ -137,7 +147,9 @@  discard block
 block discarded – undo
137 147
 	 */
138 148
 	protected function buildQueryRating( $value )
139 149
 	{
140
-		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return;
150
+		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) {
151
+			return;
152
+		}
141 153
 		return [
142 154
 			'compare' => '>=',
143 155
 			'key' => 'rating',
@@ -151,7 +163,9 @@  discard block
 block discarded – undo
151 163
 	 */
152 164
 	protected function buildQueryType( $value )
153 165
 	{
154
-		if( in_array( $value, ['','all'] ))return;
166
+		if( in_array( $value, ['','all'] )) {
167
+			return;
168
+		}
155 169
 		return [
156 170
 			'key' => 'review_type',
157 171
 			'value' => $value,
Please login to merge, or discard this patch.
plugin/Database.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 		if( empty( $assignedTo )) {
24 24
 			$assignedTo = get_post_meta( $postId, 'assigned_to', true );
25 25
 		}
26
-		if( empty( $assignedTo ))return;
26
+		if( empty( $assignedTo )) {
27
+			return;
28
+		}
27 29
 		$assignedPost = get_post( $assignedTo );
28 30
 		if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) {
29 31
 			return $assignedPost;
@@ -112,7 +114,9 @@  discard block
 block discarded – undo
112 114
 		add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
113 115
 		$search = new WP_Query( $args );
114 116
 		remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
115
-		if( !$search->have_posts() )return;
117
+		if( !$search->have_posts() ) {
118
+			return;
119
+		}
116 120
 		$results = '';
117 121
 		while( $search->have_posts() ) {
118 122
 			$search->the_post();
Please login to merge, or discard this patch.
plugin/Modules/Html/Builder.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -81,7 +81,9 @@  discard block
 block discarded – undo
81 81
 		];
82 82
 		if( !isset( $properties[$property] )
83 83
 			|| empty( array_filter( [$value], $properties[$property] ))
84
-		)return;
84
+		) {
85
+			return;
86
+		}
85 87
 		$this->$property = $value;
86 88
 	}
87 89
 
@@ -90,7 +92,9 @@  discard block
 block discarded – undo
90 92
 	 */
91 93
 	public function getClosingTag()
92 94
 	{
93
-		if( empty( $this->tag ))return;
95
+		if( empty( $this->tag )) {
96
+			return;
97
+		}
94 98
 		return '</'.$this->tag.'>';
95 99
 	}
96 100
 
@@ -99,7 +103,9 @@  discard block
 block discarded – undo
99 103
 	 */
100 104
 	public function getOpeningTag()
101 105
 	{
102
-		if( empty( $this->tag ))return;
106
+		if( empty( $this->tag )) {
107
+			return;
108
+		}
103 109
 		$attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString();
104 110
 		return '<'.trim( $this->tag.' '.$attributes ).'>';
105 111
 	}
@@ -141,7 +147,9 @@  discard block
 block discarded – undo
141 147
 	 */
142 148
 	protected function buildFieldDescription()
143 149
 	{
144
-		if( empty( $this->args['description'] ))return;
150
+		if( empty( $this->args['description'] )) {
151
+			return;
152
+		}
145 153
 		if( $this->args['is_widget'] ) {
146 154
 			return $this->small( $this->args['description'] );
147 155
 		}
@@ -207,7 +215,9 @@  discard block
 block discarded – undo
207 215
 	 */
208 216
 	protected function buildFormLabel( array $customArgs = [] )
209 217
 	{
210
-		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return;
218
+		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) {
219
+			return;
220
+		}
211 221
 		return $this->label( wp_parse_args( $customArgs, [
212 222
 			'for' => $this->args['id'],
213 223
 			'is_public' => $this->args['is_public'],
Please login to merge, or discard this patch.
compatibility.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,6 +17,8 @@
 block discarded – undo
17 17
  * @return void
18 18
  */
19 19
 add_action( 'site-reviews/customize/divi', function( $instance ) {
20
-	if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' )return;
20
+	if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' ) {
21
+		return;
22
+	}
21 23
 	$instance->args['text'] = '<i></i>'.$instance->args['text'];
22 24
 });
Please login to merge, or discard this patch.
plugin/Review.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@  discard block
 block discarded – undo
68 68
 		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
69 69
 		$this->modified = $this->isModified( $properties );
70 70
 		array_walk( $properties, function( $value, $key ) {
71
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
71
+			if( !property_exists( $this, $key ) || isset( $this->$key )) {
72
+				return;
73
+			}
72 74
 			$this->$key = $value;
73 75
 		});
74 76
 	}
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
 	protected function setTermIds( WP_Post $post )
80 82
 	{
81 83
 		$this->term_ids = [];
82
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
84
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) {
85
+			return;
86
+		}
83 87
 		foreach( $terms as $term ) {
84 88
 			$this->term_ids[] = $term->term_id;
85 89
 		}
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -88,7 +88,9 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function registerMetaBoxes( $postType )
90 90
 	{
91
-		if( $postType != Application::POST_TYPE )return;
91
+		if( $postType != Application::POST_TYPE ) {
92
+			return;
93
+		}
92 94
 		add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
93 95
 		add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
94 96
 		add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
@@ -118,7 +120,9 @@  discard block
 block discarded – undo
118 120
 	 */
119 121
 	public function renderAssignedToMetabox( WP_Post $post )
120 122
 	{
121
-		if( !$this->isReviewPostType( $post ))return;
123
+		if( !$this->isReviewPostType( $post )) {
124
+			return;
125
+		}
122 126
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
123 127
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
124 128
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
@@ -133,7 +137,9 @@  discard block
 block discarded – undo
133 137
 	 */
134 138
 	public function renderDetailsMetaBox( WP_Post $post )
135 139
 	{
136
-		if( !$this->isReviewPostType( $post ))return;
140
+		if( !$this->isReviewPostType( $post )) {
141
+			return;
142
+		}
137 143
 		$review = glsr( ReviewManager::class )->single( $post );
138 144
 		glsr()->render( 'partials/editor/metabox-details', [
139 145
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
@@ -147,7 +153,9 @@  discard block
 block discarded – undo
147 153
 	 */
148 154
 	public function renderPinnedInPublishMetaBox()
149 155
 	{
150
-		if( !$this->isReviewPostType( get_post() ))return;
156
+		if( !$this->isReviewPostType( get_post() )) {
157
+			return;
158
+		}
151 159
 		glsr( Html::class )->renderTemplate( 'partials/editor/pinned', [
152 160
 			'context' => [
153 161
 				'no' => __( 'No', 'site-reviews' ),
@@ -163,7 +171,9 @@  discard block
 block discarded – undo
163 171
 	 */
164 172
 	public function renderResponseMetaBox( WP_Post $post )
165 173
 	{
166
-		if( !$this->isReviewPostType( $post ))return;
174
+		if( !$this->isReviewPostType( $post )) {
175
+			return;
176
+		}
167 177
 		wp_nonce_field( 'response', '_nonce-response', false );
168 178
 		glsr()->render( 'partials/editor/metabox-response', [
169 179
 			'response' => get_post_meta( $post->ID, 'response', true ),
@@ -177,7 +187,9 @@  discard block
 block discarded – undo
177 187
 	 */
178 188
 	public function renderTaxonomyMetabox( WP_Post $post )
179 189
 	{
180
-		if( !$this->isReviewPostType( $post ))return;
190
+		if( !$this->isReviewPostType( $post )) {
191
+			return;
192
+		}
181 193
 		glsr()->render( 'partials/editor/metabox-categories', [
182 194
 			'post' => $post,
183 195
 			'tax_name' => Application::TAXONOMY,
@@ -215,7 +227,9 @@  discard block
 block discarded – undo
215 227
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
216 228
 	{
217 229
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
218
-		if( !( $assignedPost instanceof WP_Post ))return;
230
+		if( !( $assignedPost instanceof WP_Post )) {
231
+			return;
232
+		}
219 233
 		return glsr( Html::class )->buildTemplate( 'partials/editor/assigned-post', [
220 234
 			'context' => [
221 235
 				'data.url' => (string)get_permalink( $assignedPost ),
@@ -256,7 +270,9 @@  discard block
 block discarded – undo
256 270
 	 */
257 271
 	protected function getReviewType( $review )
258 272
 	{
259
-		if( count( glsr()->reviewTypes ) < 2 )return;
273
+		if( count( glsr()->reviewTypes ) < 2 ) {
274
+			return;
275
+		}
260 276
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
261 277
 			? glsr()->reviewTypes[$review->review_type]
262 278
 			: __( 'Unknown', 'site-reviews' );
Please login to merge, or discard this patch.
plugin/Modules/Upgrader.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 		natsort( $routines );
18 18
 		array_walk( $routines, function( $routine ) {
19 19
 			$parts = explode( '__', $routine );
20
-			if( version_compare( glsr()->version, end( $parts ), '<' ))return;
20
+			if( version_compare( glsr()->version, end( $parts ), '<' )) {
21
+				return;
22
+			}
21 23
 			call_user_func( [$this, $routine] );
22 24
 		});
23 25
 		$this->updateVersion();
Please login to merge, or discard this patch.