| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 122 | public function __construct(string $resource, int $limit, int $ttl, string $prefix = '') |
|
| 17 | { |
||
| 18 | 122 | if (empty($resource)) { |
|
| 19 | 1 | throw new \InvalidArgumentException('A non-empty string is required for a throttle\'s "resource".'); |
|
| 20 | } |
||
| 21 | |||
| 22 | 121 | if ($limit < 1) { |
|
| 23 | 2 | throw new \InvalidArgumentException('A positive integer is required for a throttle\'s "limit".'); |
|
| 24 | } |
||
| 25 | |||
| 26 | 119 | if ($ttl < 1) { |
|
| 27 | 2 | throw new \InvalidArgumentException('A positive number is required for a throttle\'s "time to live".'); |
|
| 28 | } |
||
| 29 | |||
| 30 | 117 | $this->resource = $resource; |
|
| 31 | 117 | $this->limit = $limit; |
|
| 32 | 117 | $this->ttl = $ttl; |
|
| 33 | 117 | $this->prefix = $prefix; |
|
| 34 | 117 | } |
|
| 61 |