| @@ 35-50 (lines=16) @@ | ||
| 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 | $result = $this->import_files( $result ); |
|
| 45 | ||
| 46 | if ( is_wp_error( $result ) ) { |
|
| 47 | return $files; |
|
| 48 | } |
|
| 49 | ||
| 50 | return __( 'Payload processed', 'writing-on-github' ); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| @@ 91-105 (lines=15) @@ | ||
| 88 | * |
|
| 89 | * @return string|WP_Error |
|
| 90 | */ |
|
| 91 | public function master() { |
|
| 92 | $result = $this->app->api()->fetch()->tree_recursive(); |
|
| 93 | ||
| 94 | if ( is_wp_error( $result ) ) { |
|
| 95 | /* @var WP_Error $result */ |
|
| 96 | return $result; |
|
| 97 | } |
|
| 98 | ||
| 99 | $result = $this->import_files( $result ); |
|
| 100 | ||
| 101 | if ( is_wp_error( $result ) ) { |
|
| 102 | return $result; |
|
| 103 | } |
|
| 104 | ||
| 105 | return __( 'Payload processed', 'writing-on-github' ); |
|
| 106 | } |
|
| 107 | ||
| 108 | /** |
|