Passed
Push — master ( 796b78...de3336 )
by Paul
05:32
created
plugin/Modules/Html/Form.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 			: $this->$method( $id );
24 24
 		return glsr( Template::class )->build( 'pages/settings/'.$id, [
25 25
 			'context' => $context,
26
-		]);
26
+		] );
27 27
 	}
28 28
 
29 29
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	protected function getSettingFields( $path )
42 42
 	{
43 43
 		$settings = glsr( DefaultsManager::class )->settings();
44
-		return array_filter( $settings, function( $key ) use( $path ) {
44
+		return array_filter( $settings, function( $key ) use($path) {
45 45
 			return glsr( Helper::class )->startsWith( $path, $key );
46 46
 		}, ARRAY_FILTER_USE_KEY );
47 47
 	}
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	protected function getTemplateContext( $id )
54 54
 	{
55
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
55
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
56 56
 		$rows = '';
57 57
 		foreach( $fields as $name => $field ) {
58 58
 			$field = wp_parse_args( $field, ['name' => $name] );
59
-			$rows.= (new Field( $field ))->build();
59
+			$rows .= (new Field( $field ))->build();
60 60
 		}
61 61
 		return [
62 62
 			'rows' => $rows,
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	protected function getTemplateContextForTranslations()
70 70
 	{
71 71
 		$translations = glsr( Translator::class )->renderAll();
72
-		$class = empty( $translations )
72
+		$class = empty($translations)
73 73
 			? 'glsr-hidden'
74 74
 			: '';
75 75
 		return [
Please login to merge, or discard this patch.
plugin/Database/DefaultsManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 	public function defaults()
14 14
 	{
15 15
 		$settings = $this->settings();
16
-		$defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ));
16
+		$defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) );
17 17
 		return wp_parse_args( $defaults, [
18 18
 			'version' => '',
19 19
 			'version_upgraded_from' => '',
20
-		]);
20
+		] );
21 21
 	}
22 22
 
23 23
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	protected function normalize( array $settings )
58 58
 	{
59 59
 		array_walk( $settings, function( &$setting ) {
60
-			if( isset( $setting['default'] ))return;
60
+			if( isset($setting['default']) )return;
61 61
 			$setting['default'] = '';
62 62
 		});
63 63
 		return $settings;
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	public function all()
25 25
 	{
26 26
 		$options = get_option( static::databaseKey(), [] );
27
-		if( !is_array( $options )) {
27
+		if( !is_array( $options ) ) {
28 28
 			delete_option( static::databaseKey() );
29 29
 			$options = ['settings' => []];
30 30
 		}
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 		$options = $this->all();
43 43
 		$pointer = &$options;
44 44
 		foreach( $keys as $key ) {
45
-			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue;
45
+			if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue;
46 46
 			$pointer = &$pointer[$key];
47 47
 		}
48
-		unset( $pointer[$last] );
48
+		unset($pointer[$last]);
49 49
 		return $this->set( $options );
50 50
 	}
51 51
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 			glsr( DefaultsManager::class )->defaults()
78 78
 		);
79 79
 		array_walk( $options, function( &$value, $key ) {
80
-			if( !is_string( $value ))return;
81
-			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
80
+			if( !is_string( $value ) )return;
81
+			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ) );
82 82
 		});
83 83
 		return glsr( Helper::class )->convertDotNotationArray( $options );
84 84
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function set( $pathOrOptions, $value = '' )
92 92
 	{
93
-		if( is_string( $pathOrOptions )) {
93
+		if( is_string( $pathOrOptions ) ) {
94 94
 			$pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() );
95 95
 		}
96 96
 		return update_option( static::databaseKey(), (array)$pathOrOptions );
Please login to merge, or discard this patch.
plugin/Controllers/MenuController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		global $menu, $typenow;
24 24
 		foreach( $menu as $key => $value ) {
25
-			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
25
+			if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
26 26
 			$postCount = wp_count_posts( Application::POST_TYPE );
27 27
 			$pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
28 28
 				'class' => 'pending-count',
29
-			]);
29
+			] );
30 30
 			$awaitingModeration = glsr( Builder::class )->span( $pendingCount, [
31 31
 				'class' => 'awaiting-mod count-'.$postCount->pending,
32
-			]);
32
+			] );
33 33
 			$menu[$key][0] .= $awaitingModeration;
34 34
 			if( $typenow === Application::POST_TYPE ) {
35
-				$menu[$key][4].= ' current';
35
+				$menu[$key][4] .= ' current';
36 36
 			}
37 37
 			break;
38 38
 		}
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 			'tools' => __( 'Tools', 'site-reviews' ),
50 50
 			'addons' => __( 'Add-Ons', 'site-reviews' ),
51 51
 			'documentation' => __( 'Documentation', 'site-reviews' ),
52
-		]);
52
+		] );
53 53
 		foreach( $pages as $slug => $title ) {
54 54
 			$method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' );
55 55
 			$callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
56
-			if( !is_callable( $callback ))continue;
56
+			if( !is_callable( $callback ) )continue;
57 57
 			add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback );
58 58
 		}
59 59
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		$this->renderPage( 'addons', [
69 69
 			'template' => glsr( Template::class ),
70
-		]);
70
+		] );
71 71
 	}
72 72
 
73 73
 	/**
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 			'shortcodes' => __( 'Shortcodes', 'site-reviews' ),
84 84
 			'hooks' => __( 'Hooks', 'site-reviews' ),
85 85
 			'functions' => __( 'Functions', 'site-reviews' ),
86
-		]);
86
+		] );
87 87
 		$this->renderPage( 'documentation', [
88 88
 			'tabs' => $tabs,
89
-		]);
89
+		] );
90 90
 	}
91 91
 
92 92
 	/**
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 			'schema' => __( 'Schema', 'site-reviews' ),
104 104
 			'translations' => __( 'Translations', 'site-reviews' ),
105 105
 			'licenses' => __( 'Licenses', 'site-reviews' ),
106
-		]);
107
-		if( !apply_filters( 'site-reviews/addon/licenses', false )) {
108
-			unset( $tabs['licenses'] );
106
+		] );
107
+		if( !apply_filters( 'site-reviews/addon/licenses', false ) ) {
108
+			unset($tabs['licenses']);
109 109
 		}
110 110
 		$this->renderPage( 'settings', [
111 111
 			'form' => glsr( Form::class ),
112 112
 			'html' => glsr( Html::class ),
113 113
 			'tabs' => $tabs,
114
-		]);
114
+		] );
115 115
 	}
116 116
 
117 117
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 			'import-export' => __( 'Import/Export', 'site-reviews' ),
126 126
 			'logging' => __( 'Logging', 'site-reviews' ),
127 127
 			'system-info' => __( 'System Info', 'site-reviews' ),
128
-		]);
128
+		] );
129 129
 		$this->renderPage( 'tools', [
130 130
 			'data' => [
131 131
 				'context' => [
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			],
137 137
 			'html' => glsr( Html::class ),
138 138
 			'tabs' => $tabs,
139
-		]);
139
+		] );
140 140
 	}
141 141
 
142 142
 	/**
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	{
35 35
 		$links[] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
36 36
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
37
-		]);
37
+		] );
38 38
 		return $links;
39 39
 	}
40 40
 
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 	{
47 47
 		$postType = Application::POST_TYPE;
48 48
 		$postCount = wp_count_posts( $postType );
49
-		if( !isset( $postCount->publish ) || !$postCount->publish ) {
49
+		if( !isset($postCount->publish) || !$postCount->publish ) {
50 50
 			return $items;
51 51
 		}
52 52
 		$postTypeObject = get_post_type_object( $postType );
53 53
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
54
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
54
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
55 55
 		$items[] = $postTypeObject && current_user_can( $postTypeObject->cap->edit_posts )
56 56
 			? sprintf( '<a class="glsr-review-count" href="edit.php?post_type=%s">%s</a>', $postType, $text )
57 57
 			: sprintf( '<span class="glsr-review-count">%s</span>', $text );
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	public function filterTinymcePlugins( array $plugins )
66 66
 	{
67 67
 		if( user_can_richedit()
68
-			&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
68
+			&& (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) {
69 69
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
70 70
 		}
71 71
 		return $plugins;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function registerPointers()
79 79
 	{
80
-		$command = new RegisterPointers([[
80
+		$command = new RegisterPointers( [[
81 81
 			'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
82 82
 			'id' => 'glsr-pointer-pinned',
83 83
 			'position' => [
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			'screen' => Application::POST_TYPE,
88 88
 			'target' => '#misc-pub-pinned',
89 89
 			'title' => __( 'Pin Your Reviews', 'site-reviews' ),
90
-		]]);
90
+		]] );
91 91
 		$this->execute( $command );
92 92
 	}
93 93
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function registerShortcodeButtons()
99 99
 	{
100
-		$command = new RegisterShortcodeButtons([
100
+		$command = new RegisterShortcodeButtons( [
101 101
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
102 102
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
103 103
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
104
-		]);
104
+		] );
105 105
 		$this->execute( $command );
106 106
 	}
107 107
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		if( !$this->isReviewEditable( $post ) )return;
115 115
 		glsr()->render( 'partials/editor/review', [
116 116
 			'post' => $post,
117
-		]);
117
+		] );
118 118
 	}
119 119
 
120 120
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	public function renderReviewNotice( WP_Post $post )
125 125
 	{
126 126
 		if( !$this->isReviewEditable( $post ) )return;
127
-		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
127
+		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) );
128 128
 		glsr()->render( 'partials/editor/notice' );
129 129
 	}
130 130
 
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 		if( glsr_current_screen()->base != 'post' )return;
138 138
 		$shortcodes = [];
139 139
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
140
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
140
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue;
141 141
 			$shortcodes[$shortcode] = $values;
142 142
 		}
143
-		if( empty( $shortcodes ))return;
143
+		if( empty($shortcodes) )return;
144 144
 		glsr()->render( 'partials/editor/tinymce', [
145 145
 			'shortcodes' => $shortcodes,
146
-		]);
146
+		] );
147 147
 	}
148 148
 
149 149
 	/**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	public function routerClearLog()
153 153
 	{
154 154
 		glsr( Logger::class )->clear();
155
-		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ));
155
+		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ) );
156 156
 	}
157 157
 
158 158
 	/**
@@ -186,17 +186,17 @@  discard block
 block discarded – undo
186 186
 	{
187 187
 		$file = $_FILES['import-file'];
188 188
 		if( $file['error'] !== UPLOAD_ERR_OK ) {
189
-			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ));
189
+			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
190 190
 		}
191
-		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) {
192
-			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ));
191
+		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
192
+			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
193 193
 		}
194 194
 		$settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
195
-		if( empty( $settings )) {
196
-			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ));
195
+		if( empty($settings) ) {
196
+			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
197 197
 		}
198
-		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ));
199
-		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ));
198
+		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
199
+		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
200 200
 	}
201 201
 
202 202
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
215 215
 			UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
216 216
 		];
217
-		return !isset( $errors[$errorCode] )
217
+		return !isset($errors[$errorCode])
218 218
 			? __( 'Unknown upload error.', 'site-reviews' )
219 219
 			: $errors[$errorCode];
220 220
 	}
Please login to merge, or discard this patch.
plugin/Controllers/Controller.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 */
16 16
 	public function download( $filename, $content )
17 17
 	{
18
-		if( !current_user_can( Application::CAPABILITY ))return;
18
+		if( !current_user_can( Application::CAPABILITY ) )return;
19 19
 		nocache_headers();
20 20
 		header( 'Content-Type: text/plain' );
21 21
 		header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function execute( $command )
32 32
 	{
33
-		$handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ));
34
-		if( !class_exists( $handlerClass )) {
33
+		$handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ) );
34
+		if( !class_exists( $handlerClass ) ) {
35 35
 			throw new InvalidArgumentException( 'Handler '.$handlerClass.' not found.' );
36 36
 		}
37 37
 		try {
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		}
40 40
 		catch( Exception $e ) {
41 41
 			status_header( 400 );
42
-			glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ));
42
+			glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ) );
43 43
 			glsr_log()->error( $e->getMessage() );
44 44
 		}
45 45
 	}
@@ -49,6 +49,6 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function getPostId()
51 51
 	{
52
-		return intval( filter_input( INPUT_GET, 'post' ));
52
+		return intval( filter_input( INPUT_GET, 'post' ) );
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	{
25 25
 		wp_send_json( glsr( Html::class )->renderPartial( 'link', [
26 26
 			'post_id' => $request['ID'],
27
-		]));
27
+		] ) );
28 28
 	}
29 29
 
30 30
 	/**
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function routerChangeReviewStatus( array $request )
34 34
 	{
35
-		wp_send_json( $this->execute( new ChangeStatus( $request )));
35
+		wp_send_json( $this->execute( new ChangeStatus( $request ) ) );
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 	public function routerClearLog()
42 42
 	{
43 43
 		glsr( AdminController::class )->routerClearLog();
44
-		wp_send_json([
44
+		wp_send_json( [
45 45
 			'logger' => glsr( Logger::class )->get(),
46 46
 			'notices' => glsr( Notice::class )->get(),
47
-		]);
47
+		] );
48 48
 	}
49 49
 
50 50
 	/**
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$shortcode = $request['shortcode'];
56 56
 		$response = false;
57
-		if( array_key_exists( $shortcode, glsr()->mceShortcodes )) {
57
+		if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) {
58 58
 			$data = glsr()->mceShortcodes[$shortcode];
59
-			if( !empty( $data['errors'] )) {
59
+			if( !empty($data['errors']) ) {
60 60
 				$data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )];
61 61
 			}
62 62
 			$response = [
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
 	public function routerSearchPosts( array $request )
77 77
 	{
78 78
 		$results = glsr( Database::class )->searchPosts( $request['search'] );
79
-		wp_send_json_success([
79
+		wp_send_json_success( [
80 80
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
81 81
 			'items' => $results,
82
-		]);
82
+		] );
83 83
 	}
84 84
 
85 85
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function routerSearchTranslations( array $request )
89 89
 	{
90
-		if( empty( $request['exclude'] )) {
90
+		if( empty($request['exclude']) ) {
91 91
 			$request['exclude'] = [];
92 92
 		}
93 93
 		$results = glsr( Translator::class )
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 			->exclude()
96 96
 			->exclude( $request['exclude'] )
97 97
 			->renderResults();
98
-		wp_send_json_success([
98
+		wp_send_json_success( [
99 99
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
100 100
 			'items' => $results,
101
-		]);
101
+		] );
102 102
 	}
103 103
 
104 104
 	/**
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	{
109 109
 		$response = glsr( PublicController::class )->routerCreateReview( $request );
110 110
 		$session = glsr( Session::class );
111
-		wp_send_json([
111
+		wp_send_json( [
112 112
 			'errors' => $session->get( $request['form_id'].'-errors', false, true ),
113 113
 			'message' => $response,
114 114
 			'recaptcha' => $session->get( $request['form_id'].'-recaptcha', false, true ),
115
-		]);
115
+		] );
116 116
 	}
117 117
 
118 118
 	/**
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function routerTogglePinned( array $request )
122 122
 	{
123
-		wp_send_json([
123
+		wp_send_json( [
124 124
 			'notices' => glsr( Notice::class )->get(),
125
-			'pinned' => $this->execute( new TogglePinned( $request )),
126
-		]);
125
+			'pinned' => $this->execute( new TogglePinned( $request ) ),
126
+		] );
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
plugin/Helper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	public function buildClassName( $name, $path = '' )
16 16
 	{
17
-		$className = array_map( 'strtolower', (array)preg_split( '/[-_]/', $name ));
17
+		$className = array_map( 'strtolower', (array)preg_split( '/[-_]/', $name ) );
18 18
 		$className = array_map( 'ucfirst', $className );
19 19
 		$className = implode( '', $className );
20 20
 		$path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' );
21
-		return !empty( $path )
21
+		return !empty($path)
22 22
 			? __NAMESPACE__.'\\'.$path.'\\'.$className
23 23
 			: $className;
24 24
 	}
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function buildMethodName( $name, $prefix = '' )
32 32
 	{
33
-		return lcfirst( $prefix.$this->buildClassName( $name ));
33
+		return lcfirst( $prefix.$this->buildClassName( $name ) );
34 34
 	}
35 35
 
36 36
 	/**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function buildPropertyName( $name )
41 41
 	{
42
-		return lcfirst( $this->buildClassName( $name ));
42
+		return lcfirst( $this->buildClassName( $name ) );
43 43
 	}
44 44
 
45 45
 	/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	{
82 82
 		$levels = explode( '.', $path );
83 83
 		return array_reduce( $levels, function( $result, $value ) {
84
-			return $result.= '['.$value.']';
84
+			return $result .= '['.$value.']';
85 85
 		}, $prefix );
86 86
 	}
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function dashCase( $string )
93 93
 	{
94
-		return str_replace( '_', '-', $this->snakeCase( $string ));
94
+		return str_replace( '_', '-', $this->snakeCase( $string ) );
95 95
 	}
96 96
 
97 97
 	/**
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 		$result = [];
118 118
 		foreach( $array as $key => $value ) {
119 119
 			$newKey = ltrim( $prefix.'.'.$key, '.' );
120
-			if( $this->isIndexedArray( $value )) {
120
+			if( $this->isIndexedArray( $value ) ) {
121 121
 				if( $flattenValue ) {
122 122
 					$value = '['.implode( ', ', $value ).']';
123 123
 				}
124 124
 			}
125
-			else if( is_array( $value )) {
126
-				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ));
125
+			else if( is_array( $value ) ) {
126
+				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) );
127 127
 				continue;
128 128
 			}
129 129
 			$result[$newKey] = $value;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 				Whip::IPV4 => $cloudflareIps['v4'],
143 143
 				Whip::IPV6 => $cloudflareIps['v6'],
144 144
 			],
145
-		]))->getValidIpAddress();
145
+		] ))->getValidIpAddress();
146 146
 	}
147 147
 
148 148
 	/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	{
156 156
 		$keys = explode( '.', $path );
157 157
 		foreach( $keys as $key ) {
158
-			if( !isset( $values[$key] )) {
158
+			if( !isset($values[$key]) ) {
159 159
 				return $fallback;
160 160
 			}
161 161
 			$values = $values[$key];
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public function isIndexedArray( $array )
171 171
 	{
172
-		if( !is_array( $array ) || array_filter( $array, 'is_array' )) {
172
+		if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) {
173 173
 			return false;
174 174
 		}
175 175
 		$current = 0;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function prefixString( $string, $prefix = '' )
191 191
 	{
192
-		return $prefix.str_replace( $prefix, '', trim( $string ));
192
+		return $prefix.str_replace( $prefix, '', trim( $string ) );
193 193
 	}
194 194
 
195 195
 	/**
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	public function snakeCase( $string )
237 237
 	{
238
-		if( !ctype_lower( $string )) {
238
+		if( !ctype_lower( $string ) ) {
239 239
 			$string = preg_replace( '/\s+/u', '', $string );
240 240
 			$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
241 241
 			$string = mb_strtolower( $string, 'UTF-8' );
@@ -250,6 +250,6 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function startsWith( $needle, $haystack )
252 252
 	{
253
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
253
+		return substr( $haystack, 0, strlen( $needle ) ) === $needle;
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.
plugin/Router.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	public function routeAdminPostRequest()
17 17
 	{
18 18
 		$request = filter_input( INPUT_POST, Application::ID, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
19
-		if( !isset( $request['action'] ))return;
19
+		if( !isset($request['action']) )return;
20 20
 		$this->checkNonce( $request['action'] );
21 21
 		$this->routeRequest( 'admin', $request['action'], $request );
22 22
 	}
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	public function routeAjaxRequest()
28 28
 	{
29 29
 		$request = $this->normalizeAjaxRequest();
30
-		if( !wp_verify_nonce( $request['nonce'], $request['action'] )) {
30
+		if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) {
31 31
 			glsr_log()->error( 'Nonce check failed for ajax request' )->info( $request );
32 32
 			wp_die( -1, 403 );
33 33
 		}
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function routeRequest( $type, $action, array $request = [] )
55 55
 	{
56
-		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ));
56
+		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) );
57 57
 		$method = glsr( Helper::class )->buildMethodName( $action, 'router' );
58
-		if( is_callable( [$controller, $method] )) {
58
+		if( is_callable( [$controller, $method] ) ) {
59 59
 			call_user_func( [$controller, $method], $request );
60 60
 			return;
61 61
 		}
62 62
 		$response = do_action( 'site-reviews/route/'.$type.'/request', $action, $request );
63
-		if( empty( $response )) {
63
+		if( empty($response) ) {
64 64
 			glsr_log( 'Unknown '.$type.' router request: '.$action );
65 65
 		}
66 66
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function routeWebhookRequest()
72 72
 	{
73
-		$request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ));
73
+		$request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ) );
74 74
 		if( !$request )return;
75 75
 		// @todo manage webhook here
76 76
 	}
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 	protected function normalizeAjaxRequest()
110 110
 	{
111 111
 		$request = filter_input( INPUT_POST, 'request', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
112
-		if( isset( $request[Application::ID]['action'] )) {
112
+		if( isset($request[Application::ID]['action']) ) {
113 113
 			$request = $request[Application::ID];
114 114
 		}
115
-		if( !isset( $request['action'] )) {
115
+		if( !isset($request['action']) ) {
116 116
 			glsr_log()->error( 'The AJAX request must include an action' )->info( $request );
117 117
 			wp_die();
118 118
 		}
119
-		if( !isset( $request['nonce'] )) {
119
+		if( !isset($request['nonce']) ) {
120 120
 			glsr_log()->error( 'The AJAX request must include a nonce' )->info( $request );
121 121
 			wp_die();
122 122
 		}
Please login to merge, or discard this patch.