@@ 35-53 (lines=19) @@ | ||
32 | * |
|
33 | * @return string|WP_Error |
|
34 | */ |
|
35 | public function payload( Writing_On_GitHub_Payload $payload ) { |
|
36 | ||
37 | $result = $this->app->api()->fetch()->compare( $payload->get_before_commit_id() ); |
|
38 | ||
39 | if ( is_wp_error( $result ) ) { |
|
40 | /* @var WP_Error $result */ |
|
41 | return $result; |
|
42 | } |
|
43 | ||
44 | if ( is_array( $result ) ) { |
|
45 | $result = $this->import_files( $result ); |
|
46 | } |
|
47 | ||
48 | if ( is_wp_error( $result ) ) { |
|
49 | return $files; |
|
50 | } |
|
51 | ||
52 | return __( 'Payload processed', 'writing-on-github' ); |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * import blob by files |
|
@@ 90-108 (lines=19) @@ | ||
87 | * |
|
88 | * @return string|WP_Error |
|
89 | */ |
|
90 | public function master() { |
|
91 | $result = $this->app->api()->fetch()->tree_recursive(); |
|
92 | ||
93 | if ( is_wp_error( $result ) ) { |
|
94 | /* @var WP_Error $result */ |
|
95 | return $result; |
|
96 | } |
|
97 | ||
98 | if ( is_array( $result ) ) { |
|
99 | $result = $this->import_files( $result ); |
|
100 | } |
|
101 | ||
102 | if ( is_wp_error( $result ) ) { |
|
103 | /* @var WP_Error $result */ |
|
104 | return $result; |
|
105 | } |
|
106 | ||
107 | return __( 'Payload processed', 'writing-on-github' ); |
|
108 | } |
|
109 | ||
110 | /** |
|
111 | * Do compare |