mirror of
https://github.com/avency/Gitea.git
synced 2025-10-29 18:52:33 +01:00
fix: Filter only null values
Creates an AbstractEndpoint to provide a method to filter only `null` values.
This commit is contained in:
27
Classes/Endpoint/AbstractEndpoint.php
Normal file
27
Classes/Endpoint/AbstractEndpoint.php
Normal 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);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user