News   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 29
ccs 6
cts 6
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAll() 0 3 1
A getForAsset() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Codenixsv\MessariApi\Api;
6
7
use Exception;
8
9
/**
10
 * Class News
11
 * @package Codenixsv\MessariApi\Api
12
 */
13
class News extends Api
14
{
15
    /**
16
     * Get the latest (paginated) news and analysis for all assets.
17
     *
18
     * @param array $params
19
     * @return array
20
     * @throws Exception
21
     */
22 2
    public function getAll($params = []): array
23
    {
24 2
        return $this->all('news', $params);
25
    }
26
27
28
    /**
29
     * Get the latest (paginated) news and analysis for an asset.
30
     *
31
     * @param string $assetKey
32
     * @param array $params
33
     * @return array
34
     * @throws Exception
35
     */
36 2
    public function getForAsset(string $assetKey, array $params = []): array
37
    {
38 2
        $query = $this->queryBuilder->buildQuery($params);
39 2
        $response = $this->client->getBaseClient()->get('/news/' . strtolower($assetKey) . $query);
40
41 2
        return $this->transformer->transform($response);
42
    }
43
}
44