fix: Filter only null values

Creates an AbstractEndpoint to provide a method
to filter only `null` values.
This commit is contained in:
Michael Gerdemann
2020-01-18 09:18:45 +01:00
parent 1b66abe535
commit 09416c4ce1
3 changed files with 32 additions and 5 deletions

View File

@ -9,7 +9,7 @@ use Avency\Gitea\Client;
/**
* Miscellaneous endpoint
*/
class Miscellaneous implements EndpointInterface
class Miscellaneous extends AbstractEndpoint implements EndpointInterface
{
const BASE_URI = 'api/v1';
@ -41,7 +41,7 @@ class Miscellaneous implements EndpointInterface
'text' => $text,
'wiki' => $wiki
];
$options['json'] = array_filter($options['json']);
$options['json'] = $this->removeNullValues($options['json']);
$response = $this->client->request(self::BASE_URI . '/markdown', 'POST', $options);
return (string)$response->getBody();