This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fd201c
commit bb8f124
Showing
4 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Github\Client; | ||
use Github\HttpClient\Message\ResponseMediator; | ||
|
||
class GitHubMarkdownParser | ||
{ | ||
private $client; | ||
|
||
public function __construct($user, Client $client) | ||
{ | ||
$this->client = $client; | ||
$this->client->authenticate($user->token, Client::AUTH_HTTP_TOKEN); | ||
} | ||
|
||
public function parse($markdown) | ||
{ | ||
$body = json_encode([ | ||
'text' => $markdown | ||
]); | ||
|
||
$response = $this->client->getHttpClient()->post('markdown', $body); | ||
|
||
return ResponseMediator::getContent($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters