@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @return array[Writing_On_GitHub_File_Info]|WP_Error |
18 | 18 | */ |
19 | - public function compare( $sha ) { |
|
19 | + public function compare($sha) { |
|
20 | 20 | // https://api.github.com/repos/litefeel/testwpsync/compare/861f87e8851b8debb78db548269d29f8da4d94ac...master |
21 | 21 | $endpoint = $this->compare_endpoint(); |
22 | 22 | $branch = $this->branch(); |
23 | - $data = $this->call( 'GET', "$endpoint/$sha...$branch" ); |
|
23 | + $data = $this->call('GET', "$endpoint/$sha...$branch"); |
|
24 | 24 | |
25 | - if ( is_wp_error( $data ) ) { |
|
25 | + if (is_wp_error($data)) { |
|
26 | 26 | return $data; |
27 | 27 | } |
28 | 28 | |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | - public function remote_contents( $post ) { |
|
48 | - return $this->call( 'GET', $this->content_endpoint( $post->github_path() ) ); |
|
47 | + public function remote_contents($post) { |
|
48 | + return $this->call('GET', $this->content_endpoint($post->github_path())); |
|
49 | 49 | } |
50 | 50 | |
51 | - public function exists( $path ) { |
|
52 | - $result = $this->call( 'GET', $this->content_endpoint( $path ) ); |
|
53 | - if ( is_wp_error( $result ) ) { |
|
51 | + public function exists($path) { |
|
52 | + $result = $this->call('GET', $this->content_endpoint($path)); |
|
53 | + if (is_wp_error($result)) { |
|
54 | 54 | return false; |
55 | 55 | } |
56 | 56 | return true; |
@@ -63,27 +63,27 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return Writing_On_GitHub_Tree|WP_Error |
65 | 65 | */ |
66 | - public function tree_recursive( $sha = '_default' ) { |
|
66 | + public function tree_recursive($sha = '_default') { |
|
67 | 67 | |
68 | - if ( '_default' === $sha ) { |
|
68 | + if ('_default' === $sha) { |
|
69 | 69 | $sha = $this->branch(); |
70 | 70 | } |
71 | 71 | |
72 | - $data = $this->call( 'GET', $this->tree_endpoint() . '/' . $sha . '?recursive=1' ); |
|
72 | + $data = $this->call('GET', $this->tree_endpoint() . '/' . $sha . '?recursive=1'); |
|
73 | 73 | |
74 | - if ( is_wp_error( $data ) ) { |
|
74 | + if (is_wp_error($data)) { |
|
75 | 75 | return $data; |
76 | 76 | } |
77 | 77 | |
78 | 78 | $files = array(); |
79 | 79 | |
80 | - foreach ( $data->tree as $index => $thing ) { |
|
80 | + foreach ($data->tree as $index => $thing) { |
|
81 | 81 | // We need to remove the trees because |
82 | 82 | // the recursive tree includes both |
83 | 83 | // the subtrees as well the subtrees' blobs. |
84 | - if ( 'blob' === $thing->type ) { |
|
84 | + if ('blob' === $thing->type) { |
|
85 | 85 | $thing->status = ''; |
86 | - $files[] = new Writing_On_GitHub_File_Info( $thing ); |
|
86 | + $files[] = new Writing_On_GitHub_File_Info($thing); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return Writing_On_GitHub_Blob|WP_Error |
99 | 99 | */ |
100 | - public function blob( Writing_On_GitHub_File_Info $fileinfo ) { |
|
101 | - $data = $this->call( 'GET', $this->blob_endpoint() . '/' . $fileinfo->sha ); |
|
100 | + public function blob(Writing_On_GitHub_File_Info $fileinfo) { |
|
101 | + $data = $this->call('GET', $this->blob_endpoint() . '/' . $fileinfo->sha); |
|
102 | 102 | |
103 | - if ( is_wp_error( $data ) ) { |
|
103 | + if (is_wp_error($data)) { |
|
104 | 104 | return $data; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $data->path = $fileinfo->path; |
108 | - return new Writing_On_GitHub_Blob( $data ); |
|
108 | + return new Writing_On_GitHub_Blob($data); |
|
109 | 109 | } |
110 | 110 | } |