@@ 36-42 (lines=7) @@ | ||
33 | ||
34 | // Single request |
|
35 | if ($this->isSingleRequest($payload)) { |
|
36 | if ($this->isValidCall($payload)) { |
|
37 | $units[] = new CallUnit($payload['id'], $payload['method'], $payload['params'] ?? []); |
|
38 | } elseif ($this->isValidNotification($payload)) { |
|
39 | $units[] = new CallNotification($payload['method'], $payload['params']); |
|
40 | } else { |
|
41 | $units[] = new CallError(new InvalidRequestException()); |
|
42 | } |
|
43 | ||
44 | return new CallSpecifier($units, true); |
|
45 | } |
|
@@ 49-55 (lines=7) @@ | ||
46 | ||
47 | // Batch request |
|
48 | foreach ($payload as $record) { |
|
49 | if ($this->isValidCall($record)) { |
|
50 | $units[] = new CallUnit($record['id'], $record['method'], $record['params'] ?? []); |
|
51 | } elseif ($this->isValidNotification($record)) { |
|
52 | $units[] = new CallNotification($record['method'], $record['params'] ?? []); |
|
53 | } else { |
|
54 | $units[] = new CallError(new InvalidRequestException()); |
|
55 | } |
|
56 | } |
|
57 | ||
58 | return new CallSpecifier($units, false); |