*/ public function to_array() { return array( 'id' => $this->id, 'owner' => $this->owner, 'repo' => $this->repo, 'branch' => $this->branch, 'theme_slug' => $this->theme_slug, 'activate_on_first_sync' => $this->activate_on_first_sync, 'recover_images' => $this->recover_images, 'webhook_id' => $this->webhook_id, 'webhook_secret' => $this->webhook_secret, 'last_synced_sha' => $this->last_synced_sha, 'last_synced_at' => $this->last_synced_at, 'status' => $this->status, 'last_error' => $this->last_error, 'pending_run_id' => $this->pending_run_id, 'pending_sha' => $this->pending_sha, ); } /** * @param array $data As produced by to_array(). * * @return self */ public static function from_array( array $data ) { $project = new self(); foreach ( $data as $key => $value ) { if ( property_exists( $project, $key ) ) { $project->$key = $value; } } return $project; } /** * @return string "owner/repo", the form GitHub's API and UI both use. */ public function full_name() { return $this->owner . '/' . $this->repo; } }