| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 16 | 2 | public function determineUserAgent(RequestInterface $request, array $options): string |
|
| 17 | { |
||
| 18 | 2 | if (!isset($options[Options::PACKAGE])) { |
|
| 19 | 1 | throw new InvalidArgumentException('Missing package option'); |
|
| 20 | } |
||
| 21 | |||
| 22 | 1 | $package = $options[Options::PACKAGE]; |
|
| 23 | |||
| 24 | 1 | $chunks = []; |
|
| 25 | 1 | $chunks[] = $package; |
|
| 26 | 1 | $chunks[] = explode('@', Versions::getVersion($package))[0]; |
|
| 27 | 1 | $chunks[] = $this->getWebsite($package); |
|
| 28 | |||
| 29 | 1 | return sprintf( |
|
| 30 | 1 | self::USER_AGENT, |
|
| 31 | 1 | ...$chunks |
|
| 32 | ); |
||
| 33 | } |
||
| 34 | |||
| 51 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: