PackageHelper::getPackages()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 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 Adam Piotrowski
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