Subversion-Projekte lars-tiefland.laravel_shop

Revision

Zur aktuellen Revision | Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
/*
4
 * This file is part of Psy Shell.
5
 *
6
 * (c) 2012-2022 Justin Hileman
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
namespace Psy\VersionUpdater\Downloader;
13
 
14
use Psy\Exception\ErrorException;
15
use Psy\VersionUpdater\Downloader;
16
 
17
class Factory
18
{
19
    /**
20
     * @return Downloader
21
     *
22
     * @throws ErrorException If no downloaders can be used
23
     */
24
    public static function getDownloader(): Downloader
25
    {
26
        if (\extension_loaded('curl')) {
27
            return new CurlDownloader();
28
        } elseif (\ini_get('allow_url_fopen')) {
29
            return new FileDownloader();
30
        }
31
        throw new ErrorException('No downloader available.');
32
    }
33
}