Completed
Push — master ( 495e06...161604 )
by Welling
02:05
created

ClientRemote   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 13
lcom 1
cbo 1
dl 0
loc 70
rs 10
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A fetchTables() 0 4 1
A fetchTableInfo() 0 4 1
A fetchColumns() 0 4 1
A fetchColumnInfo() 0 4 1
A getEntries() 0 4 1
A getEntry() 0 4 1
A fetchGroups() 0 4 1
A fetchGroupInfo() 0 4 1
A fetchGroupPrivileges() 0 4 1
A fetchFiles() 0 4 1
A fetchFileInfo() 0 4 1
A fetchSettings() 0 4 1
A fetchSettingCollection() 0 4 1
1
<?php
2
3
namespace Directus\SDK;
4
5
class ClientRemote extends BaseClientRemote implements RequestsInterface
6
{
7
    protected $baseEndpoint = 'http://localhost/api';
8
    protected $hostedBaseEndpointFormat = 'https://%s.directus.io/api';
9
10
    public function fetchTables()
11
    {
12
        return $this->performRequest('GET', static::TABLE_LIST_ENDPOINT);
13
    }
14
15
    public function fetchTableInfo($tableName)
16
    {
17
        return $this->performRequest('GET', static::TABLE_INFORMATION_ENDPOINT, $tableName);
18
    }
19
20
    public function fetchColumns($tableName)
21
    {
22
        return $this->performRequest('GET', static::COLUMN_LIST_ENDPOINT, $tableName);
23
    }
24
25
    public function fetchColumnInfo($tableName, $columnName)
26
    {
27
        return $this->performRequest('GET', static::COLUMN_INFORMATION_ENDPOINT, [$tableName, $columnName]);
28
    }
29
30
    public function getEntries($tableName, array $options = [])
31
    {
32
        return $this->performRequest('GET', static::TABLE_ENTRIES_ENDPOINT, $tableName);
0 ignored issues
show
Documentation introduced by
$tableName is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
33
    }
34
35
    public function getEntry($id, $tableName, array $options = [])
36
    {
37
        return $this->performRequest('GET', static::TABLE_ENTRY_ENDPOINT, [$tableName, $id]);
38
    }
39
40
    public function fetchGroups()
41
    {
42
        return $this->performRequest('GET', static::GROUP_LIST_ENDPOINT);
43
    }
44
45
    public function fetchGroupInfo($groupID)
46
    {
47
        return $this->performRequest('GET', static::GROUP_INFORMATION_ENDPOINT, $groupID);
48
    }
49
50
    public function fetchGroupPrivileges($groupID)
51
    {
52
        return $this->performRequest('GET', static::GROUP_PRIVILEGES_ENDPOINT, $groupID);
53
    }
54
55
    public function fetchFiles()
56
    {
57
        return $this->performRequest('GET', static::FILE_LIST_ENDPOINT);
58
    }
59
60
    public function fetchFileInfo($fileID)
61
    {
62
        return $this->performRequest('GET', static::FILE_INFORMATION_ENDPOINT, $fileID);
63
    }
64
65
    public function fetchSettings()
66
    {
67
        return $this->performRequest('GET', static::SETTING_LIST_ENDPOINT);
68
    }
69
70
    public function fetchSettingCollection($collectionName)
71
    {
72
        return $this->performRequest('GET', static::SETTING_COLLECTION_ENDPOINT, $collectionName);
73
    }
74
}
75