Completed
Push — d64 ( b18498...be696f )
by Welling
24:39 queued 09:01
created

ClientRemote::getGroup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
/**
4
 * Directus – <http://getdirectus.com>
5
 *
6
 * @link      The canonical repository – <https://github.com/directus/directus>
7
 * @copyright Copyright 2006-2016 RANGER Studio, LLC – <http://rangerstudio.com>
8
 * @license   GNU General Public License (v3) – <http://www.gnu.org/copyleft/gpl.html>
9
 */
10
11
namespace Directus\SDK;
12
13
/**
14
 * Client Remote
15
 *
16
 * @author Welling Guzmán <[email protected]>
17
 */
18
class ClientRemote extends BaseClientRemote
19
{
20
    protected $baseEndpoint = 'http://localhost/api';
21
    protected $hostedBaseEndpointFormat = 'https://%s.directus.io/api';
22
23 2
    public function getTables(array $params = [])
24
    {
25 2
        return $this->performRequest('GET', static::TABLE_LIST_ENDPOINT);
1 ignored issue
show
Bug Compatibility introduced by
The expression $this->performRequest('G...::TABLE_LIST_ENDPOINT); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\Entry to the return on line 25 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getTables of type Directus\SDK\Response\EntryCollection.
Loading history...
26
    }
27
28 4
    public function getTable($tableName)
29
    {
30 4
        return $this->performRequest('GET', static::TABLE_INFORMATION_ENDPOINT, $tableName);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G..._ENDPOINT, $tableName); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\EntryCollection to the return on line 30 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getTable of type Directus\SDK\Response\Entry.
Loading history...
31
    }
32
33 2
    public function getColumns($tableName, array $params = [])
34
    {
35 2
        return $this->performRequest('GET', static::COLUMN_LIST_ENDPOINT, $tableName);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G..._ENDPOINT, $tableName); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\Entry to the return on line 35 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getColumns of type Directus\SDK\Response\EntryCollection.
Loading history...
36
    }
37
38 2
    public function getColumn($tableName, $columnName)
39
    {
40 2
        return $this->performRequest('GET', static::COLUMN_INFORMATION_ENDPOINT, [$tableName, $columnName]);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G...bleName, $columnName)); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\EntryCollection to the return on line 40 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getColumn of type Directus\SDK\Response\Entry.
Loading history...
41
    }
42
43 2
    public function getEntries($tableName, array $options = [])
44
    {
45 2
        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...
Bug Compatibility introduced by
The expression $this->performRequest('G..._ENDPOINT, $tableName); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\Entry to the return on line 45 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getEntries of type Directus\SDK\Response\EntryCollection.
Loading history...
46
    }
47
48 2
    public function getEntry($tableName, $id, array $options = [])
49
    {
50 2
        return $this->performRequest('GET', static::TABLE_ENTRY_ENDPOINT, [$tableName, $id]);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G...rray($tableName, $id)); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\EntryCollection to the return on line 50 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getEntry of type Directus\SDK\Response\Entry.
Loading history...
51
    }
52
53 2
    public function getUsers(array $params = [])
54
    {
55 2
        return $this->getEntries('directus_users', $params);
56
    }
57
58 2
    public function getUser($id, array $params = [])
59
    {
60 2
        return $this->getEntry($id, 'directus_users', $params);
61
    }
62
63 2
    public function getGroups()
64
    {
65 2
        return $this->performRequest('GET', static::GROUP_LIST_ENDPOINT);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G...::GROUP_LIST_ENDPOINT); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\Entry to the return on line 65 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getGroups of type Directus\SDK\Response\EntryCollection.
Loading history...
66
    }
67
68 2
    public function getGroup($groupID)
69
    {
70 2
        return $this->performRequest('GET', static::GROUP_INFORMATION_ENDPOINT, $groupID);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G...ON_ENDPOINT, $groupID); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\EntryCollection to the return on line 70 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getGroup of type Directus\SDK\Response\Entry.
Loading history...
71
    }
72
73 2
    public function getGroupPrivileges($groupID)
74
    {
75 2
        return $this->performRequest('GET', static::GROUP_PRIVILEGES_ENDPOINT, $groupID);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G...ES_ENDPOINT, $groupID); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\Entry to the return on line 75 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getGroupPrivileges of type Directus\SDK\Response\EntryCollection.
Loading history...
76
    }
77
78 2
    public function getFiles()
79
    {
80 2
        return $this->performRequest('GET', static::FILE_LIST_ENDPOINT);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G...c::FILE_LIST_ENDPOINT); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\Entry to the return on line 80 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getFiles of type Directus\SDK\Response\EntryCollection.
Loading history...
81
    }
82
83 2
    public function getFile($fileID)
84
    {
85 2
        return $this->performRequest('GET', static::FILE_INFORMATION_ENDPOINT, $fileID);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G...ION_ENDPOINT, $fileID); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\EntryCollection to the return on line 85 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getFile of type Directus\SDK\Response\Entry.
Loading history...
86
    }
87
88 2
    public function getSettings()
89
    {
90 2
        return $this->performRequest('GET', static::SETTING_LIST_ENDPOINT);
91
    }
92
93 2
    public function getSettingsByCollection($collectionName)
94
    {
95 2
        return $this->performRequest('GET', static::SETTING_COLLECTION_ENDPOINT, $collectionName);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G...OINT, $collectionName); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\Entry to the return on line 95 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInt...getSettingsByCollection of type Directus\SDK\Response\EntryCollection.
Loading history...
96
    }
97
98 2
    public function getMessages($userId)
99
    {
100 2
        return $this->performRequest('GET', static::MESSAGES_USER_ENDPOINT, $userId);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->performRequest('G...SER_ENDPOINT, $userId); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\Entry to the return on line 100 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::getMessages of type Directus\SDK\Response\EntryCollection.
Loading history...
101
    }
102
103 2
    public function createEntry($tableName, array $data)
104
    {
105
        return $this->performRequest('POST', static::TABLE_ENTRY_CREATE_ENDPOINT, $tableName, $data);
0 ignored issues
show
Unused Code introduced by
The call to ClientRemote::performRequest() has too many arguments starting with $data.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
Bug Compatibility introduced by
The expression $this->performRequest('P...NT, $tableName, $data); of type Directus\SDK\Response\En...ctus\SDK\Response\Entry adds the type Directus\SDK\Response\EntryCollection to the return on line 105 which is incompatible with the return type declared by the interface Directus\SDK\RequestsInterface::createEntry of type Directus\SDK\Response\Entry.
Loading history...
106
    }
107
108
    public function updateEntry($tableName, $id, array $data)
109
    {
110
        // TODO: Implement updateEntry() method.
111
    }
112
113
    public function deleteEntry($tableName, $ids)
114
    {
115
        // TODO: Implement deleteEntry() method.
116
    }
117
118
    public function createUser(array $data)
119
    {
120
        // TODO: Implement createUser() method.
121
    }
122
123
    public function updateUser($id, array $data)
124
    {
125
        // TODO: Implement updateUser() method.
126
    }
127
128
    public function deleteUser($ids)
129
    {
130
        // TODO: Implement deleteUser() method.
131
    }
132
133
    public function createFile(array $data)
134
    {
135
        // TODO: Implement createFile() method.
136
    }
137
138
    public function updateFile($id, array $data)
139
    {
140
        // TODO: Implement updateFile() method.
141
    }
142
143
    public function deleteFile($ids)
144
    {
145
        // TODO: Implement deleteFile() method.
146
    }
147
}
148