WorldsResource   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 6 1
A getList() 0 6 1
1
<?php
2
3
namespace Igorsgm\TibiaDataApi\Resources;
4
5
use Igorsgm\TibiaDataApi\Response\WorldResponse;
6
use Igorsgm\TibiaDataApi\Response\WorldsResponse;
7
8
/**
9
 * @see https://tibiadata.com/doc-api-v2/worlds/
10
 */
11
class WorldsResource extends AbstractResource
12
{
13
    /**
14
     * @param  string  $name
15
     * @return WorldResponse
16
     * @throws \GuzzleHttp\Exception\GuzzleException
17
     * @throws \Igorsgm\TibiaDataApi\Exceptions\NotFoundException
18
     * @throws \Igorsgm\TibiaDataApi\Exceptions\ImmutableException
19
     */
20
    public function get(string $name): WorldResponse
21
    {
22
        $response = $this->sendRequest('GET', "world/{$name}.json");
23
24
        return new WorldResponse($response);
25
    }
26
27
    /**
28
     * @return WorldsResponse
29
     * @throws \GuzzleHttp\Exception\GuzzleException
30
     * @throws \Igorsgm\TibiaDataApi\Exceptions\ImmutableException
31
     */
32
    public function getList(): WorldsResponse
33
    {
34
        $response = $this->sendRequest('GET', "worlds.json");
35
36
        return new WorldsResponse($response);
37
    }
38
}
39