Completed
Pull Request — master (#80)
by Hiraku
02:32
created

FileDownloaderDummy   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 91.67%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 4
c 2
b 1
f 1
lcom 0
cbo 1
dl 0
loc 25
ccs 11
cts 12
cp 0.9167
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getCacheKeyCompat() 0 17 3
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
            return $rgetCacheKey->invoke($my, $p);
31
        }
32
33
        // @codeCoverageIgnoreStart
34
        return $rgetCacheKey->invoke($my, $p, $processedUrl);
35
        // @codeCoverageIgnoreEnd
36
    }
37
}
38