Passed
Push — ci ( 990482...990c6e )
by litefeel
02:27
created
lib/blob.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @param stdClass $data Raw blob data.
63 63
      */
64
-    public function __construct( stdClass $data ) {
65
-        $this->interpret_data( $data );
64
+    public function __construct(stdClass $data) {
65
+        $this->interpret_data($data);
66 66
     }
67 67
 
68 68
     public function id() {
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return $this
92 92
      */
93
-    public function set_content( $content, $base64 = false ) {
94
-        if ( $base64 ) {
95
-            $content = base64_decode( $content );
93
+    public function set_content($content, $base64 = false) {
94
+        if ($base64) {
95
+            $content = base64_decode($content);
96 96
         }
97 97
 
98 98
         // remove whitespace from the beginning of content,
99 99
         // To prevent blank lines before yml
100
-        $this->content = ltrim( $content );
100
+        $this->content = ltrim($content);
101 101
 
102
-        $this->frontmatter = '---' === substr( $this->content, 0, 3 );
102
+        $this->frontmatter = '---' === substr($this->content, 0, 3);
103 103
 
104 104
         return $this;
105 105
     }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      * @return string
144 144
      */
145 145
     public function post_content() {
146
-        if ( ! $this->post_content ) {
146
+        if ( ! $this->post_content) {
147 147
             $this->content_import();
148 148
         }
149 149
         return $this->post_content;
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
     public function content_import() {
158 158
         $this->post_content = $content = $this->content();
159 159
 
160
-        if ( $this->has_frontmatter() ) {
160
+        if ($this->has_frontmatter()) {
161 161
             // Break out content.
162
-            preg_match( '/(^---(.*?)---$(\r\n|\n|\r)?)?(.*)/ms', $content, $matches );
162
+            preg_match('/(^---(.*?)---$(\r\n|\n|\r)?)?(.*)/ms', $content, $matches);
163 163
             $this->front_matter = $matches[1];
164
-            $this->post_content = $content = array_pop( $matches );
164
+            $this->post_content = $content = array_pop($matches);
165 165
         }
166 166
 
167
-        if ( function_exists( 'wpmarkdown_markdown_to_html' ) ) {
168
-            $content = wpmarkdown_markdown_to_html( $content );
167
+        if (function_exists('wpmarkdown_markdown_to_html')) {
168
+            $content = wpmarkdown_markdown_to_html($content);
169 169
         }
170 170
 
171 171
         /**
172 172
          * Filters the content for import.
173 173
          */
174
-        return apply_filters( 'wogh_content_import', trim( $content ) );
174
+        return apply_filters('wogh_content_import', trim($content));
175 175
     }
176 176
 
177 177
     /**
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
     public function meta() {
183 183
         $meta = array();
184 184
 
185
-        if ( $this->has_frontmatter() ) {
185
+        if ($this->has_frontmatter()) {
186 186
             // Break out meta, if present.
187
-            preg_match( '/(^---(.*?)---$)?(.*)/ms', $this->content(), $matches );
188
-            array_pop( $matches );
187
+            preg_match('/(^---(.*?)---$)?(.*)/ms', $this->content(), $matches);
188
+            array_pop($matches);
189 189
 
190
-            $meta = spyc_load( $matches[2] );
191
-            if ( 'yes' == get_option('wogh_ignore_author') ) {
190
+            $meta = spyc_load($matches[2]);
191
+            if ('yes' == get_option('wogh_ignore_author')) {
192 192
                 unset($meta['author']);
193 193
             }
194 194
             // if ( isset( $meta['link'] ) ) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         // $data->type = 'blob';
235 235
 
236 236
         $data->path = $this->path();
237
-        $data->content = base64_encode( $this->content() );
237
+        $data->content = base64_encode($this->content());
238 238
         $data->sha = $this->sha;
239 239
 
240 240
         return $data;
@@ -243,13 +243,13 @@  discard block
 block discarded – undo
243 243
     /**
244 244
      * Interprets the blob's data into properties.
245 245
      */
246
-    protected function interpret_data( $data ) {
247
-        $this->sha  = isset( $data->sha  ) ? $data->sha  : '';
248
-        $this->path = isset( $data->path ) ? $data->path : '';
246
+    protected function interpret_data($data) {
247
+        $this->sha  = isset($data->sha) ? $data->sha : '';
248
+        $this->path = isset($data->path) ? $data->path : '';
249 249
 
250 250
         $this->set_content(
251
-            isset( $data->content ) ? $data->content : '',
252
-            isset( $data->encoding ) && 'base64' === $data->encoding ? true : false
251
+            isset($data->content) ? $data->content : '',
252
+            isset($data->encoding) && 'base64' === $data->encoding ? true : false
253 253
         );
254 254
     }
255 255
 }
Please login to merge, or discard this patch.
lib/function.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
  * @param  WP_Error   $error2
8 8
  * @return WP_Error
9 9
  */
10
-function wogh_append_error( $error, $error2 ) {
11
-    if ( is_wp_error( $error ) ) {
12
-        $error->add( $error2->get_error_code(), $error2->get_error_message() );
10
+function wogh_append_error($error, $error2) {
11
+    if (is_wp_error($error)) {
12
+        $error->add($error2->get_error_code(), $error2->get_error_message());
13 13
     }
14 14
     return $error2;
15 15
 }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @param  Writing_On_GitHub_Blob $blob
21 21
  * @return bool
22 22
  */
23
-function wogh_equal_front_matter( $post, $blob ) {
23
+function wogh_equal_front_matter($post, $blob) {
24 24
     $str1 = $post->front_matter();
25 25
     $str2 = $blob->front_matter();
26 26
     return trim($str1) === trim($str2);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return bool
32 32
  */
33 33
 function wogh_is_dont_export_content() {
34
-    return 'yes' === get_option( 'wogh_dont_export_content' );
34
+    return 'yes' === get_option('wogh_dont_export_content');
35 35
 }
36 36
 
37 37
 /**
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
  * @param  string $content
41 41
  * @return string
42 42
  */
43
-function wogh_git_sha( $content ) {
43
+function wogh_git_sha($content) {
44 44
     // $header = "blob $len\0"
45 45
     // sha1($header . $content)
46
-    $len = strlen( $content );
47
-    return sha1( "blob $len\0$content" );
46
+    $len = strlen($content);
47
+    return sha1("blob $len\0$content");
48 48
 }
Please login to merge, or discard this patch.