| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 3.5388 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 16 | 1 | public function determineUserAgent(RequestInterface $request, array $options): string |
|
| 17 | { |
||
| 18 | 1 | if (!isset($options[Options::PACKAGE])) { |
|
| 19 | 1 | throw new InvalidArgumentException('Missing package option'); |
|
| 20 | } |
||
| 21 | |||
| 22 | $package = $options[Options::PACKAGE]; |
||
| 23 | |||
| 24 | $chunks = []; |
||
| 25 | $chunks[] = $package; |
||
| 26 | $chunks[] = explode('@', Versions::getVersion($package))[0]; |
||
| 27 | $chunks[] = $this->getWebsite($package); |
||
| 28 | |||
| 29 | return sprintf( |
||
| 30 | self::USER_AGENT, |
||
| 31 | ...$chunks |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | |||
| 51 |