@@ 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 |
|
@@ 99-117 (lines=19) @@ | ||
96 | * |
|
97 | * @return string|WP_Error |
|
98 | */ |
|
99 | public function master() { |
|
100 | $result = $this->app->api()->fetch()->tree_recursive(); |
|
101 | ||
102 | if ( is_wp_error( $result ) ) { |
|
103 | /* @var WP_Error $result */ |
|
104 | return $result; |
|
105 | } |
|
106 | ||
107 | if ( is_array( $result ) ) { |
|
108 | $result = $this->import_files( $result ); |
|
109 | } |
|
110 | ||
111 | if ( is_wp_error( $result ) ) { |
|
112 | /* @var WP_Error $result */ |
|
113 | return $result; |
|
114 | } |
|
115 | ||
116 | return __( 'Payload processed', 'writing-on-github' ); |
|
117 | } |
|
118 | ||
119 | /** |
|
120 | * Checks whether the provided blob should be imported. |