FileDownloaderDummy::getCacheKeyCompat()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
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 1
    public static function getCacheKeyCompat(Package\PackageInterface $p, $processedUrl)
21
    {
22 1
        static $rgetCacheKey, $my;
23 1
        if (!$rgetCacheKey) {
24 1
            $rgetCacheKey = new \ReflectionMethod('Composer\Downloader\FileDownloader', 'getCacheKey');
25 1
            $rgetCacheKey->setAccessible(true);
26 1
            $my = new self;
27
        }
28
29 1
        return $rgetCacheKey->invoke($my, $p, $processedUrl);
30
    }
31
}
32