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

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Avency\Gitea\Endpoint;
use Avency\Gitea\Client;
/**
* Abstract endpoint
*/
abstract class AbstractEndpoint implements EndpointInterface
{
/**
* @param array $array
* @return array
*/
protected function removeNullValues(array $array): array
{
return array_filter(
$array,
function($value) {
return !is_null($value);
}
);
}
}