@@ 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 |
|
@@ 93-111 (lines=19) @@ | ||
90 | * |
|
91 | * @return string|WP_Error |
|
92 | */ |
|
93 | public function master() { |
|
94 | $result = $this->app->api()->fetch()->tree_recursive(); |
|
95 | ||
96 | if ( is_wp_error( $result ) ) { |
|
97 | /* @var WP_Error $result */ |
|
98 | return $result; |
|
99 | } |
|
100 | ||
101 | if ( is_array( $result ) ) { |
|
102 | $result = $this->import_files( $result ); |
|
103 | } |
|
104 | ||
105 | if ( is_wp_error( $result ) ) { |
|
106 | /* @var WP_Error $result */ |
|
107 | return $result; |
|
108 | } |
|
109 | ||
110 | return __( 'Payload processed', 'writing-on-github' ); |
|
111 | } |
|
112 | ||
113 | /** |
|
114 | * Do compare |