News::getForAsset()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
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