Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public static function execute($url, $directory, $type) |
||
18 | { |
||
19 | // Download the file. |
||
20 | $client = new Client(); |
||
21 | $response = $client->get($url); |
||
22 | if (200 !== $response->getStatusCode()) { |
||
23 | return ''; |
||
24 | } |
||
25 | |||
26 | // Store the temporary file. |
||
27 | $tempFile = self::makeTempName($directory, $type); |
||
28 | file_put_contents($tempFile, $response->getBody()); |
||
29 | |||
30 | return $tempFile; |
||
31 | } |
||
32 | |||
46 |