Passed
Push — master ( de3336...c38ef8 )
by Paul
10:22
created
plugin/Database/OptionManager.php 2 patches
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 ) {
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.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  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] )) {
46
+				continue;
47
+			}
46 48
 			$pointer = &$pointer[$key];
47 49
 		}
48 50
 		unset( $pointer[$last] );
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
 			glsr( DefaultsManager::class )->defaults()
78 80
 		);
79 81
 		array_walk( $options, function( &$value ) {
80
-			if( !is_string( $value ))return;
82
+			if( !is_string( $value )) {
83
+				return;
84
+			}
81 85
 			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
82 86
 		});
83 87
 		return glsr( Helper::class )->convertDotNotationArray( $options );
Please login to merge, or discard this patch.
plugin/Router.php 1 patch
Spacing   +8 added lines, -8 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
 		}
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function routeRequest( $type, $action, array $request = [] )
54 54
 	{
55
-		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ));
55
+		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) );
56 56
 		$method = glsr( Helper::class )->buildMethodName( $action, 'router' );
57
-		if( is_callable( [$controller, $method] )) {
57
+		if( is_callable( [$controller, $method] ) ) {
58 58
 			call_user_func( [$controller, $method], $request );
59 59
 			return;
60 60
 		}
@@ -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.