Passed
Push — ci ( ddfce8 )
by litefeel
02:07
created
lib/client/base.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 	 * @param string $endpoint API endpoint.
38 38
 	 * @param array  $body Request body.
39 39
 	 *
40
-	 * @return stdClass|WP_Error
40
+	 * @return stdClass
41 41
 	 */
42 42
 	protected function call( $method, $endpoint, $body = array() ) {
43 43
 		if ( is_wp_error( $error = $this->can_call() ) ) {
Please login to merge, or discard this patch.
lib/client/persist.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -31,6 +31,7 @@
 block discarded – undo
31 31
 	/**
32 32
 	 * Delete the file.
33 33
 	 *
34
+	 * @param string $message
34 35
 	 * @return array
35 36
 	 */
36 37
 	public function delete_file( $path, $sha, $message ) {
Please login to merge, or discard this patch.
lib/controller.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @param int $post_id Post ID.
169 169
 	 *
170
-	 * @return boolean
170
+	 * @return null|boolean
171 171
 	 */
172 172
 	public function export_post( $post_id ) {
173 173
 		if ( wp_is_post_revision( $post_id ) ) {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @param int $post_id Post ID.
201 201
 	 *
202
-	 * @return boolean
202
+	 * @return null|boolean
203 203
 	 */
204 204
 	public function delete_post( $post_id ) {
205 205
 		if ( wp_is_post_revision( $post_id ) ) {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,10 +126,10 @@
 block discarded – undo
126 126
 	/**
127 127
 	 * Export all the posts in the database to GitHub.
128 128
 	 *
129
-     * @param  int        $user_id
130
-     * @param  boolean    $force
131
-     * @return boolean
132
-     */
129
+	 * @param  int        $user_id
130
+	 * @param  boolean    $force
131
+	 * @return boolean
132
+	 */
133 133
 	public function export_all( $user_id, $force = false ) {
134 134
 		if ( ! $this->app->semaphore()->is_open() ) {
135 135
 			return $this->app->response()->error( new WP_Error(
Please login to merge, or discard this patch.
lib/database.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,6 @@  discard block
 block discarded – undo
108 108
 	 * and associates their author as well as their latest
109 109
 	 *
110 110
 	 * @param Writing_On_GitHub_Post[] $posts Array of Posts to save.
111
-	 * @param string                       $email Author email.
112 111
 	 *
113 112
 	 * @return string|WP_Error
114 113
 	 */
@@ -178,6 +177,9 @@  discard block
 block discarded – undo
178 177
 		return __( 'Successfully saved posts.', 'writing-on-github' );
179 178
 	}
180 179
 
180
+	/**
181
+	 * @param Writing_On_GitHub_Post $post
182
+	 */
181 183
 	protected function post_args( $post ) {
182 184
 		$args = $post->get_args();
183 185
 		$meta = $post->get_meta();
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	/**
43 43
 	 * Queries the database for all of the supported posts.
44 44
 	 *
45
-     * @param  bool $force
46
-     * @return Writing_On_GitHub_Post[]|WP_Error
47
-     */
45
+	 * @param  bool $force
46
+	 * @return Writing_On_GitHub_Post[]|WP_Error
47
+	 */
48 48
 	public function fetch_all_supported( $force = false ) {
49 49
 		$args  = array(
50 50
 			'post_type'   => $this->get_whitelisted_post_types(),
@@ -187,45 +187,45 @@  discard block
 block discarded – undo
187 187
 
188 188
 		// update tags
189 189
 		if ( isset( $meta['tags'] ) && $meta['tags'] ) {
190
-		    $args['tags_input'] = $meta['tags'];
190
+			$args['tags_input'] = $meta['tags'];
191 191
 		}
192 192
 
193 193
 		// update categories
194 194
 		if ( isset( $meta['categories'] ) && $meta['categories'] ) {
195
-		    $categories = $meta['categories'];
196
-		    if (!is_array($categories)) {
197
-		        $categories = array($categories);
198
-		    }
199
-		    $terms = get_terms(array(
200
-		        'taxonomy' => 'category',
201
-		        'fields' => 'id=>name',
202
-		        'hide_empty' => 0,
203
-		        'name' => $categories
204
-		        )
205
-		    );
206
-		    $map = array();
207
-		    foreach ($categories as $name) {
208
-		        $map[$name] = 1;
209
-		    }
210
-
211
-		    $ids = array();
212
-		    if (!empty($terms)) {
213
-		        foreach ($terms as $id => $name) {
214
-		            $ids[] = $id;
215
-		            unset($map[$name]);
216
-		        }
217
-		    }
218
-
219
-		    // create new terms
220
-		    if (!empty($map)) {
221
-		        foreach ($map as $name => $value) {
222
-		            $term = wp_insert_term($name, 'category', array('parent' => 0));
223
-		            // array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
224
-		            $ids[] = $term['term_id'];
225
-		        }
226
-		    }
227
-
228
-		    $args['post_category'] = $ids;
195
+			$categories = $meta['categories'];
196
+			if (!is_array($categories)) {
197
+				$categories = array($categories);
198
+			}
199
+			$terms = get_terms(array(
200
+				'taxonomy' => 'category',
201
+				'fields' => 'id=>name',
202
+				'hide_empty' => 0,
203
+				'name' => $categories
204
+				)
205
+			);
206
+			$map = array();
207
+			foreach ($categories as $name) {
208
+				$map[$name] = 1;
209
+			}
210
+
211
+			$ids = array();
212
+			if (!empty($terms)) {
213
+				foreach ($terms as $id => $name) {
214
+					$ids[] = $id;
215
+					unset($map[$name]);
216
+				}
217
+			}
218
+
219
+			// create new terms
220
+			if (!empty($map)) {
221
+				foreach ($map as $name => $value) {
222
+					$term = wp_insert_term($name, 'category', array('parent' => 0));
223
+					// array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
224
+					$ids[] = $term['term_id'];
225
+				}
226
+			}
227
+
228
+			$args['post_category'] = $ids;
229 229
 		}
230 230
 
231 231
 		return $args;
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
 		if ( ! empty( $display_name ) ) {
428 428
 			$search_string = esc_attr( $display_name );
429 429
 			$query = new WP_User_Query( array(
430
-			    'search'         => "{$search_string}",
431
-			    'search_columns' => array(
432
-			        'display_name',
433
-			        'user_nicename',
434
-			        'user_login',
435
-			    )
430
+				'search'         => "{$search_string}",
431
+				'search_columns' => array(
432
+					'display_name',
433
+					'user_nicename',
434
+					'user_login',
435
+				)
436 436
 			) );
437 437
 			$users = $query->get_results();
438 438
 			$user = empty($users) ? false : $users[0];
Please login to merge, or discard this patch.
lib/export.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -142,6 +142,10 @@
 block discarded – undo
142 142
 		return true;
143 143
 	}
144 144
 
145
+	/**
146
+	 * @param Writing_On_GitHub_Post $post
147
+	 * @param Writing_On_GitHub_Persist_Client $persist
148
+	 */
145 149
 	protected function new_post( $post, $persist ) {
146 150
 		$github_path = $post->github_path();
147 151
 		$old_github_path = $post->old_github_path();
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	/**
30 30
 	 * Updates all of the current posts in the database on master.
31 31
 	 *
32
-     * @param  bool    $force_all
33
-     * @return string|WP_Error
34
-     */
32
+	 * @param  bool    $force_all
33
+	 * @return string|WP_Error
34
+	 */
35 35
 	public function full( $force_all = false ) {
36 36
 		$posts = $this->app->database()->fetch_all_supported($force_all);
37 37
 
@@ -39,24 +39,24 @@  discard block
 block discarded – undo
39 39
 			return $posts;
40 40
 		}
41 41
 
42
-        $error = false;
42
+		$error = false;
43 43
 
44
-        foreach ( $posts as $post ) {
45
-            $result = $this->update( $post->id() );
46
-            if ( is_wp_error( $result ) ) {
47
-                if ( $error ) {
48
-                    $error->add( $result->get_error_code(), $result->get_error_message() );
49
-                } else {
50
-                    $error = $result;
51
-                }
52
-            }
53
-        }
44
+		foreach ( $posts as $post ) {
45
+			$result = $this->update( $post->id() );
46
+			if ( is_wp_error( $result ) ) {
47
+				if ( $error ) {
48
+					$error->add( $result->get_error_code(), $result->get_error_message() );
49
+				} else {
50
+					$error = $result;
51
+				}
52
+			}
53
+		}
54 54
 
55
-        if ( is_wp_error( $error ) ) {
56
-            return $error;
57
-        }
55
+		if ( is_wp_error( $error ) ) {
56
+			return $error;
57
+		}
58 58
 
59
-        return __( 'Export to GitHub completed successfully.', 'writing-on-github' );
59
+		return __( 'Export to GitHub completed successfully.', 'writing-on-github' );
60 60
 	}
61 61
 
62 62
 
Please login to merge, or discard this patch.
lib/import.php 1 patch
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,6 +140,9 @@  discard block
 block discarded – undo
140 140
 		return __( 'Payload processed', 'writing-on-github' );
141 141
 	}
142 142
 
143
+	/**
144
+	 * @param boolean $delete_ids
145
+	 */
143 146
 	protected function compare( $files, &$delete_ids ) {
144 147
 		if ( is_wp_error( $files ) ) {
145 148
 			return $files;
@@ -217,7 +220,6 @@  discard block
 block discarded – undo
217 220
 	/**
218 221
 	 * Checks whether the provided blob should be imported.
219 222
 	 *
220
-	 * @param Writing_On_GitHub_Blob $blob Blob to validate.
221 223
 	 *
222 224
 	 * @return bool
223 225
 	 */
Please login to merge, or discard this patch.
lib/request.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 	/**
42 42
 	 * Validates the header's secret.
43 43
 	 *
44
-	 * @return true|WP_Error
44
+	 * @return boolean
45 45
 	 */
46 46
 	public function is_secret_valid() {
47 47
 		$headers = $this->headers();
Please login to merge, or discard this patch.
writing-on-github.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		add_action( 'save_post', array( $this->controller, 'export_post' ) );
163 163
 		add_action( 'delete_post', array( $this->controller, 'delete_post' ) );
164 164
 		add_action( 'wp_ajax_nopriv_wogh_push_request', array( $this->controller, 'pull_posts' ) );
165
-        add_action( 'wogh_export', array( $this->controller, 'export_all' ), 10, 2 );
165
+		add_action( 'wogh_export', array( $this->controller, 'export_all' ), 10, 2 );
166 166
 		add_action( 'wogh_import', array( $this->controller, 'import_master' ), 10, 1 );
167 167
 		add_filter( 'get_edit_post_link', array( $this, 'edit_post_link' ), 10, 3 );
168 168
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			}
182 182
 		}
183 183
 
184
-	    return $link;
184
+		return $link;
185 185
 	}
186 186
 
187 187
 	public function ignore_post_meta($meta) {
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
 	/**
437 437
 	 * Kicks of an import or export cronjob.
438 438
 	 *
439
-     * @param bool   $force
440
-     * @param string $type
441
-     */
439
+	 * @param bool   $force
440
+	 * @param string $type
441
+	 */
442 442
 	protected function start_cron( $type, $force = false ) {
443 443
 		update_option( '_wogh_' . $type . '_started', 'yes' );
444 444
 		$user_id = get_current_user_id();
Please login to merge, or discard this patch.
lib/admin.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
 			)
85 85
 		);
86 86
 
87
-        register_setting( Writing_On_GitHub::$text_domain, 'wogh_ignore_author' );
88
-        add_settings_field( 'wogh_ignore_author', __( 'Ignore author', 'writing-on-github' ), array( &$this, 'checkbox_field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
89
-                'default'   => '',
90
-                'name'      => 'wogh_ignore_author',
91
-                'help_text' => __( 'Do not export author and do not use author info from GitHub.', 'writing-on-github' ),
92
-            )
93
-        );
87
+		register_setting( Writing_On_GitHub::$text_domain, 'wogh_ignore_author' );
88
+		add_settings_field( 'wogh_ignore_author', __( 'Ignore author', 'writing-on-github' ), array( &$this, 'checkbox_field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
89
+				'default'   => '',
90
+				'name'      => 'wogh_ignore_author',
91
+				'help_text' => __( 'Do not export author and do not use author info from GitHub.', 'writing-on-github' ),
92
+			)
93
+		);
94 94
 
95 95
 		// register_setting( Writing_On_GitHub::$text_domain, 'wogh_ignore_metas' );
96 96
 		// add_settings_field( 'wogh_ignore_metas', __( 'Ignore post metas', 'writing-on-github' ), array( &$this, 'textarea_field_callback' ), Writing_On_GitHub::$text_domain, 'general', array(
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 		include dirname( dirname( __FILE__ ) ) . '/views/textarea-setting-field.php';
129 129
 	}
130 130
 
131
-    /**
132
-     * Callback to render the checkbox field.
133
-     *
134
-     * @param array $args Field arguments.
135
-     */
136
-    public function checkbox_field_callback( $args ) {
137
-        include dirname( dirname( __FILE__ ) ) . '/views/checkbox-setting-field.php';
138
-    }
131
+	/**
132
+	 * Callback to render the checkbox field.
133
+	 *
134
+	 * @param array $args Field arguments.
135
+	 */
136
+	public function checkbox_field_callback( $args ) {
137
+		include dirname( dirname( __FILE__ ) ) . '/views/checkbox-setting-field.php';
138
+	}
139 139
 
140 140
 	/**
141 141
 	 * Displays settings messages from background processes
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 			Writing_On_GitHub::$instance->start_export();
222 222
 		}
223 223
 
224
-        if ( 'force_export' === $_GET['action'] ) {
225
-            Writing_On_GitHub::$instance->start_export(true);
226
-        }
224
+		if ( 'force_export' === $_GET['action'] ) {
225
+			Writing_On_GitHub::$instance->start_export(true);
226
+		}
227 227
 
228 228
 		if ( 'import' === $_GET['action'] ) {
229 229
 			Writing_On_GitHub::$instance->start_import();
Please login to merge, or discard this patch.