| Total Complexity | 7 | 
| Total Lines | 44 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 12 | class MaintenanceProxyExtension extends Extension  | 
            ||
| 13 | { | 
            ||
| 14 | /**  | 
            ||
| 15 | * Configures required environment settings for Composer's use, applies to  | 
            ||
| 16 |      * {@link \BringYourOwnIdeas\Maintenance\Util\ComposerLoader} and is applied before ComposerLoaderExtension in | 
            ||
| 17 | * bringyourownideas/silverstripe-composer-update-checker to ensure the proxy information is set before Composer  | 
            ||
| 18 | * is created  | 
            ||
| 19 | */  | 
            ||
| 20 | public function onAfterBuild()  | 
            ||
| 25 | }  | 
            ||
| 26 | }  | 
            ||
| 27 | |||
| 28 | /**  | 
            ||
| 29 |      * Provide proxy options for {@link \BringYourOwnIdeas\Maintenance\Util\ApiLoader} instances to use in | 
            ||
| 30 | * their Guzzle clients  | 
            ||
| 31 | *  | 
            ||
| 32 | * @param array $options  | 
            ||
| 33 | */  | 
            ||
| 34 | public function updateClientOptions(&$options)  | 
            ||
| 35 |     { | 
            ||
| 36 |         if ($proxy = $this->getCwpProxy()) { | 
            ||
| 37 | $options['proxy'] = $proxy;  | 
            ||
| 38 | }  | 
            ||
| 39 | }  | 
            ||
| 40 | |||
| 41 | /**  | 
            ||
| 42 | * Returns a formatted CWP proxy string, e.g. `tcp://proxy.cwp.govt.nz:1234`  | 
            ||
| 43 | *  | 
            ||
| 44 | * @return string  | 
            ||
| 45 | */  | 
            ||
| 46 | protected function getCwpProxy()  | 
            ||
| 56 | );  | 
            ||
| 57 | }  | 
            ||
| 59 |