Skip to content

Commit

Permalink
filter out null values
Browse files Browse the repository at this point in the history
  • Loading branch information
arietimmerman committed Aug 27, 2024
1 parent 51ebce2 commit 41512ed
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/SCIM/ListResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,22 @@ public function toJson($options = 0)

public function toSCIMArray()
{
return [
'totalResults' => $this->totalResults,
"itemsPerPage" => count($this->resourceObjects->toArray()),

"startIndex" => $this->startIndex,

"nextCursor" => $this->nextCursor,
"previousCursor" => $this->previousCursor,

"schemas" => [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
'Resources' => Helper::prepareReturn($this->resourceObjects, $this->resourceType, $this->attributes),
];
return array_filter(
[
'totalResults' => $this->totalResults,
"itemsPerPage" => count($this->resourceObjects->toArray()),

"startIndex" => $this->startIndex,

"nextCursor" => $this->nextCursor,
"previousCursor" => $this->previousCursor,

"schemas" => [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
'Resources' => Helper::prepareReturn($this->resourceObjects, $this->resourceType, $this->attributes),
],
fn ($value) => $value !== null
);
}
}

0 comments on commit 41512ed

Please sign in to comment.