PackageHelper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 24
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getPackages() 0 6 1
A getPackage() 0 4 1
1
<?php
2
/*
3
 * WellCommerce Open-Source E-Commerce Platform
4
 * 
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 * 
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
13
namespace WellCommerce\Bundle\CoreBundle\Helper\Package;
14
15
use Packagist\Api\Client;
16
use Packagist\Api\Result\Package as PackagistPackage;
17
use Symfony\Component\Filesystem\Filesystem;
18
19
/**
20
 * Class PackageHelper
21
 *
22
 * @author  Adam Piotrowski <[email protected]>
23
 */
24
class PackageHelper implements PackageHelperInterface
25
{
26
    /**
27
     * @var Client
28
     */
29
    protected $client;
30
    
31
    public function __construct(Client $client)
32
    {
33
        $this->client             = $client;
34
    }
35
    
36
    public function getPackages(array $criteria)
37
    {
38
        $this->client->setPackagistUrl(self::PACKAGIST_URL);
39
        
40
        return $this->client->all($criteria);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->client->all($criteria); of type array|Packagist\Api\Result\Package adds the type Packagist\Api\Result\Package to the return on line 40 which is incompatible with the return type declared by the interface WellCommerce\Bundle\Core...rInterface::getPackages of type array.
Loading history...
41
    }
42
    
43
    public function getPackage(string $name): PackagistPackage
44
    {
45
        return $this->client->get($name);
46
    }
47
}
48