Skip to content

Commit 23a2eed

Browse files
filter out null values (limosa-io#86)
1 parent 51ebce2 commit 23a2eed

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/SCIM/ListResponse.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,22 @@ public function toJson($options = 0)
2929

3030
public function toSCIMArray()
3131
{
32-
return [
33-
'totalResults' => $this->totalResults,
34-
"itemsPerPage" => count($this->resourceObjects->toArray()),
35-
36-
"startIndex" => $this->startIndex,
37-
38-
"nextCursor" => $this->nextCursor,
39-
"previousCursor" => $this->previousCursor,
40-
41-
"schemas" => [
42-
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
43-
],
44-
'Resources' => Helper::prepareReturn($this->resourceObjects, $this->resourceType, $this->attributes),
45-
];
32+
return array_filter(
33+
[
34+
'totalResults' => $this->totalResults,
35+
"itemsPerPage" => count($this->resourceObjects->toArray()),
36+
37+
"startIndex" => $this->startIndex,
38+
39+
"nextCursor" => $this->nextCursor,
40+
"previousCursor" => $this->previousCursor,
41+
42+
"schemas" => [
43+
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
44+
],
45+
'Resources' => Helper::prepareReturn($this->resourceObjects, $this->resourceType, $this->attributes),
46+
],
47+
fn ($value) => $value !== null
48+
);
4649
}
4750
}

0 commit comments

Comments
 (0)