Completed
Push — master ( 156cbf...ec5f3d )
by Frederick
14s
created

NpmRegistryRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getResourceByPath() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
namespace Vanbrabantf\NpmStatFetcher;
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
}
30