| Conditions | 3 |
| Paths | 4 |
| Total Lines | 27 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function handleError($source, \Composer\Downloader\TransportException $exception) |
||
| 21 | { |
||
| 22 | $statusLabel = sprintf('ERROR %s', $exception->getCode()); |
||
| 23 | |||
| 24 | if (strpos($exception->getMessage(), 'configuration does not allow connections') !== false) { |
||
| 25 | $docsUrl = 'https://github.com/vaimo/composer-patches/blob/master/docs/CONFIGURATION.md#%s'; |
||
| 26 | $subjectReference = 'allow-downloads-from-unsecure-locations'; |
||
| 27 | |||
| 28 | $message = sprintf( |
||
| 29 | 'Your configuration does not allow connections to %s. Override the \'secure-http\' to allow: %s', |
||
| 30 | $source, |
||
| 31 | sprintf($docsUrl, $subjectReference) |
||
| 32 | ); |
||
| 33 | |||
| 34 | $exception = new \Composer\Downloader\TransportException( |
||
| 35 | $message, |
||
| 36 | $exception->getCode() |
||
| 37 | ); |
||
| 38 | |||
| 39 | $statusLabel = 'UNSECURE'; |
||
| 40 | } |
||
| 41 | |||
| 42 | if ($this->gracefulMode) { |
||
| 43 | return $statusLabel; |
||
| 44 | } |
||
| 45 | |||
| 46 | throw $exception; |
||
| 47 | } |
||
| 49 |