Passed
Push — master ( 9b46a7...ed8579 )
by Paul
03:56
created
plugin/Handlers/EnqueuePublicAssets.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function enqueuePolyfillService()
57 57
 	{
58
-		if( !apply_filters( 'site-reviews/assets/polyfill', true ))return;
58
+		if( !apply_filters( 'site-reviews/assets/polyfill', true )) {
59
+			return;
60
+		}
59 61
 		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([
60 62
 			'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event',
61 63
 			'flags' => 'gated',
@@ -70,7 +72,9 @@  discard block
 block discarded – undo
70 72
 		// wpforms-recaptcha
71 73
 		// google-recaptcha
72 74
 		// nf-google-recaptcha
73
-		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
75
+		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
76
+			return;
77
+		}
74 78
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
75 79
 		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
76 80
 			'hl' => $language,
@@ -84,7 +88,9 @@  discard block
 block discarded – undo
84 88
 	public function inlineStyles()
85 89
 	{
86 90
 		$inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' );
87
-		if( !apply_filters( 'site-reviews/assets/css', true ))return;
91
+		if( !apply_filters( 'site-reviews/assets/css', true )) {
92
+			return;
93
+		}
88 94
 		if( !file_exists( $inlineStylesheetPath )) {
89 95
 			glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath );
90 96
 			return;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function enqueueAssets()
29 29
 	{
30
-		if( apply_filters( 'site-reviews/assets/css', true )) {
30
+		if( apply_filters( 'site-reviews/assets/css', true ) ) {
31 31
 			wp_enqueue_style(
32 32
 				Application::ID,
33 33
 				$this->getStylesheet(),
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 				glsr()->version
36 36
 			);
37 37
 		}
38
-		if( apply_filters( 'site-reviews/assets/js', true )) {
38
+		if( apply_filters( 'site-reviews/assets/js', true ) ) {
39 39
 			$dependencies = apply_filters( 'site-reviews/assets/polyfill', true )
40 40
 				? [Application::ID.'/polyfill']
41 41
 				: [];
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function enqueuePolyfillService()
57 57
 	{
58
-		if( !apply_filters( 'site-reviews/assets/polyfill', true ))return;
59
-		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([
58
+		if( !apply_filters( 'site-reviews/assets/polyfill', true ) )return;
59
+		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg( [
60 60
 			'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event',
61 61
 			'flags' => 'gated',
62
-		], 'https://cdn.polyfill.io/v2/polyfill.js' ));
62
+		], 'https://cdn.polyfill.io/v2/polyfill.js' ) );
63 63
 	}
64 64
 
65 65
 	/**
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 		// nf-google-recaptcha
73 73
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
74 74
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
75
-		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
75
+		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [
76 76
 			'hl' => $language,
77 77
 			'render' => 'explicit',
78
-		], 'https://www.google.com/recaptcha/api.js' ));
78
+		], 'https://www.google.com/recaptcha/api.js' ) );
79 79
 	}
80 80
 
81 81
 	/**
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	public function inlineStyles()
85 85
 	{
86 86
 		$inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' );
87
-		if( !apply_filters( 'site-reviews/assets/css', true ))return;
88
-		if( !file_exists( $inlineStylesheetPath )) {
87
+		if( !apply_filters( 'site-reviews/assets/css', true ) )return;
88
+		if( !file_exists( $inlineStylesheetPath ) ) {
89 89
 			glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath );
90 90
 			return;
91 91
 		}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function getFixedSelectorsForPagination()
122 122
 	{
123
-		$selectors = ['#wpadminbar','.site-navigation-fixed'];
123
+		$selectors = ['#wpadminbar', '.site-navigation-fixed'];
124 124
 		return apply_filters( 'site-reviews/enqueue/public/localize/ajax-pagination', $selectors );
125 125
 	}
126 126
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	protected function getStylesheet()
131 131
 	{
132 132
 		$currentStyle = glsr( Style::class )->style;
133
-		return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ))
133
+		return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ) )
134 134
 			? glsr()->url( 'assets/styles/custom/'.$currentStyle.'.css' )
135 135
 			: glsr()->url( 'assets/styles/'.Application::ID.'.css' );
136 136
 	}
Please login to merge, or discard this patch.
plugin/Router.php 2 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 	public function routeAdminPostRequest()
18 18
 	{
19 19
 		$request = $this->getRequest();
20
-		if( !$this->isValidPostRequest( $request ))return;
20
+		if( !$this->isValidPostRequest( $request )) {
21
+			return;
22
+		}
21 23
 		check_admin_referer( $request['action'] );
22 24
 		$this->routeRequest( 'admin', $request['action'], $request );
23 25
 	}
@@ -39,10 +41,16 @@  discard block
 block discarded – undo
39 41
 	 */
40 42
 	public function routePublicPostRequest()
41 43
 	{
42
-		if( is_admin() )return;
44
+		if( is_admin() ) {
45
+			return;
46
+		}
43 47
 		$request = $this->getRequest();
44
-		if( !$this->isValidPostRequest( $request ))return;
45
-		if( !$this->isValidPublicNonce( $request ))return;
48
+		if( !$this->isValidPostRequest( $request )) {
49
+			return;
50
+		}
51
+		if( !$this->isValidPublicNonce( $request )) {
52
+			return;
53
+		}
46 54
 		$this->routeRequest( 'public', $request['action'], $request );
47 55
 	}
48 56
 
@@ -51,7 +59,9 @@  discard block
 block discarded – undo
51 59
 	 */
52 60
 	protected function checkAjaxNonce( array $request )
53 61
 	{
54
-		if( !is_user_logged_in() )return;
62
+		if( !is_user_logged_in() ) {
63
+			return;
64
+		}
55 65
 		if( !isset( $request['nonce'] )) {
56 66
 			$this->sendAjaxError( 'request is missing a nonce', $request );
57 67
 		}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	public function routeAdminPostRequest()
18 18
 	{
19 19
 		$request = $this->getRequest();
20
-		if( !$this->isValidPostRequest( $request ))return;
20
+		if( !$this->isValidPostRequest( $request ) )return;
21 21
 		check_admin_referer( $request['action'] );
22 22
 		$this->routeRequest( 'admin', $request['action'], $request );
23 23
 	}
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		if( is_admin() )return;
43 43
 		$request = $this->getRequest();
44
-		if( !$this->isValidPostRequest( $request ))return;
45
-		if( !$this->isValidPublicNonce( $request ))return;
44
+		if( !$this->isValidPostRequest( $request ) )return;
45
+		if( !$this->isValidPublicNonce( $request ) )return;
46 46
 		$this->routeRequest( 'public', $request['action'], $request );
47 47
 	}
48 48
 
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	protected function checkAjaxNonce( array $request )
53 53
 	{
54 54
 		if( !is_user_logged_in() )return;
55
-		if( !isset( $request['nonce'] )) {
55
+		if( !isset($request['nonce']) ) {
56 56
 			$this->sendAjaxError( 'request is missing a nonce', $request );
57 57
 		}
58
-		if( !wp_verify_nonce( $request['nonce'], $request['action'] )) {
58
+		if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) {
59 59
 			$this->sendAjaxError( 'request failed the nonce check', $request, 403 );
60 60
 		}
61 61
 	}
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	protected function checkAjaxRequest( array $request )
67 67
 	{
68
-		if( !isset( $request['action'] )) {
68
+		if( !isset($request['action']) ) {
69 69
 			$this->sendAjaxError( 'request must include an action', $request );
70 70
 		}
71
-		if( empty( $request['ajax_request'] )) {
71
+		if( empty($request['ajax_request']) ) {
72 72
 			$this->sendAjaxError( 'request is invalid', $request );
73 73
 		}
74 74
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	protected function isValidPostRequest( array $request = [] )
97 97
 	{
98
-		return !empty( $request['action'] ) && empty( $request['ajax_request'] );
98
+		return !empty($request['action']) && empty($request['ajax_request']);
99 99
 	}
100 100
 
101 101
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function isValidPublicNonce( array $request )
105 105
 	{
106
-		if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] )) {
106
+		if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] ) ) {
107 107
 			glsr_log()->error( 'nonce check failed for public request' )->debug( $request );
108 108
 			return false;
109 109
 		}
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 	protected function routeRequest( $type, $action, array $request = [] )
119 119
 	{
120 120
 		$actionHook = 'site-reviews/route/'.$type.'/request';
121
-		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ));
121
+		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) );
122 122
 		$method = glsr( Helper::class )->buildMethodName( $action, 'router' );
123 123
 		$request = apply_filters( 'site-reviews/route/request', $request, $action, $type );
124 124
 		do_action( $actionHook, $action, $request );
125
-		if( is_callable( [$controller, $method] )) {
125
+		if( is_callable( [$controller, $method] ) ) {
126 126
 			call_user_func( [$controller, $method], $request );
127 127
 			return;
128 128
 		}
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 		glsr_log()->error( $error )->debug( $request );
142 142
 		glsr_log( $_POST );
143 143
 		glsr( Notice::class )->addError( __( 'There was an error (try refreshing the page).', 'site-reviews' ).' <code>'.$error.'</code>' );
144
-		wp_send_json_error([
144
+		wp_send_json_error( [
145 145
 			'message' => __( 'The form could not be submitted. Please notify the site administrator.', 'site-reviews' ),
146 146
 			'notices' => glsr( Notice::class )->get(),
147 147
 			'error' => $error,
148
-		]);
148
+		] );
149 149
 	}
150 150
 }
Please login to merge, or discard this patch.
plugin/Modules/Slack.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 	 */
36 36
 	public function compose( Review $review, array $notification )
37 37
 	{
38
-		if( empty( $this->endpoint ))return;
38
+		if( empty( $this->endpoint )) {
39
+			return;
40
+		}
39 41
 		$args = shortcode_atts( glsr( SlackDefaults::class )->defaults(), $notification );
40 42
 		$this->review = $review;
41 43
 		$notification = [
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function compose( Review $review, array $notification )
37 37
 	{
38
-		if( empty( $this->endpoint ))return;
38
+		if( empty($this->endpoint) )return;
39 39
 		$args = shortcode_atts( glsr( SlackDefaults::class )->defaults(), $notification );
40 40
 		$this->review = $review;
41 41
 		$notification = [
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function send()
60 60
 	{
61
-		if( empty( $this->endpoint )) {
61
+		if( empty($this->endpoint) ) {
62 62
 			return new WP_Error( 'slack', 'Slack notification was not sent: missing endpoint' );
63 63
 		}
64 64
 		return wp_remote_post( $this->endpoint, [
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			'redirection' => 5,
71 71
 			'sslverify' => false,
72 72
 			'timeout' => 45,
73
-		]);
73
+		] );
74 74
 	}
75 75
 
76 76
 	/**
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	protected function buildAuthorField()
92 92
 	{
93
-		$email = !empty( $this->review->email )
93
+		$email = !empty($this->review->email)
94 94
 			? '<'.$this->review->email.'>'
95 95
 			: '';
96 96
 		$author = trim( rtrim( $this->review->author ).' '.$email );
97
-		return ['value' => implode( ' - ', array_filter( [$author, $this->review->ip_address] ))];
97
+		return ['value' => implode( ' - ', array_filter( [$author, $this->review->ip_address] ) )];
98 98
 	}
99 99
 
100 100
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	protected function buildContentField()
104 104
 	{
105
-		return !empty( $this->review->content )
105
+		return !empty($this->review->content)
106 106
 			? ['value' => $this->review->content]
107 107
 			: [];
108 108
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	protected function buildStarsField()
128 128
 	{
129 129
 		$solidStars = str_repeat( '★', $this->review->rating );
130
-		$emptyStars = str_repeat( '☆', max( 0, Rating::MAX_RATING - $this->review->rating ));
130
+		$emptyStars = str_repeat( '☆', max( 0, Rating::MAX_RATING - $this->review->rating ) );
131 131
 		$stars = $solidStars.$emptyStars;
132 132
 		$stars = apply_filters( 'site-reviews/slack/stars', $stars, $this->review->rating, Rating::MAX_RATING );
133 133
 		return ['title' => $stars];
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	protected function buildTitleField()
140 140
 	{
141
-		return !empty( $this->review->title )
141
+		return !empty($this->review->title)
142 142
 			? ['title' => $this->review->title]
143 143
 			: [];
144 144
 	}
Please login to merge, or discard this patch.
site-reviews.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
 if( !class_exists( 'GL_Plugin_Check_v3' )) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24
-if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return;
24
+if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() ) {
25
+	return;
26
+}
25 27
 require_once __DIR__.'/autoload.php';
26 28
 require_once __DIR__.'/compatibility.php';
27 29
 require_once __DIR__.'/deprecated.php';
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 defined( 'WPINC' ) || die;
20 20
 
21
-if( !class_exists( 'GL_Plugin_Check_v3' )) {
21
+if( !class_exists( 'GL_Plugin_Check_v3' ) ) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24 24
 if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 $app = new GeminiLabs\SiteReviews\Application;
31 31
 $app->make( 'Provider' )->register( $app );
32
-register_activation_hook( __FILE__, array( $app, 'activate' ));
33
-register_deactivation_hook( __FILE__, array( $app, 'deactivate' ));
34
-register_shutdown_function( array( $app, 'catchFatalError' ));
32
+register_activation_hook( __FILE__, array( $app, 'activate' ) );
33
+register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) );
34
+register_shutdown_function( array( $app, 'catchFatalError' ) );
35 35
 $app->init();
Please login to merge, or discard this patch.
plugin/Modules/Notification.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function __construct()
34 34
 	{
35 35
 		$types = glsr( OptionManager::class )->get( 'settings.general.notifications', [] );
36
-		$this->email = count( array_intersect( ['admin', 'custom'], $types )) > 0;
36
+		$this->email = count( array_intersect( ['admin', 'custom'], $types ) ) > 0;
37 37
 		$this->slack = in_array( 'slack', $types );
38 38
 		$this->types = $types;
39 39
 	}
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function send( Review $review )
45 45
 	{
46
-		if( empty( $this->types ))return;
46
+		if( empty($this->types) )return;
47 47
 		$this->review = $review;
48 48
 		$args = [
49 49
 			'link' => $this->getLink(),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	protected function buildEmail( array $args )
60 60
 	{
61
-		return glsr( Email::class )->compose([
61
+		return glsr( Email::class )->compose( [
62 62
 			'to' => $this->getEmailAddresses(),
63 63
 			'subject' => $args['title'],
64 64
 			'template' => 'email-notification',
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 				'review_rating' => $this->review->rating,
72 72
 				'review_title' => $this->review->title,
73 73
 			],
74
-		]);
74
+		] );
75 75
 	}
76 76
 
77 77
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'button_url' => $args['link'],
84 84
 			'fallback' => $this->buildEmail( $args )->read( 'plaintext' ),
85 85
 			'pretext' => $args['title'],
86
-		]);
86
+		] );
87 87
 	}
88 88
 
89 89
 	/**
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 	protected function getEmailAddresses()
93 93
 	{
94 94
 		$emails = [];
95
-		if( in_array( 'admin', $this->types )) {
95
+		if( in_array( 'admin', $this->types ) ) {
96 96
 			$emails[] = get_option( 'admin_email' );
97 97
 		}
98
-		if( in_array( 'author', $this->types )) {
99
-			$assignedPost = get_post( intval( $this->review->assigned_to ));
98
+		if( in_array( 'author', $this->types ) ) {
99
+			$assignedPost = get_post( intval( $this->review->assigned_to ) );
100 100
 			if( $assignedPost instanceof WP_Post ) {
101 101
 				$this->email = true;
102
-				$emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ));
102
+				$emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ) );
103 103
 			}
104 104
 		}
105
-		if( in_array( 'custom', $this->types )) {
105
+		if( in_array( 'custom', $this->types ) ) {
106 106
 			$customEmails = glsr( OptionManager::class )->get( 'settings.general.notification_email' );
107 107
 			$customEmails = str_replace( [' ', ',', ';'], ',', $customEmails );
108 108
 			$customEmails = explode( ',', $customEmails );
109 109
 			$emails = array_merge( $emails, $customEmails );
110 110
 		}
111
-		$emails = array_filter( array_keys( array_flip( $emails )));
111
+		$emails = array_filter( array_keys( array_flip( $emails ) ) );
112 112
 		return apply_filters( 'site-reviews/notification/emails', $emails, $this->review );
113 113
 	}
114 114
 
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function getTitle()
127 127
 	{
128
-		$assignedTitle = get_the_title( intval( $this->review->assigned_to ));
128
+		$assignedTitle = get_the_title( intval( $this->review->assigned_to ) );
129 129
 		$title = _nx(
130 130
 			'New %s-star review',
131 131
 			'New %s-star review of: %s',
132
-			intval( empty( $assignedTitle )),
132
+			intval( empty($assignedTitle) ),
133 133
 			'This string differs depending on whether or not the review has been assigned to a post.',
134 134
 			'site-reviews'
135 135
 		);
136 136
 		$title = sprintf( '[%s] %s',
137
-			wp_specialchars_decode( strval( get_option( 'blogname' )), ENT_QUOTES ),
137
+			wp_specialchars_decode( strval( get_option( 'blogname' ) ), ENT_QUOTES ),
138 138
 			sprintf( $title, $this->review->rating, $assignedTitle )
139 139
 		);
140 140
 		return apply_filters( 'site-reviews/notification/title', $title, $this->review );
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	{
148 148
 		$email = $this->buildEmail( $args );
149 149
 		if( !$this->email )return;
150
-		if( empty( $email->to )) {
150
+		if( empty($email->to) ) {
151 151
 			glsr_log()->error( 'Email notification was not sent: missing email address' );
152 152
 			return;
153 153
 		}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		if( !$this->slack )return;
165 165
 		$notification = $this->buildSlackNotification( $args );
166 166
 		$result = $notification->send();
167
-		if( is_wp_error( $result )) {
167
+		if( is_wp_error( $result ) ) {
168 168
 			$notification->review = null;
169 169
 			glsr_log()->error( $result->get_error_message() )->debug( $notification );
170 170
 		}
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function send( Review $review )
45 45
 	{
46
-		if( empty( $this->types ))return;
46
+		if( empty( $this->types )) {
47
+			return;
48
+		}
47 49
 		$this->review = $review;
48 50
 		$args = [
49 51
 			'link' => $this->getLink(),
@@ -146,7 +148,9 @@  discard block
 block discarded – undo
146 148
 	protected function sendToEmail( array $args )
147 149
 	{
148 150
 		$email = $this->buildEmail( $args );
149
-		if( !$this->email )return;
151
+		if( !$this->email ) {
152
+			return;
153
+		}
150 154
 		if( empty( $email->to )) {
151 155
 			glsr_log()->error( 'Email notification was not sent: missing email address' );
152 156
 			return;
@@ -161,7 +165,9 @@  discard block
 block discarded – undo
161 165
 	 */
162 166
 	protected function sendToSlack( array $args )
163 167
 	{
164
-		if( !$this->slack )return;
168
+		if( !$this->slack ) {
169
+			return;
170
+		}
165 171
 		$notification = $this->buildSlackNotification( $args );
166 172
 		$result = $notification->send();
167 173
 		if( is_wp_error( $result )) {
Please login to merge, or discard this patch.
plugin/Modules/Blacklist.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public function isBlacklisted( array $review )
13 13
 	{
14
-		$target = implode( "\n", array_filter([
14
+		$target = implode( "\n", array_filter( [
15 15
 			$review['name'],
16 16
 			$review['content'],
17 17
 			$review['email'],
18 18
 			$review['ip_address'],
19 19
 			$review['title'],
20
-		]));
20
+		] ) );
21 21
 		return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted',
22 22
 			$this->check( $target ),
23 23
 			$review
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	protected function check( $target )
32 32
 	{
33
-		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ));
34
-		if( empty( $blacklist )) {
33
+		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) );
34
+		if( empty($blacklist) ) {
35 35
 			return false;
36 36
 		}
37 37
 		$lines = explode( "\n", $blacklist );
38 38
 		foreach( (array)$lines as $line ) {
39 39
 			$line = trim( $line );
40
-			if( empty( $line ) || 256 < strlen( $line ))continue;
41
-			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
42
-			if( preg_match( $pattern, $target )) {
40
+			if( empty($line) || 256 < strlen( $line ) )continue;
41
+			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) );
42
+			if( preg_match( $pattern, $target ) ) {
43 43
 				return true;
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@
 block discarded – undo
37 37
 		$lines = explode( "\n", $blacklist );
38 38
 		foreach( (array)$lines as $line ) {
39 39
 			$line = trim( $line );
40
-			if( empty( $line ) || 256 < strlen( $line ))continue;
40
+			if( empty( $line ) || 256 < strlen( $line )) {
41
+				continue;
42
+			}
41 43
 			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
42 44
 			if( preg_match( $pattern, $target )) {
43 45
 				return true;
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewHtml.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function __get( $key )
21 21
 	{
22
-		if( array_key_exists( $key, $this->values )) {
22
+		if( array_key_exists( $key, $this->values ) ) {
23 23
 			return $this->values[$key];
24 24
 		}
25 25
 		return '';
Please login to merge, or discard this patch.
plugin/Review.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
70 70
 		$this->modified = $this->isModified( $properties );
71 71
 		array_walk( $properties, function( $value, $key ) {
72
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
72
+			if( !property_exists( $this, $key ) || isset( $this->$key )) {
73
+				return;
74
+			}
73 75
 			$this->$key = maybe_unserialize( $value );
74 76
 		});
75 77
 	}
@@ -80,7 +82,9 @@  discard block
 block discarded – undo
80 82
 	protected function setTermIds( WP_Post $post )
81 83
 	{
82 84
 		$this->term_ids = [];
83
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
85
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) {
86
+			return;
87
+		}
84 88
 		foreach( $terms as $term ) {
85 89
 			$this->term_ids[] = $term->term_id;
86 90
 		}
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function __get( $key )
48 48
 	{
49
-		if( property_exists( $this, $key )) {
49
+		if( property_exists( $this, $key ) ) {
50 50
 			return $this->$key;
51 51
 		}
52
-		if( is_array( $this->custom ) && array_key_exists( $key, $this->custom )) {
52
+		if( is_array( $this->custom ) && array_key_exists( $key, $this->custom ) ) {
53 53
 			return $this->custom[$key];
54 54
 		}
55 55
 		return '';
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 			'review_type' => '',
78 78
 		];
79 79
 		$meta = array_filter(
80
-			array_map( 'array_shift', (array)get_post_meta( $post->ID )),
80
+			array_map( 'array_shift', (array)get_post_meta( $post->ID ) ),
81 81
 			'strlen'
82 82
 		);
83
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
83
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
84 84
 		$this->modified = $this->isModified( $properties );
85 85
 		array_walk( $properties, function( $value, $key ) {
86
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
86
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
87 87
 			$this->$key = maybe_unserialize( $value );
88 88
 		});
89 89
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	protected function setTermIds( WP_Post $post )
95 95
 	{
96 96
 		$this->term_ids = [];
97
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
97
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return;
98 98
 		foreach( $terms as $term ) {
99 99
 			$this->term_ids[] = $term->term_id;
100 100
 		}
Please login to merge, or discard this patch.
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.