please remove the `foreach` loop here and add a test on the delay value like 

```
if (null !== $delay && $delay < 0) {
    throw new InvalidArgumentException('Delay must be a positive integer.');
}
```