Completed
Push — master ( 5309e4...b64411 )
by Frederick
12s
created

NpmRegistryRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getResourceByPath() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
namespace Vanbrabantf\NpmStatFetcher\Repositories;
4
5
use GuzzleHttp\Client;
6
7
class NpmRegistryRepository
8
{
9
    /**
10
     * @var Client
11
     */
12
    private $client;
13
14
    public function __construct(Client $client)
15
    {
16
        $this->client = $client;
17
    }
18
19
    /**
20
     * @param string $path
21
     * @return string
22
     */
23
    public function getResourceByPath(string $path): string
24
    {
25
        $resource =  $this->client->get($path);
26
27
        return $resource->getBody()->getContents();
28
    }
29
}