Passed
Push — master ( dfcc60...d308ca )
by Paul
03:56
created
plugin/Defaults/DefaultsAbstract.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	 */
14 14
 	public function __call( $name, array $args = [] )
15 15
 	{
16
-		if( !method_exists( $this, $name ))return;
16
+		if( !method_exists( $this, $name ) )return;
17 17
 		$defaults = call_user_func_array( [$this, $name], $args );
18 18
 		$hookName = (new ReflectionClass( $this ))->getShortName();
19 19
 		$hookName = str_replace( 'Defaults', '', $hookName );
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@
 block discarded – undo
13 13
 	 */
14 14
 	public function __call( $name, array $args = [] )
15 15
 	{
16
-		if( !method_exists( $this, $name ))return;
16
+		if( !method_exists( $this, $name )) {
17
+			return;
18
+		}
17 19
 		$defaults = call_user_func_array( [$this, $name], $args );
18 20
 		$hookName = (new ReflectionClass( $this ))->getShortName();
19 21
 		$hookName = str_replace( 'Defaults', '', $hookName );
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function enqueueAssets()
27 27
 	{
28
-		$command = new EnqueueAdminAssets([
28
+		$command = new EnqueueAdminAssets( [
29 29
 			'pointers' => [[
30 30
 				'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
31 31
 				'id' => 'glsr-pointer-pinned',
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 				'target' => '#misc-pub-pinned',
38 38
 				'title' => __( 'Pin Your Reviews', 'site-reviews' ),
39 39
 			]],
40
-		]);
40
+		] );
41 41
 		$this->execute( $command );
42 42
 	}
43 43
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	{
50 50
 		$links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
51 51
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
52
-		]);
52
+		] );
53 53
 		return $links;
54 54
 	}
55 55
 
@@ -60,19 +60,19 @@  discard block
 block discarded – undo
60 60
 	public function filterDashboardGlanceItems( array $items )
61 61
 	{
62 62
 		$postCount = wp_count_posts( Application::POST_TYPE );
63
-		if( empty( $postCount->publish )) {
63
+		if( empty($postCount->publish) ) {
64 64
 			return $items;
65 65
 		}
66 66
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
67
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
67
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
68 68
 		$items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts )
69 69
 			? glsr( Builder::class )->a( $text, [
70 70
 				'class' => 'glsr-review-count',
71 71
 				'href' => 'edit.php?post_type='.Application::POST_TYPE,
72
-			])
72
+			] )
73 73
 			: glsr( Builder::class )->span( $text, [
74 74
 				'class' => 'glsr-review-count',
75
-			]);
75
+			] );
76 76
 		return $items;
77 77
 	}
78 78
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	public function filterTinymcePlugins( array $plugins )
84 84
 	{
85 85
 		if( user_can_richedit()
86
-			&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
86
+			&& (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) {
87 87
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
88 88
 		}
89 89
 		return $plugins;
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function registerShortcodeButtons()
97 97
 	{
98
-		$command = new RegisterShortcodeButtons([
98
+		$command = new RegisterShortcodeButtons( [
99 99
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
100 100
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
101 101
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
102
-		]);
102
+		] );
103 103
 		$this->execute( $command );
104 104
 	}
105 105
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function renderReviewEditor( WP_Post $post )
111 111
 	{
112
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
112
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
113 113
 		glsr()->render( 'partials/editor/review', [
114 114
 			'post' => $post,
115
-		]);
115
+		] );
116 116
 	}
117 117
 
118 118
 	/**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function renderReviewNotice( WP_Post $post )
123 123
 	{
124
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
125
-		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
124
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
125
+		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) );
126 126
 		glsr( Html::class )->renderTemplate( 'partials/editor/notice', [
127 127
 			'context' => [
128 128
 				'notices' => glsr( Notice::class )->get(),
129 129
 			],
130
-		]);
130
+		] );
131 131
 	}
132 132
 
133 133
 	/**
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
142 142
 			$shortcodes[$shortcode] = $values;
143 143
 		}
144
-		if( empty( $shortcodes ))return;
144
+		if( empty($shortcodes) )return;
145 145
 		glsr()->render( 'partials/editor/tinymce', [
146 146
 			'shortcodes' => $shortcodes,
147
-		]);
147
+		] );
148 148
 	}
149 149
 
150 150
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	public function routerClearConsole()
154 154
 	{
155 155
 		glsr( Console::class )->clear();
156
-		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ));
156
+		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) );
157 157
 	}
158 158
 
159 159
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public function routerFetchConsole()
163 163
 	{
164
-		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ));
164
+		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) );
165 165
 	}
166 166
 
167 167
 	/**
@@ -170,19 +170,19 @@  discard block
 block discarded – undo
170 170
 	public function routerCountReviews()
171 171
 	{
172 172
 		$countManager = glsr( CountsManager::class );
173
-		$terms = get_terms([
173
+		$terms = get_terms( [
174 174
 			'hide_empty' => true,
175 175
 			'taxonomy' => Application::TAXONOMY,
176
-		]);
176
+		] );
177 177
 		foreach( $terms as $term ) {
178
-			$countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ));
178
+			$countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ) );
179 179
 		}
180 180
 		$postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' );
181 181
 		foreach( $postIds as $postId ) {
182
-			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ));
182
+			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) );
183 183
 		}
184 184
 		$countManager->setCounts( $countManager->buildCounts() );
185
-		glsr( Notice::class )->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ));
185
+		glsr( Notice::class )->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) );
186 186
 	}
187 187
 
188 188
 	/**
@@ -216,17 +216,17 @@  discard block
 block discarded – undo
216 216
 	{
217 217
 		$file = $_FILES['import-file'];
218 218
 		if( $file['error'] !== UPLOAD_ERR_OK ) {
219
-			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ));
219
+			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
220 220
 		}
221
-		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) {
222
-			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ));
221
+		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
222
+			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
223 223
 		}
224 224
 		$settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
225
-		if( empty( $settings )) {
226
-			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ));
225
+		if( empty($settings) ) {
226
+			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
227 227
 		}
228
-		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ));
229
-		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ));
228
+		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
229
+		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
230 230
 	}
231 231
 
232 232
 	/**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
245 245
 			UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
246 246
 		];
247
-		return !isset( $errors[$errorCode] )
247
+		return !isset($errors[$errorCode])
248 248
 			? __( 'Unknown upload error.', 'site-reviews' )
249 249
 			: $errors[$errorCode];
250 250
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -109,7 +109,9 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function renderReviewEditor( WP_Post $post )
111 111
 	{
112
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
112
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
113
+			return;
114
+		}
113 115
 		glsr()->render( 'partials/editor/review', [
114 116
 			'post' => $post,
115 117
 		]);
@@ -121,7 +123,9 @@  discard block
 block discarded – undo
121 123
 	 */
122 124
 	public function renderReviewNotice( WP_Post $post )
123 125
 	{
124
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
126
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
127
+			return;
128
+		}
125 129
 		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
126 130
 		glsr( Html::class )->renderTemplate( 'partials/editor/notice', [
127 131
 			'context' => [
@@ -136,12 +140,16 @@  discard block
 block discarded – undo
136 140
 	 */
137 141
 	public function renderTinymceButton()
138 142
 	{
139
-		if( glsr_current_screen()->base != 'post' )return;
143
+		if( glsr_current_screen()->base != 'post' ) {
144
+			return;
145
+		}
140 146
 		$shortcodes = [];
141 147
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
142 148
 			$shortcodes[$shortcode] = $values;
143 149
 		}
144
-		if( empty( $shortcodes ))return;
150
+		if( empty( $shortcodes )) {
151
+			return;
152
+		}
145 153
 		glsr()->render( 'partials/editor/tinymce', [
146 154
 			'shortcodes' => $shortcodes,
147 155
 		]);
Please login to merge, or discard this patch.
plugin/Modules/Console.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function get()
110 110
 	{
111
-		return empty( $this->log )
111
+		return empty($this->log)
112 112
 			? __( 'Console is empty', 'site-reviews' )
113 113
 			: $this->log;
114 114
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	public function humanSize( $valueIfEmpty = null )
121 121
 	{
122 122
 		$bytes = $this->size();
123
-		if( empty( $bytes ) && is_string( $valueIfEmpty )) {
123
+		if( empty($bytes) && is_string( $valueIfEmpty ) ) {
124 124
 			return $valueIfEmpty;
125 125
 		}
126
-		$exponent = floor( log( max( $bytes, 1 ), 1024 ));
127
-		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent];
126
+		$exponent = floor( log( max( $bytes, 1 ), 1024 ) );
127
+		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent];
128 128
 	}
129 129
 
130 130
 	/**
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	public function log( $level, $message, array $context = [] )
148 148
 	{
149 149
 		$constants = (new ReflectionClass( __CLASS__ ))->getConstants();
150
-		if( in_array( $level, $constants, true )) {
150
+		if( in_array( $level, $constants, true ) ) {
151 151
 			$entry = $this->buildLogEntry( $level, $message, $context );
152
-			file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX );
152
+			file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX );
153 153
 			$this->reset();
154 154
 		}
155 155
 		return $this;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	protected function interpolate( $message, $context = [] )
224 224
 	{
225
-		if( $this->isObjectOrArray( $message ) || !is_array( $context )) {
225
+		if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) {
226 226
 			return print_r( $message, true );
227 227
 		}
228 228
 		$replace = [];
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		if( $value instanceof DateTime ) {
251 251
 			$value = $value->format( 'Y-m-d H:i:s' );
252 252
 		}
253
-		else if( $this->isObjectOrArray( $value )) {
253
+		else if( $this->isObjectOrArray( $value ) ) {
254 254
 			$value = json_encode( $value );
255 255
 		}
256 256
 		return (string)$value;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->clear();
266 266
 			file_put_contents(
267 267
 				$this->file,
268
-				$this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ))
268
+				$this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ) )
269 269
 			);
270 270
 		}
271 271
 	}
Please login to merge, or discard this patch.