Completed
Push — master ( 419055...1fdeea )
by Hiraku
9s
created

FileDownloaderDummy::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
/*
3
 * @author Hiraku NAKANO
4
 * @license MIT https://github.com/hirak/prestissimo
5
 */
6
namespace Hirak\Prestissimo;
7
8
use Composer\Package;
9
10
/**
11
 * dirty hack for getCacheKey compatiblity
12
 */
13
class FileDownloaderDummy extends \Composer\Downloader\FileDownloader
14
{
15 1
    public function __construct()
16
    {
17
        // do nothing
18 1
    }
19
20 2
    public static function getCacheKeyCompat(Package\PackageInterface $p, $processedUrl)
21
    {
22 2
        static $rgetCacheKey, $my, $params;
23 2
        if (!$rgetCacheKey) {
24 1
            $rgetCacheKey = new \ReflectionMethod('Composer\Downloader\FileDownloader', 'getCacheKey');
25 1
            $rgetCacheKey->setAccessible(true);
26 1
            $my = new self;
27 1
            $params = count($rgetCacheKey->getParameters());
28 1
        }
29 2
        if ($params === 1) {
30 2
            return $rgetCacheKey->invoke($my, $p);
31
        }
32
33
        // @codeCoverageIgnoreStart
34
        return $rgetCacheKey->invoke($my, $p, $processedUrl);
35
        // @codeCoverageIgnoreEnd
36
    }
37
}
38