コード例 #1
0
ファイル: Sync.php プロジェクト: petermac-/WP-Gistpen
 /**
  * Creates a new Gistpen on Gist
  *
  * @param Commit              $commit    Commit object
  * @return string|\WP_Error               Gist ID on success, WP_Error on failure
  * @since 0.5.0
  */
 protected function create_gist($commit)
 {
     $response = $this->gist->create_gist($commit);
     if (is_wp_error($response)) {
         return $response;
     }
     $result = $this->database->persist('head')->set_gist_id($commit->get_head_id(), $response['id']);
     if (is_wp_error($result)) {
         return $result;
     }
     $result = $this->database->persist('commit')->set_gist_id($commit->get_ID(), $response['history'][0]['version']);
     if (is_wp_error($result)) {
         return $result;
     }
     return $response;
 }